Operating System - HP-UX
1823114 Members
3209 Online
109646 Solutions
New Discussion юеВ

copy a scsi hard disk to a target with dd command

 
Nancy_32
Occasional Contributor

copy a scsi hard disk to a target with dd command

I have a hard disk that would like to copy with the dd command. HP-UX 10.20 operating system.

Is the command:

dd if=/dev/rdsk/c0t0d0 of=/dev/rdsk/cxtxdx bs=32K

How can I find the device name of the target?

Do I have to mount the target? How?

Thanks,
7 REPLIES 7
Robert-Jan Goossens
Honored Contributor

Re: copy a scsi hard disk to a target with dd command

Hi Nancy,

If the other disk is connected to your system, you could use

# ioscan -fnCdisk

to find the target disk.

dd command is correct, you could use a larger blocksize like 1024k to turn up the speed of the copy.

Regards,
Robert-Jan
Chris Wilshaw
Honored Contributor

Re: copy a scsi hard disk to a target with dd command

ioscan -fnkCdisk will list all the disk devices on the system.

Is the target a new disk that you've had installed?

If so, to determine which disk it is (assuming that you don't know from the ioscan output), for each one reported by ioscan, run

cat /dev/dsk/cXtXdX > /dev/null

Then look at the disks in the cabinet, to see which one has the solid activity light showing.

Then use CTRL+C to abort the cat command.

From memory, your dd command looks OK.

There should be no need to mount the target disk to carry out the copy.
RAC_1
Honored Contributor

Re: copy a scsi hard disk to a target with dd command

Make sure both the disks are available.

ioscan -fnCdisk

You do need to mount anything. Are the sizes of the disks same?? It is good if they are. Even if they are not, do not worry about it.

The bs option is block size and should be the multiple of sector size. 32k would be too less. 5000K. man dd for details.

What exactly you are trying to do??

Anil
There is no substitute to HARDWORK
A. Clay Stephenson
Acclaimed Contributor

Re: copy a scsi hard disk to a target with dd command

Do an ioscan -C disk -fn. You need to exercise caution when using the dd command. Make absolutely certain that the destination disk is not a member of a volume group and not used as a whole disk (not under LVM) container for a filesystem nor is it used as a swap device. Also make certain that it is not used as a raw database device.

If you are trying to clone the disk, the source and target disks should be identical (or at the very least, the target must be at least as large as the source). If you are going to be copying mounted filesystems, you will need to run a fsck on them before they can be mounted after the copy.

I would bump your blocksize up to 256K (above that the gains are typically very small) for a faster copy.
If it ain't broke, I can fix that.
Nancy_32
Occasional Contributor

Re: copy a scsi hard disk to a target with dd command

Guys,

Do I have to do each of the partitions manually, right?

Thanks,
Nancy L.
Robert-Jan Goossens
Honored Contributor

Re: copy a scsi hard disk to a target with dd command

Hi,

No, if you have more Logical Volumes on the disk they will be copied automatically to the target disk.

You are copying on disk level not on logical volume level.

Regards,
Robert-Jan
A. Clay Stephenson
Acclaimed Contributor

Re: copy a scsi hard disk to a target with dd command

No, and unless you have a disk imported from a very old version (e.g. HP-UX 9.xx) there are no partitions (slices). Your /dev/rdsk/cXtYdZ will get the entire disk (including LVM metadata & boot code) in one operation.

If it ain't broke, I can fix that.