Skip Navigation Links | |
Exit Print View | |
System Administration Guide: Devices and File Systems Oracle Solaris 10 1/13 Information Library |
1. Managing Removable Media (Overview/Tasks)
2. Writing CDs and DVDs (Tasks)
4. Dynamically Configuring Devices (Tasks)
5. Managing USB Devices (Tasks)
6. Using InfiniBand Devices (Overview/Tasks)
9. Administering Disks (Tasks)
10. SPARC: Setting Up Disks (Tasks)
11. x86: Setting Up Disks (Tasks)
12. Configuring Oracle Solaris iSCSI Targets (Tasks)
13. The format Utility (Reference)
14. Managing File Systems (Overview)
15. Creating and Mounting File Systems (Tasks)
16. Configuring Additional Swap Space (Tasks)
17. Checking UFS File System Consistency (Tasks)
18. UFS File System (Reference)
19. Backing Up and Restoring UFS File Systems (Overview/Tasks)
Introduction to Backing Up and Restoring UFS File Systems
Why You Should Back Up File Systems
Planning Which UFS File Systems to Back Up
High-Level View of Backing Up and Restoring UFS File Systems (Task Map)
Considerations for Scheduling Backups
How Often Should You Do Backups?
Backup Interval Terms and Definitions
Guidelines for Scheduling Backups
Using Dump Levels to Create Incremental Backups
Example--Dump Levels for Daily, Cumulative Backups
Example--Dump Levels for Daily, Incremental Backups
Example--Daily Cumulative, Weekly Cumulative Backup Schedule
Tape Requirements for the Daily Cumulative, Weekly Cumulative Schedule
Example--Daily Cumulative, Weekly Incremental Backup Schedule
Tape Requirements for the Daily Cumulative, Weekly Incremental Backup Schedule
Example--Daily Incremental, Weekly Cumulative Backup Schedule
Tape Requirements for Daily Incremental, Weekly Cumulative Schedule
Example--Monthly Backup Schedule for a Server
Backing Up UFS Files and File System (Task Map)
Preparing for File System Backups
How to Find UFS File System Names
How to Determine the Number of Tapes Needed for a Full Backup
How to Back Up a UFS File System to Tape
Restoring UFS Files and File System Backups (Task Map)
Preparing to Restore UFS Files and File Systems
Determining the UFS File System Name
Determining the Type of Tape Device You Need
Determining the Tape Device Name
Restoring UFS Files and File Systems
How to Determine Which Tapes to Use
How to Restore UFS Files Interactively
How to Restore Specific UFS Files Noninteractively
20. Using UFS Snapshots (Tasks)
21. Copying Files and File Systems (Tasks)
22. Managing Tape Drives (Tasks)
When you back up files and directories, you save them relative to the file system in which they belong. When you restore files and directories, the ufsrestore command re-creates the file hierarchy in the current working directory.
For example, files backed up from the /export/doc/books directory (where /export is the file system) are saved relative to /export. In other words, the book1 file in the books directory is saved as ./doc/books/book1 on the tape. Later on, if you restored the ./doc/books/book1 file to the /var/tmp directory, the file would be restored to /var/tmp/doc/books/book1.
When you restore individual files and directories, you should restore them to a temporary location, such as the /var/tmp directory. After you verify the files, you can move them to their proper locations. However, you can restore individual files and directories to their original locations. If you do so, be sure you are not overwriting newer files with older versions from the backup tape.
To avoid conflicts with other users, you might want to create and change to a subdirectory, such as the/var/tmp/restore file, in which to restore the files.
If you are restoring a hierarchy, you should restore the files to a temporary directory on the same file system where the files will reside. Then, you can use the mv command to move the entire hierarchy where it belongs after it is restored.
Note - Do not restore files in the /tmp directory even temporarily. The /tmp directory is usually mounted as a TMPFS file system. TMPFS does not support UFS file system attributes such as ACLs.
To retrieve the most recent version of a file, work backward through the incremental backups from highest to lowest dump level and from most recent to least recent date, unless the user requests otherwise.
# ufsrestore ta archive-name ./path/filename ./path/filename
Lists each file on the tape.
Reads the table of contents from the online archive file instead of from the tape.
Identifies the online archive file name.
Identifies the file name or file names you are looking for on the online archive. If successful, the ufsrestore command prints out the inode number and file name. If unsuccessful, ufsrestore prints an error message.
For more information, see ufsrestore(1M).
# ufsrestore tf /dev/rmt/n ./path/filename ./path/filename
Be sure to use the complete path for each filename. If a file is in the backup, its name and inode number are listed. Otherwise, a message states that the file is not on the volume.
# ufsrestore xfs /dev/rmt/n tape-number
Example 19-7 Determining Which Tapes to Use
The following example shows how to check if the /etc/passwd file is in the online archive.
# ufsrestore ta /var/tmp/root.archive ./etc/passwd
The following example shows how to verify that the /etc/passwd file is on the backup tape.
# ufsrestore tf /dev/rmt/0 ./etc/passwd
# cd /var/tmp
# ufsrestore if /dev/rmt/n
Some informational messages and the ufsrestore> prompt are displayed.
ufsrestore> ls [directory-name]
ufsrestore> cd directory-name
ufsrestore> add filenames
ufsrestore> delete filename
ufsrestore> verbose
ufsrestore> extract
The ufsrestore command asks you which volume number to use.
Specify next volume #: 1
The files and directories in the list are extracted and restored to the current working directory.
set owner/mode for `.'? [yn] n
You must wait while the ufsrestore command performs its final cleanup.
ufsrestore> quit
You then see the shell prompt.
Example 19-8 Restoring UFS Files Interactively
The following example shows how to extract the /etc/passwd and /etc/shadow files from the backup tape.
# cd /var/tmp # ufsrestore if /dev/rmt/0 ufsrestore> ls .: .: .sunw/ export/ net/ sbin/ usr/ Sources/ etools/ opt/ scde/ var/ b/ home/ ptools/ set/ vol/ bin kernel/ pkg/ share/ dev/ lib/ platform/ shared/ devices/ lost+found/ proc/ src/ etc/ mnt/ rtools/ tmp/ ufsrestore> cd etc ufsrestore> add passwd shadow ufsrestore> verbose verbose mode on ufsrestore> extract Extract requested files You have not read any volumes yet. Unless you know which volume your file(s) are on you should start with the last volume and work towards the first. Specify next volume #: 1 extract file ./etc/shadow extract file ./etc/passwd Add links Set directory mode, owner, and times. set owner/mode for `.'? [yn] n ufsrestore> quit # cd etc # mv passwd /etc # mv shadow /etc # ls -l /etc
# cd /var/tmp
# ufsrestore xvf /dev/rmt/n filename
Tells ufsrestore to copy specific files or directories in the filename argument.
Displays the file names as they are restored.
Identifies the tape device name.
Specifies one or more file names or directory names, separated by spaces. For example: ./export/home/user1/mail ./export/home/user2/mail.
Specify next volume #: 1
The file or files are restored to the current working directory.
set owner/mode for '.'? [yn] n
Example 19-9 Restoring Specific Files Noninteractively
The following example shows how to noninteractively restore the passwd and shadow files to the /var/tmp directory.
# cd /var/tmp # ufsrestore xvf /dev/rmt/0 ./etc/passwd ./etc/shadow Verify volume and initialize maps Media block size is 126 Dump date: Wed Jul 14 13:36:17 2010 Dumped from: the epoch Level 0 dump of / on starbug:/dev/dsk/c0t0d0s0 Label: none Extract directories from tape Initialize symbol table. Extract requested files You have not read any volumes yet. Unless you know which volume your file(s) are on you should start with the last volume and work towards the first. Specify next volume #: 1 extract file ./etc/passwd extract file ./etc/shadow Add links Set directory mode, owner, and times. Specify next volume #:1 extract file ./etc/passwd extract file ./etc/shadow Add links Set directory mode, owner, and times. set owner/mode for `.'? [yn] n # cd etc # mv passwd /etc # mv shadow /etc # ls -l /etc
Example 19-10 Restoring Files From a Remote Tape Device
You can restore files from a remote tape drive by adding remote-host: to the front of the tape device name, when using the ufsrestore command.
The following example shows how to restore files by using a remote tape drive /dev/rmt/0 on the system venus.
# ufsrestore xf venus:/dev/rmt/0 ./etc/hosts
Occasionally, a file system becomes so damaged that you must completely restore it. Typically, you need to restore a complete file system after a disk failure. You might need to replace the hardware before you can restore the software. For information on how to replace a disk, see SPARC: Setting Up Disks for UFS File Systems (Task Map) or x86: Setting Up Disks for UFS File Systems (Task Map).
Full restoration of a file system such as /export/home can take a lot of time. If you have consistently backed up file systems, you can restore them to their state from the time of the last incremental backup.
Note - You cannot use this procedure to restore the root (/) or /usr file systems. For instructions on restoring these file systems, see How to Restore a UFS root (/) and /usr File System.
# umount /dev/rdsk/device-name
Or:
# umount /file-system
# newfs /dev/rdsk/device-name
You are asked if you want to construct a new file system on the raw device. Verify that the device-name is correct so that you don't destroy the wrong file system.
For more information, see newfs(1M).
newfs: construct a new file system /dev/rdsk/cwtxdysz:(y/n)? y
The new file system is created.
# mount /dev/dsk/device-name /mnt
# cd /mnt
# ufsrestore rvf /dev/rmt/n
The dump level 0 backup is restored. If the backup required multiple tapes, you are prompted to load each tape in numeric order.
Always restore tapes starting with dump level 0 and continuing until you reach the highest dump level.
# ls
# rm restoresymtable
The restoresymtable file that is created and used by the ufsrestore command to check-point the restore is removed.
# cd /
# umount /mnt
# ufsdump 0ucf /dev/rmt/n /dev/rdsk/device-name
A level 0 backup is performed. Always immediately do a full backup of a newly created file system because the ufsrestore command repositions the files and changes the inode allocation.
# mount /dev/dsk/device-name mount-point
The restored file system is mounted and available for use.
# ls mount-point
Example 19-11 Restoring a Complete UFS File System
The following example shows how to restore the /export/home file system.
# newfs /dev/rdsk/c0t0d0s7 newfs: /dev/rdsk/c0t0d0s7 last mounted as /export/home newfs: construct a new file system /dev/rdsk/c0t0d0s7: (y/n)? y /dev/rdsk/c0t0d0s7: 143358064 sectors in 23334 cylinders of 48 tracks, 128 sectors 69999.1MB in 1459 cyl groups (16 c/g, 48.00MB/g, 5824 i/g) super-block backups (for fsck -F ufs -o b=#) at: 32, 98464, 196896, 295328, 393760, 492192, 590624, 689056, 787488, 885920, Initializing cylinder groups: ............................ super-block backups for last 10 cylinder groups at: 142447776, 142546208, 142644640, 142743072, 142841504, 142939936, 143038368, 143136800, 143235232, 143333664 # mount /dev/dsk/c0t0d0s7 /mnt # cd /mnt # ufsrestore rvf /dev/rmt/0 Verify volume and initialize maps Media block size is 126 Dump date: Wed Jul 14 12:45:33 2010 Dumped from: the epoch Level 0 dump of /export/home on starbug:/dev/dsk/c0t0d0s7 Label: none Begin level 0 restore Initialize symbol table. Extract directories from tape Calculate extraction list. Warning: ./lost+found: File exists Make node ./rimmer Make node ./rimmer/wdir Make node ./lister Make node ./pmorph Make node ./inquisitor Make node ./kryten Make node ./kryten/letters Make node ./kryten/reports Extract new leaves. Check pointing the restore extract file ./rimmer/words extract file ./rimmer/words1 extract file ./rimmer/words2 extract file ./rimmer/words3 extract file ./rimmer/wdir/words extract file ./rimmer/wdir/words1 extract file ./rimmer/wdir/words2 extract file ./rimmer/wdir/words3 . . . Add links Set directory mode, owner, and times. Check the symbol table. Check pointing the restore # rm restoresymtable # cd / # umount /mnt # ufsdump 0ucf /dev/rmt/0 /export/home . . . # mount /dev/dsk/c0t0d0s7 /export/home # ls /export/home
For a detailed description about adding a system disk, refer to SPARC: How to Set Up a Disk for a UFS Root File System or x86: How to Set Up a Disk for a UFS Root File System.
# mount /dev/dsk/device-name /mnt
# cd /mnt
# tapes
# ufsrestore rvf /dev/rmt/n
The dump level 0 tape is restored.
Always restore tapes starting with dump level 0 and continuing from the lowest to highest dump level.
# ufsrestore rvf /dev/rmt/n
The next level tape is restored.
# ls
# rm restoresymtable
The restoresymtable file that is created and used by the ufsrestore command to check-point the restore is removed.
# cd /
# umount /mnt
# fsck /dev/rdsk/device-name
The restored file system is checked for consistency.
On a SPARC system:
# installboot /usr/platform/`uname-i`/lib/fs/ufs/bootblk /dev/rdsk/device-name
For more information, see installboot(1M).
For an example of using the installboot command on a SPARC based system, see Example 19-12.
On an x86 system:
# /sbin/installgrub /boot/grub/stage1 /boot/grub/stage2 /dev/rdsk/cwtxdysz
For more information, see installgrub(1M).
For an example of using the installgrub command on an x86 based system, see Example 19-13.
# ufsdump 0uf /dev/rmt/n /dev/rdsk/device-name
A dump level 0 backup is performed. Always immediately do a full backup of a newly created file system because the ufsrestore command repositions the files and changes the inode allocation.
# init 6
The system is rebooted.
Example 19-12 SPARC: Restoring a UFS root (/) File System
This example shows how to restore the root (/) file system on a SPARC system. This example assumes that the system is booted from a local Solaris DVD or from the network.
# mount /dev/dsk/c0t3d0s0 /mnt # cd /mnt # tapes # ufsrestore rvf /dev/rmt/0 # ls # rm restoresymtable # cd / # umount /mnt # fsck /dev/rdsk/c0t3d0s0 # installboot /usr/platform/sun4u/lib/fs/ufs/bootblk /dev/rdsk/c0t3d0s0 # ufsdump 0uf /dev/rmt/0 /dev/rdsk/c0t3d0s0 # init 6
Example 19-13 x86: Restoring a UFS root (/) File System
This example shows how to restore the root (/) file system on an x86 system. This example assumes that the system is booted from a GRUB failsafe boot session, local Solaris DVD, or from the network.
# mount /dev/dsk/c0t3d0s0 /mnt # cd /mnt # tapes # ufsrestore rvf /dev/rmt/0 # ls # rm restoresymtable # cd / # umount /mnt # fsck /dev/rdsk/c0t3d0s0 # /sbin/installgrub /boot/grub/stage1 /boot/grub/stage2 /dev/rdsk/c0t3d0s0 stage1 written to partition 0 sector 0 (abs 2016) stage2 written to to partition 0, 227 sectors starting 50 (abs 2066) # ufsdump 0uf /dev/rmt/0 /dev/rdsk/c0t3d0s0 # init 6