Backups - as system administrators they can be our salvation as well as our nemesis. Though often something of an afterthought, a well planned backup/recovery practice can save your skin; or career path.
I’ve long been a proponent of enterprise backup solutions for data, i.e. Veritas NetBackup, but there is nothing quite as elegant as ufsdump/ufsrestore for system disk recovery. The ability to restore your system using no more then a tape drive and a bootable CD is very comforting. The only real drawback to using dumps is that to get a reliable copy the file system needs to be quiescent.
If you’re running an up to date version of Solaris you already have the tools necessary to get a reliable copy of your system disk to tape without impacting your uptime numbers. Included in Solaris 8 is a new file system utility called fssnap. From a maturity standpoint this is a very “young” utility but it makes creating ufsdumps from a static file system a breeze.
Command syntax is very straightforward. You specify the backing-store (directory used to track changes encountered over the life of the snapshot), the file system to be snapped and the device file to use.
To create a snapshot of the root file system using a backing store directory called /snapfs use the following command line:
# fssnap –o bs=/snapfs / /dev/fssnap/0
For performance and management reasons it’s a good idea to place the backing store on a file system other then the one being snapped. The actual snapshot operation should only take a second or two. Interestingly enough, we can even mount this static copy for inspection:
# mkdir foo
# mount –o ro /dev/fssnap/0 /foo
# cd /foo
Using this newfound technology into your backup practice is just as painless. You have the choice to use your newly created snapshot image as a target for ufsdump:
# fssnap –o bs=/snapfs / /dev/fssnap/0
# ufsdump 0uf /dev/rmt/0 /dev/rfssnap/0
# fssnap –d /
The final fssnap –d option clears the snapshot and releases the device node for future use. Once the operation is complete you should delete the backing store files as the –d option does not remove them from disk.
As a side note, the files appear very large on disk but use very little actual space due their "holey" nature.
# ls -l
total 2896
-rw------- 1 root other 2105560064 Mar 11 11:16 snapshot0
-rw------- 1 root other 2105560064 Mar 11 11:16 snapshot1
# du -s *
2368 snapshot0
528 snapshot1
I hope this gives you one more “tool” in your bag. Your system man pages can give you additional details and command options. If your copy of Solaris 8 doesn’t yet include this feature, you should probably read last month’s column on “Maintenance Updates”.
Note: Copyright © 2001-2003 GovStor LLC. All rights reserved.