Disk duplication

It is easy to duplicate a disk with the same geometry (cylinders, heads, sectors) with the dd command. In the following example, I will duplicate boot disk c0t0d0 with c0t1d0 on a Solaris system. Of course, this is not the same as mirroring the boot disk.

The dd command's bit-for-bit copy includes the partition table and boot block, so duplicating the partition table with prtvtoc and making the disk bootable with installboot is not necessary.

# format < /dev/null
Searching for disks...done


AVAILABLE DISK SELECTIONS:
       0. c0t0d0 <SUN9.0G cyl 4924 alt 2 hd 27 sec 133>
          /sbus@1f,0/SUNW,fas@e,8800000/sd@0,0
       1. c0t1d0 <SUN9.0G cyl 4924 alt 2 hd 27 sec 133>
          /sbus@1f,0/SUNW,fas@e,8800000/sd@1,0
Specify disk (enter its number):

1. Make a bit-for-bit copy of the source disk to the destination disk with dd. Use a 1 megabyte blocksize instead of the 512 byte default to speed up the operation.
dd if=/dev/rdsk/c0t0d0s2 of=/dev/rdsk/c0t1d0s2 bs=1024k

2. Change the /etc/vfstab file on the duplicate boot disk to reflect the correct SCSI ID.

mkdir /tmp/mnt
mount /dev/dsk/c0t1d0s0 /tmp/mnt
vi /tmp/mnt/etc/vfstab

Change references of c0t0d0 to c0t1d0:

:%s/c0t0d0/c0t1d0/g
:wq!

umount /tmp/mnt

3. Test booting off the duplicate boot disk (assuming disk1 is the correct Open Boot Prompt device alias for c0t1d0s0).

reboot -- disk1

Back to brandonhutchinson.com.
Last modified: 07/23/2003