This document outlines using fssnap, ufsdump and ufsrestore to dump and restore the root filesystem under Solaris 10 for Intel.
These notes are _very_ terse, and assume that you know what you're doing.
Physically add disk to system. We are using Solaris 10 for Intel - so we add an IDE disk to the second bus (I'm using the slave device - IDE 1:1 ) on which I'll create a single slice for backing up the root FS - I don't have a tape drive at home, alas.
If system isn't booted with -r, then you can either touch /reconfigure and init 6. Or, a simple devfsadm should do the trick.
# devfsadm
Make sure disk is seen
# format
Create a 100% Solaris System partition
# fdisk /dev/rdsk/c1d1p0
Partition the disk - we will create a 20Gb s4 slice for backup purposes
# format
Create a new FS on our newly partitioned slice
# newfs /dev/rdsk/c1d1s4
Test mounting the new FS
# mount -F ufs /dev/dsk/c1d1s4 /mnt
# cd /mnt
# ls -la lost+found
# cd /
# umount /mnt
As we obviously cannot unmount the root filesystem, we can use a UFS snapshot in order to create our backup.
Check free space on /export/home before creating snapshot
# df -k /export/home
Create the snapshot - it must reside on a different filesystem to the one you're creating the snapshot of. I've got plenty of space on /export/home - so I'll place the fssnap there.
# fssnap -F ufs -o backing-store=/export/home/rootbackup /
/dev/fssnap/0
You can see that an fssnap device has been created, /dev/fssnap/0 - we'll use this with ufsdump below.
Backup our root fs
# ufsdump 0uf /dev/rdsk/c1d1s4 /dev/fssnap/0
You can remove the fssnap, or just leave it alone and it'll be deleted during the next system reboot - which is coming up shortly ;-)
Once backup is complete, let's take temporary leave of our senses so that we have an excuse to restore
# dd if=/dev/zero of=/dev/rdsk/c0d0s0
Oh dear, that's torn it. It doesn't take long before things come crashing down around you
Physically power off the system. Power on, and boot from the Solaris 10 Installation CD (disc 1) using DCA
At the installation prompt, type "b -s"
# b -s
We will now boot in CDROM Single User mode to fix up this mess....
If this were a real situation, maybe the hard disk would need to be replaced or some other action taken. For our "simulation", we can just go ahead creating a new filesystem on our damaged root slice
# newfs /dev/rdsk/c0d0s0
Mount our new FS
# mount /dev/dsk/c0d0s0 /mnt
Change directory to the mount point
# cd /mnt
Restore from our hard disk slice
# ufsrestore rvf /dev/dsk/c1d1s4
Once restoration is complete, we can remove the restoresymtable file.
# rm restoresymtable
Now, we can unmount
# cd /
# umount /mnt
Check our new root filesystem for consistency
# fsck /dev/rdsk/c0d0s0
Create our pboot and bootblock
# installboot /usr/platform/`uname -i`/lib/fs/ufs/pboot \
> /usr/platform/`uname -i`/lib/fs/ufs/bootblk /dev/rdsk/c0d0s2
Now, init 6, and our box will come back up with / restored, present and correct!
The restoration somehow reverted back to using XOrg instead of XSun for the X Server - a quick change in kdmconfig gets this back to normal.
Cheers
Kevin Waldron
kevin@zazzybob.com
Disclaimer! - This article is provided for guidance only, and does not replace the relevant official documentation and manuals. I will not be held liable for any hosed systems and/or data.