[vox-tech] transferring a dual boot hard drive

Foo Lim vox-tech@lists.lugod.org
Wed, 5 Dec 2001 20:46:26 -0800 (PST)


keywords: dual boot, bad drive, drive crash, hard disk upgrade

Ok Pete,

This has been sitting in my postponed folder for a while (a couple months
I think)..  I finally found some time (bored & tired) to finish it up so I
can recycle all the notes I made on this.

Foo


-- BEGIN DOCUMENT
I've streamlined some of the steps that actually occurred when I went thru
this procedure, specifically the swapping of the drives as master & slave
a few times, because I found that the Windoze boot disk didn't recognize
long file names.

These steps apply to IDE drives.  For SCSI, YMMV.

Required reading:
Hard Disk Upgrade Mini How-To, Section 7
http://www.linuxdoc.org/HOWTO/mini/Hard-Disk-Upgrade/copy.html

-1. Make a Win98 Emergency disk
0. print out a copy of your /etc/fstab and df output on 1 page
	calculate how much space for each partition using %ages or whatnot

1. shutdown system  :-(
2. hook up the new drive as the slave drive
   change the jumpers on the master drive (if needed)
3. boot into a Windoze Emergency disk
4. run fdisk on the new slave drive
5. create partition - * see note below
6. set it active
7. reboot into Windoze w/o Emergency disk (cuz it said to)
8. format the new partition
	(D: if you don't have other partitions on master)
9. delete all unneeded files (especially browser caches - Netscape, IE)
10. close all programs
11. open a MS-DOS prompt
	a. type 'cd \'
	b. type 'xcopy32 /s/e /k /H /c *.* d:
	(where d: is the new partition)
	there will be a couple errors if you watch the output
	one of them will be an error in copying the swap file
	the /c flag will let the copying continue past the error(s)
	there's also /q to turn off output
	/s/e copies all subdirs including empty ones
	/k to copy attribs
	/H (capped so not be confused w/n) to copy system files
12. shutdown
13. switch drives as master (master <-> slave)
	some motherboards will let you just change jumpers on UDMA66/100
	drives without changing the cable positions
14. boot up & make sure you can boot into Windoze & everything seems fine
	(incl all freezes & BSODs.  oh, make sure TFC works)

Now for the Linux part
Required reading comes in handy here
15. use RH 6.2 CD to boot
16. 'linux rescue' at the install prompt

17. 'mknod /dev/hda' or whatever it's supposed to be
18. 'mknod /dev/hda1' for all partitions (mknod /dev/hda[2-9])
19. do this for hdb also

20. 'fdisk /dev/hda' which is your new drive
	create all the partitions according to step 0
21. format the partitions
	a. 'mkfs.ext2 -c /dev/hdb1; mkfs.ext2 -c /dev/hdb2; (etc.)'
	   get something to eat & drink
	b. 'mkswap /dev/hdb3' (assuming your swap is hdb3)
22. mount the disk partitions (loop thru all your partitions except swap)
	'mkdir /mnt/old-1 /mnt/new-1'
	'mount /dev/hda1 /mnt/new-1'
	'mount /dev/hdb1 /mnt/old-1'
23. copy all the files on all the partitions (except swap)
	'cp -ax /mnt/old-1/* /mnt/new-1/'
24. unmount all partitions
25. mount for re-lilo'ing
	if you have /boot and / in different partitions, do this:
	assume /boot is in /dev/hda1 and / in /dev/hda2

	'mount /dev/hda2 /mnt/root'
	'mount /dev/hda1 /mnt/root/boot'
	'lilo -r /mnt/root'
	'umount /mnt/root/boot'
	'umount /mnt/root'

	This is also helpful when you screw up a lilo installation.
26. reboot & cross your fingers I haven't forgotten anything

If everything seems ok, you can shutdown again to disconnect the bad
drive.  Some of the above steps can be written as bash scripts to avoid
repitition.



* if you're using an older version of LILO with the 1024 cylinder limit,
you'll need to find out how big you can make the Windoze partition.  The
way I do it is to boot with a Redhat 6.2 CD:
1. boot with CD
2. type 'linux rescue' at the install prompt
3. at shell prompt,
	a. mknod /dev/hdb
	where hdb means the new drive is the slave of the 1st IDE channel
	b. fdisk /dev/hdb
	c. record number of cylinders & size of a partition with 1023 cyl
	   so you can create a Windoze partition smaller than that size
4. at this point, you can either make the Win95 FAT (Primary) partition or
go back to where you left off above by quitting fdisk & rebooting.  I
chose to go back in case DOS' fdisk does something I'll forget.



Disclaimer: I will not be responsible for any data loss incurred by this
procedure unless after reading this, you feel inclined to just give up and
erase everything.  Then I may care.  This document was written initially
for LUGOD's FAQ, which at this moment is maintained by Peter Salzman.
Please send corrections or additions to either me (foolim.nospam@usa.net -
take out the .nospam) or Peter.  Feel free to redistribute this.
-- END DOCUMENT