System Administration Guide: Devices and File Systems

ProcedureHow to Copy a Disk (dd)

Keep the following key points in mind when you consider copying a disk:

If you are still considering copying a disk with the dd command keep the following cautions in mind:

  1. Become superuser or assume an equivalent role.

  2. Shut down the system.

    # init 0
  3. Attach the destination disk to the system.

  4. Boot the system.

    ok boot -s
  5. Copy the source disk to the destination disk.

    # dd if=/dev/rdsk/device-name of=/dev/rdsk/device-name bs=block-size

    Represents the overlap slice of the master disk device, usually slice 2.


    Represents the overlap slice of the destination disk device, usually slice 2.


    Identifies the block size, such as 128 Kbytes or 256 Kbytes. A large block size decreases the time it takes to copy the disk.

    For more information, see dd(1M).

  6. Check the new file system.

    # fsck /dev/rdsk/device-name
  7. Mount the destination disk's root (/) file system.

    # mount /dev/dsk/device-name /mnt
  8. Change to the directory where the /etc/vfstab file is located.

    # cd /mnt/etc
  9. Using a text editor, edit the destination disk's /etc/vfstab file to reference the correct device names.

    For example, change all instances of c0t3d0 to c0t1d0.

  10. Change to the destination disk's root (/) directory.

    # cd /
  11. Unmount the destination disk's root (/) file system.

    # umount /mnt
  12. Shut down the system.

    # init 0
  13. Boot from the destination disk to single-user mode.

    # boot diskn -s

    Note –

    The installboot command is not needed for the destination disk because the boot blocks are copied as part of the overlap slice.

  14. Unconfigure the destination disk.

    # sys-unconfig

    The system is shut down after it is unconfigured.

  15. Boot from the destination disk again and provide its system information, such as host name, time zone, and so forth.

    # boot diskn
  16. After the system is booted, log in as superuser to verify the system information.

    hostname console login:

Example 29–1 Copying a Disk With a VTOC Label (dd)

This example shows how to copy the master disk (with a VTOC label) /dev/rdsk/c0t0d0s2 to the destination disk /dev/rdsk/c0t2d0s2.

# init 0
ok boot
# dd if=/dev/rdsk/c0t0d0s2 of=/dev/rdsk/c0t2d0s2 bs=128k
# fsck /dev/rdsk/c0t2d0s2
# mount /dev/dsk/c0t2d0s2 /mnt 
# cd /mnt/etc
# vi vfstab
(Modify entries for the new disk)
# cd /
# umount /mnt
# init 0
# boot disk2 -s
# sys-unconfig
# boot disk2

Example 29–2 Copying a Disk with an EFI Label (dd)

In previous Solaris releases, slice 2 (s2) was used to represent the entire disk. On a disk with an EFI label, you must use a slightly different procedure to clone or copy disks larger than 1 terabyte so that the UUID of cloned disks is unique. If you do not create a new label for the cloned disk, other software products might corrupt data on EFI-labeled disks if they encounter duplicate UUIDs.

For example:

  1. Clone the disk with an EFI label. For example:

    # dd if=/dev/rdsk/c0t0d0 of=/dev/rdsk/c0t2d0 bs=128k
  2. Pipe the prtvtoc output of the disk to be copied to the fmthard command to create a new label for the cloned disk. For example:

    # prtvtoc /dev/rdsk/c0t0d0 | fmthard -s - /dev/rdsk/c0t2d0

For more information about EFI disk labels, see EFI Disk Label.