A UFS file system can be backed up using command ufsdump. Note that you should use it on unmounted or read-only FS. Even better, you can first create snapshot of FS (read only copy of FS) and use ufsdump on snapshot. Check how to work with UFS snapshots . The command ufsdump has many options so you better read man page. Probably first thing you want to do is to determine size of your backup, say you need to know how many tapes you need, if you backup on tapes.
# ufsdump -S /my-filesystem 30567424 |
# ufsdump 0uaf archive-file fs-dump /my-filesystem DUMP: Date of this level 0 dump: December 2, 2009 11:44:19 AM PST DUMP: Date of last level 0 dump: the epoch DUMP: Dumping /dev/rdsk/c1t0d0s4 (hostname:/my-filesystem) to fs-dump. DUMP: Mapping (Pass I) [regular files] DUMP: Mapping (Pass II) [directories] DUMP: Writing 32 Kilobyte records DUMP: Estimated 44732 blocks (21.84MB). DUMP: Dumping (Pass III) [directories] DUMP: Dumping (Pass IV) [regular files] DUMP: 44670 blocks (21.81MB) on 1 volume at 1720 KB/sec DUMP: Archiving dump to `archive-file` DUMP: DUMP IS DONE DUMP: Level 0 dump on December 2, 2009 11:44:19 AM PST |
/dev/rdsk/c1t0d0s4 0 Wed Dec 2 11:44:19 2009 |
The command ufsrestore restores complete FS or individual files. Note 1: ufsrestore restores backup hierarchy in the current directory. Note 2: even temporarily, do not restore files in /tmp directory (usually it is mounted as TMPFS and does not support UFS FS attributes, like ACL) Say, you want to restore individual file(s). In order to find them in backup (file or tape), list content of backup (using "t"). In this case it is good having dump archive file (created with ufsdump command). Note: I am in the directory where archive-file is located.
# ufsrestore ta archive-file 2 . 78 ./139434-01 79 ./139434-01/copyright 80 ./139434-01/Install.info 81 ./139434-01/LEGAL_LICENSE.TXT 82 ./139434-01/README.139434-01 Etc etc etc |
# ufsrestore ta archive-file | grep Install 80 ./139434-01/Install.info 92 ./1/Install.info 104 ./2/Install.info 116 ./3/Install.info 128 ./4/Install.info 140 ./5/Install.info |
# ufsrestore ta archive-file ./3/Install.info 116 ./3/Install.info |
# /var/tmp> ufsrestore if /backup/fs-dump ufsrestore > help comment: use help to find available commands Available commands are: ls [arg] - list directory marked [arg] - list items marked for extraction from directory cd arg - change directory pwd - print current directory add [arg] - add `arg' to list of files to be extracted delete [arg] - delete `arg' from list of files to be extracted extract - extract requested files setmodes - set modes of requested directories quit - immediately exit program what - list dump header information verbose - toggle verbose flag (useful with ``ls'') paginate - toggle pagination flag (affects ``ls'' and ``marked'') setpager - set pagination command and arguments help or `?' - print this list If no `arg' is supplied, the current directory is used ufsrestore > ls .: 3/ 4/ 5/ ufsrestore > cd 4 ufsrestore > ls ./4: Install.info LEGAL_LICENSE.TXT README.139434-01 copyright ufsrestore > add Install.info comment: add files to restore ufsrestore > ls ./4: *Install.info LEGAL_LICENSE.TXT README.139434-01 ufsrestore > what comment: get some more info Dump date: December 2, 2009 12:25:08 PM PST Dumped from: the epoch Level 0 dump of /my-filesystem on hostname:/dev/dsk/c1t0d0s4 Label: none ufsrestore > extract comment: extract/restore selected 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 comment: in most cases is volume 1 set owner/mode for '.'? [yn] n comment: NO when restoring in directory other then one from which files were dumped comment: YES if restoring in same directory from were dump was performed. ufsrestore > quit |
# /var/tmp> cd 4 # /var/tmp/4> ls total 28 drwxr-xr-x 2 root root 512 Nov 20 12:03 . drwxrwxrwt 3 root sys 512 Dec 2 13:36 .. -rw-r--r-- 1 root root 12035 Dec 18 2008 Install.info comment: okay, file is here |
# ufsrestore xvf /backup/fs-dump ./5/sysfwdownload ./5/sysfwdownload.README Verify volume and initialize maps Media block size is 126 Dump date: December 2, 2009 12:25:08 PM PST Dumped from: the epoch Level 0 dump of /my-filesystem on hostname:/dev/dsk/c1t0d0s4 Label: none Extract directories from tape Initialize symbol table. Make node ./5 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 ./5/sysfwdownload extract file ./5/sysfwdownload.README Add links Set directory mode, owner, and times. set owner/mode for '.'? [yn] n |
# ufsrestore rvf /backup/fs-dump Verify volume and initialize maps Media block size is 126 Dump date: December 2, 2009 12:25:08 PM PST Dumped from: the epoch Level 0 dump of /my-filesystem on hostname:/dev/dsk/c1t0d0s4 Label: none Begin level 0 restore Initialize symbol table. Extract directories from tape Calculate extraction list. Make node ./139434-01 Make node ./cs2 Make many nodes, etc, etc Extract new leaves. Check pointing the restore extract file ./hsperfdata_root-ttt/382 extract file ./ogl_select209 extraxt many files, etc, etc Add links Set directory mode, owner, and times. Check the symbol table. Check pointing the restore |