Path: utzoo!utgpu!jarvis.csri.toronto.edu!mailrus!wuarchive!gem.mps.ohio-state.edu!brutus.cs.uiuc.edu!usc!hacgate!gryphon!turnkey!jackv From: jackv@turnkey.gryphon.COM (Jack F. Vogel) Newsgroups: comp.unix.aix Subject: Re: How do you clone a disk? Message-ID: <6384@turnkey.gryphon.COM> Date: 14 Oct 89 17:24:10 GMT References: <363@cs.columbia.edu> Reply-To: jackv@turnkey.gryphon.COM Organization: Turnkey Computer Consultants, Westchester, CA Lines: 45 In article <363@cs.columbia.edu> ji@cs.columbia.edu (John Ioannidis) writes: >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. >Here's what I tried: [ minidisks attempt deleted....] >Then I tried to figure out what the minor device numbers for the >second disk should be. It turned out that they start at 32, with the >32 being the entire disk, 33 being what was hd1 when the disk was the >first disk of another machine etc. I guessed that if I were to > > # 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. You had the right idea, but there is a trick to getting this to work. You see, there is a flag that must be set to allow one to write to the zero partition or whole device. I suppose the rational is that only programs like minidisks and maint should need to diddle with the whole device. However, the superuser can override this normal restriction using a suitable ioctl first. What you need to do is write a little program that includes and then have it do the following: ioctl(1,HDIOWRT) Wrap this in the usual error handling code, naturally. Then run this program as root and redirect stdout to /dev/hd32. You will now be able to write the whole device and your dd scheme above should work. One comment on cloning systems this way, by doing so you are going to have all the clones with the same site name, not really desireable in real world situations. Perhaps in a lab or some such situation it wouldn't matter. Also if you were comtemplating just using the bootstrap option to change the name afterwards, I don't believe this will work, you will have a conflict between the site name in nvram and the vtocs. But if this is what you want to do, now you know how. Good luck! Disclaimer: This is in no way an official statement of Locus or IBM. -- Jack F. Vogel jackv@seas.ucla.edu AIX Technical Support - or - Locus Computing Corp. jackv@ifs.umich.edu