here you go.
Document ID: ID17234
Synopsis: Moving filesystems and boot devices with ufsdump and ufsrestore
--------------------------------------------------------------------------------
Document Body Top
The following is an excruciatingly detailed procedure list to migrate
filesystems (including root) from one disk drive to another and changing the
boot device.
The purpose of this exercise was to allow PSE&G to migrate off the loaner
multipacks to a RSM Tray. Disk 0 on the RSM Tray becomes the boot device.
The system used for testing was set up as follows:
c0t0d0 - Internal disk 0 (boot device/source drive)
c0t1d0 - Internal disk 1
c0t2d0 - Multipack disk 0 (target drive/new boot device)
c0t3d0 - Multipack disk 1
The filesystem configuration, on the source drive, was set up as follows:
c0t0d0s0 root
c0t0d0s1 swap
c0t0d0s2 backup
c0t0d0s3 unassigned
c0t0d0s4 unassigned
c0t0d0s5 unassigned (opt)
c0t0d0s6 usr
c0t0d0s7 var
The trick to this entire process is to be sure you have the new partitions and
filesystems sized and created properly. (i.e. make sure the customer knows what
they want and documented, before you start !!!)
Step 1: Perform a complete system backup.
Step 2: Install all new hardware and boot -r.
Step 3: Use format to create the partitions wanted on the target drive. In this
test we created root, swap, /usr, /var and /opt on the target disk.
(NOTE: /opt is not a legal tag so this partition's tag will be
unassigned.)
Here is what we wound up with:
c0t2d0s0 root
c0t2d0s1 swap
c0t2d0s2 backup
c0t2d0s3 unassigned
c0t2d0s4 unassigned
c0t2d0s5 unassigned (opt)
c0t2d0s6 usr
c0t2d0s7 var
Step 4: Label the disk when partitioning is complete. Exit format.
Step 5: newfs each of the partitions on the target drive.
# newfs /dev/rdsk/c0t2d0s0
# newfs /dev/rdsk/c0t2d0s1
# newfs /dev/rdsk/c0t2d0s5
# newfs /dev/rdsk/c0t2d0s6
# newfs /dev/rdsk/c0t2d0s7
Step 6: Make directories for the new partitions on the source drive. (not needed
for swap and backup)
# mkdir /newroot
# mkdir /newusr
# mkdir /newopt
# mkdir /newvar
Step 7: Mount each of the new filesystems from the source drive. (not needed for
swap and backup)
# mount /dev/dsk/c0t2d0s0 /newroot
# mount /dev/dsk/c0t2d0s5 /newopt
# mount /dev/dsk/c0t2d0s6 /newusr
# mount /dev/dsk/c0t2d0s7 /newvar
Step 8: Enter the following command for each of the filesystems to move:
# ufsdump 0f - /dev/rdsk/c0t0d0s0 | (cd /newroot;ufsrestore xf -)
# ufsdump 0f - /dev/rdsk/c0t0d0s5 | (cd /newopt;ufsrestore xf -)
# ufsdump 0f - /usr | (cd /newusr;ufsrestore xf -)
# ufsdump 0f - /dev/rdsk/c0t0d0s7 | (cd /newvar;ufsrestore xf -)
In the case of /usr filesystem replace c0t0d0s6 with /usr after root has
been moved.
Step 9: Update /etc/vfstab on the newroot partition.
NOTE: This is extremely important. Make sure you are on the target
drive. Leave the source /etc/vfstab as is.
This is the source /etc/vfstab.
#device device mount FS fsck mount mount
#to mount to fsck point type pass at boot options
#
#/dev/dsk/c1d0s2 /dev/rdsk/c1d0s2 /usr ufs 1 yes -
fd - /dev/fd fd - no -
/proc - /proc proc - no -
/dev/dsk/c0t0d0s1 - - swap - no -
/dev/dsk/c0t0d0s0 /dev/rdsk/c0t0d0s0 / ufs 1 no
-
/dev/dsk/c0t0d0s5 /dev/rdsk/c0t0d0s3 /opt ufs 2 yes
-
/dev/dsk/c0t0d0s6 /dev/rdsk/c0t0d0s3 /usr ufs 2 yes
-
/dev/dsk/c0t0d0s7 /dev/rdsk/c0t0d0s7 /var ufs 2 yes
-
swap - /tmp tmpfs - yes -
This is the target /etc/vfstab.
#device device mount FS fsck mount mount
#to mount to fsck pointtype pass at boot options
#
#/dev/dsk/c1d0s2 /dev/rdsk/c1d0s2 /usr ufs 1 yes -
fd - /dev/fd fd - no -
/proc - /proc proc - no -
/dev/dsk/c0t2d0s1 - - swap - no -
/dev/dsk/c0t2d0s0 /dev/rdsk/c0t2d0s0 / ufs 1 no
-
/dev/dsk/c0t2d0s5 /dev/rdsk/c0t2d0s3 /opt ufs 2 yes
-
/dev/dsk/c0t2d0s6 /dev/rdsk/c0t2d0s3 /usr ufs 2 yes
-
/dev/dsk/c0t2d0s7 /dev/rdsk/c0t2d0s7 /var ufs 2 yes
-
swap - /tmp tmpfs - yes -
Step 10: Unmount each of the filesystems mounted in step 7.
# umount /newroot
# umount /newopt
# umount /newusr
# umount /newvar
Step 11: Run the installboot program to install the boot blocks on the target
drive.
# cd /usr/platform/`uname -i`/lib/fs/ufs
# installboot bootblk /dev/rdsk/c0t2d0s0
Step 12: Shutdown the system. /usr/sbin/shutdown -y -i0 -g0
Step 13: From the ok prompt:
ok setenv boot-device disk2
(reassign the boot device from the source to the target
ok reset
(recycle the prom monitor)
ok boot
(boot from the target drive/new boot device)
Note we used ufsdump/ufsrestore instead of dd
because it lets you make fs size changes in the upgrade if you require.