|
|||
1. Managing Removable Media (Overview) 2. Managing Removable Media (Tasks) 3. Accessing Removable Media (Tasks) 4. Writing CDs and DVDs (Tasks) 5. Managing Devices (Overview/Tasks) 6. Dynamically Configuring Devices (Tasks) 7. Using USB Devices (Overview) 9. Using InfiniBand Devices (Overview/Tasks) 11. Administering Disks (Tasks) 12. SPARC: Adding a Disk (Tasks) 13. x86: Adding a Disk (Tasks) 14. Configuring Solaris iSCSI Targets and Initiators (Tasks) 15. Configuring and Managing the Solaris Internet Storage Name Service (iSNS) 16. The format Utility (Reference) 17. Managing File Systems (Overview) 18. Creating UFS, TMPFS, and LOFS File Systems (Tasks) 19. Mounting and Unmounting File Systems (Tasks) 20. Using The CacheFS File System (Tasks) 21. Configuring Additional Swap Space (Tasks) 22. Checking UFS File System Consistency (Tasks) 23. UFS File System (Reference) 24. Backing Up and Restoring File Systems (Overview) 25. Backing Up Files and File Systems (Tasks) 26. Using UFS Snapshots (Tasks) 27. Restoring Files and File Systems (Tasks) Restoring Files and File System Backups (Task Map) Preparing to Restore Files and File Systems Restoring Files and File Systems How to Determine Which Tapes to Use How to Restore Files Interactively How to Restore Specific Files Noninteractively 28. UFS Backup and Restore Commands (Reference) 29. Copying UFS Files and File Systems (Tasks) |
Restoring Files and File SystemsWhen 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. How to Determine 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 How to Restore 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 How to Restore 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 28 16:13:52 2004 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 /etcExample 27-4 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 How to Restore a Complete File SystemOccasionally, 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: Adding a System Disk or a Secondary Disk (Task Map) or x86: Adding a System Disk or a Secondary Disk (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 the root (/) and /usr File Systems.
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 819314 sectors in 867 cylinders of 15 tracks, 63 sectors 400.1MB in 55 cyl groups (16 c/g, 7.38MB/g, 3584 i/g) super-block backups (for fsck -F ufs -o b=#) at: 32, 15216, 30400, 45584, 60768, 75952, 91136, 106320, 121504, 136688, 681264, 696448, 711632, 725792, 740976, 756160, 771344, 786528, 801712, 816896, # mount /dev/dsk/c0t0d0s7 /mnt # cd /mnt # ufsrestore rvf /dev/rmt/0 Verify volume and initialize maps Media block size is 126 Dump date: Thu Jul 29 10:14:00 2004 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 How to Restore the root (/) and /usr File Systems
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 CD 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 6Example 27-7 x86: Restoring the 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 CD, 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 |
||
|