|Skip Navigation Links|
|Exit Print View|
|System Administration Guide: Devices and File Systems Oracle Solaris 10 8/11 Information Library|
Two commands are used to copy file systems between disks:
For more information about volcopy, see volcopy(1M).
The next section describes how to use the dd command to copy file systems between disks.
Note - Do not use the dd command with variable-length tape drives without first specifying an appropriate block size.
You can specify a device name in place of standard input or standard output, or both. In this example, the contents of the diskette are copied to a file in the /tmp directory:
$ dd < /floppy/floppy0 > /tmp/output.file 2400+0 records in 2400+0 records out
The dd command reports on the number of blocks it reads and writes. The number after the + is a count of the partial blocks that were copied. The default block size is 512 bytes.
The dd command syntax is different from most other commands. Options are specified as keyword=value pairs, where keyword is the option you want to set and value is the argument for that option. For example, you can replace standard input and standard output with this syntax:
$ dd if=input-file of=output-file
To use the keyword=value pairs instead of the redirect symbols, you would type the following:
$ dd if=/floppy/floppy0 of=/tmp/output.file
Keep the following key points in mind when you consider copying a disk:
Do not use this procedure to copy a disk that is under the control of a volume manager.
The primary methods for copying UFS file system data from one disk or system to another disk or system is by using the ufsdump and ufsrestore commands. For more information on using these commands, see Chapter 22, Backing Up and Restoring UFS File Systems (Overview).
You can clone systems by creating a flash archive and copying it to destination systems. For more information about creating a flash archive, see Oracle Solaris 10 8/11 Installation Guide: Solaris Flash Archives (Creation and Installation).
If you are copying a disk with an EFI disk label, see Example 27-2.
If you are still considering copying a disk with the dd command keep the following cautions in mind:
Make sure that the source disk and destination disk have the same disk geometry.
Check the UFS file systems on the disk to be copied with the fsck utility.
Make sure the system is in single-user mode when copying a disk with the dd command.
# touch /reconfigure
# init 0
ok boot -s
# 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 KB or 256 KB. A large block size decreases the time it takes to copy the disk.
For more information, see dd(1M).
# fsck /dev/rdsk/device-name
# mount /dev/dsk/device-name /mnt
# cd /mnt/etc
For example, change all instances of c0t3d0 to c0t1d0.
# cd /
# umount /mnt
# init 0
# 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.
The system is shut down after it is unconfigured.
# boot diskn
hostname console login:
Example 27-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.
# touch /reconfigure # 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 27-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.
Clone the disk with an EFI label. For example:
# dd if=/dev/rdsk/c0t0d0 of=/dev/rdsk/c0t2d0 bs=128k
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.