How do you clone a disk?

Bill Webb webb at bass.tcspa.ibm.com
Thu Oct 12 07:38:39 AEST 1989


> I have a bunch of PS/2-80's (and a lot more soon to arrive) with 330MB
> ESDI drives and I want to be able to have a master disk and clone every
> machine off that `master' disk.
> ...
> 	# mknod /dev/hd32 b 3 32
> 	# dd if=/dev/hd00 of=/dev/hd32 
> 
> it would copy the entire first disk onto the second. Ha! It copied
> about 700 blocks and then gave me an I/O error.
>...
> /ji

I've been considering writing a utility that would use the BIOS calls
to clone disks or partitions. Having written a program to change the
partition table by opening /dev/hd00 I'm surprised that you were able
to write hd32 at all - you first have to issue an ioctl (HDIOWRT - see
<sys/mdisk.h>) before any I/O will work on a whole disk partition such
as /dev/hd00. (I assume - it didn't appear to be documented anywhere
that I saw). I suggest that you try the above after writing a program
	( hdiowrt ; dd if=/hd00 bs=... ) > /dev/hd32
Of course non of this is for the faint of heart - writting directly to
a hard disk can be very, very dangerous if you don't do it EXACTLY 
right (I assume thats why the ioctl is there in the first place).

We have found that we could copy whole disks if we used the IBM 6152
AOS 4.3 standalone disk copy utility, but that's probably not available 
to everybody (it essentially uses BIOS to access the disk).

You also have to make sure that you use the 'chparm' command
to change the name of the new machine after booting it for the first time,
and also use the boot menu to change the node name as well.

If you're installing DOS/MERGE you should do that on the actual machine
that its running on as it must run on the same hardware its installed on
because it takes a BIOS image (see the documentation).

Note of the above should be taken as any IBM support for the practice
of disk cloning, however I hope that it helps you get the job done.

Good Luck!

----------------------------------------------------------------
The above views are my own, not necessarily those of my employer.
Bill Webb (IBM AWD Palo Alto), (415) 855-4457).
UUCP: ...!uunet!ibmsupt!webb



More information about the Comp.unix.aix mailing list