JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
System Administration Guide: Devices and File Systems
search filter icon
search icon

Document Information

Preface

1.  Managing Removable Media (Overview)

2.  Managing Removable Media (Tasks)

3.  Accessing Removable Media (Tasks)

4.  Writing CDs and DVDs (Tasks)

5.  Managing Devices (Overview/Tasks)

6.  Dynamically Configuring Devices (Tasks)

7.  Using USB Devices (Overview)

8.  Using USB Devices (Tasks)

9.  Using InfiniBand Devices (Overview/Tasks)

10.  Managing Disks (Overview)

11.  Administering Disks (Tasks)

12.  SPARC: Adding a Disk (Tasks)

13.  x86: Adding a Disk (Tasks)

14.  Configuring Oracle Solaris iSCSI Targets and Initiators (Tasks)

15.  The format Utility (Reference)

16.  Managing File Systems (Overview)

17.  Creating ZFS, UFS, TMPFS, and LOFS File Systems (Tasks)

18.  Mounting and Unmounting File Systems (Tasks)

19.  Using The CacheFS File System (Tasks)

20.  Configuring Additional Swap Space (Tasks)

21.  Checking UFS File System Consistency (Tasks)

22.  UFS File System (Reference)

23.  Backing Up and Restoring UFS File Systems (Overview)

24.  Backing Up UFS Files and File Systems (Tasks)

25.  Using UFS Snapshots (Tasks)

26.  Restoring UFS Files and File Systems (Tasks)

27.  UFS Backup and Restore Commands (Reference)

28.  Copying UFS Files and File Systems (Tasks)

Commands for Copying File Systems

Copying File Systems Between Disks

Making a Literal File System Copy

How to Copy a Disk (dd)

Copying Directories Between File Systems (cpio Command)

How to Copy Directories Between File Systems (cpio)

Copying Files and File Systems to Tape

Copying Files to Tape (tar Command)

How to Copy Files to a Tape (tar)

How to List the Files on a Tape (tar)

How to Retrieve Files From a Tape (tar)

Copying Files to a Tape With the pax Command

How to Copy Files to a Tape (pax)

Copying Files to Tape With the cpio Command

How to Copy All Files in a Directory to a Tape (cpio)

How to List the Files on a Tape (cpio)

How to Retrieve All Files From a Tape (cpio)

How to Retrieve Specific Files From a Tape (cpio)

Copying Files to a Remote Tape Device

How to Copy Files to a Remote Tape Device (tar and dd)

How to Extract Files From a Remote Tape Device

Copying Files and File Systems to Diskette

What You Should Know When Copying Files to Diskettes

How to Copy Files to a Single Formatted Diskette (tar)

How to List the Files on a Diskette (tar)

How to Retrieve Files From a Diskette (tar)

Archiving Files to Multiple Diskettes

29.  Managing Tape Drives (Tasks)

Index

Copying File Systems Between Disks

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.

Making a Literal File System Copy

The dd command makes a literal (block-level) copy of a complete UFS file system to another file system or to a tape. By default, the dd command copies standard input to standard output.


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

How 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. (Optional) Create the /reconfigure file so that the system will recognize the destination disk to be added when it reboots, if necessary.
    # touch /reconfigure
  3. Shut down the system.
    # init 0
  4. Attach the destination disk to the system.
  5. Boot the system.
    ok boot -s
  6. Copy the source disk to the destination disk.
    # dd if=/dev/rdsk/device-name of=/dev/rdsk/device-name bs=block-size
    if=/dev/rdsk/device-name

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

    of=/dev/rdsk/device-name

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

    bs=blocksize

    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).

  7. Check the new file system.
    # fsck /dev/rdsk/device-name
  8. Mount the destination disk's root (/) file system.
    # mount /dev/dsk/device-name /mnt
  9. Change to the directory where the /etc/vfstab file is located.
    # cd /mnt/etc
  10. 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.

  11. Change to the destination disk's root (/) directory.
    # cd /
  12. Unmount the destination disk's root (/) file system.
    # umount /mnt
  13. Shut down the system.
    # init 0
  14. 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.


  15. Unconfigure the destination disk.
    # sys-unconfig

    The system is shut down after it is unconfigured.

  16. Boot from the destination disk again and provide its system information, such as host name, time zone, and so forth.
    # boot diskn
  17. After the system is booted, log in as superuser to verify the system information.
    hostname console login:

Example 28-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 28-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.