On Mon 08 Apr, Philip Hands wrote:
On Mon, 2002-04-08 at 20:08, Alan Davies wrote:
OK, I have a new 60GB drive to place on my 20GB Linux box. ... Is is best to do a re-install and then somehow (how?) move the settings from the old drive to the new.
What I normally do (on Debian, but should work on any GNU/Linux)
Plug the new disk in as master on the second cable (/dev/hdc)
boot the machine into single user ("Linux single" at the LILO prompt)
partition the new disk:
cfdisk /dev/hdc
using the same layout might make life easy, but is not essential. Let's assume you have:
/dev/hda1 /boot /dev/hda2 / /dev/hda5 [swap] /dev/hda6 /home
partition the drive to match, making the partions bigger if space was getting tight before.
The do:
*********Should the following lines be ....hdcX - ? rathern than hda?
mke2fs /dev/hda1 mke2fs /dev/hda2 mkswap /dev/hda5 mke2fs /dev/hda6 mount /dev/hda2 /mnt cd / cp -avx . /mnt mount /dev/hda1 /mnt/boot cd /boot cp -avx . /mnt/boot mount /dev/hda6 /mnt/home cd /home cp -avx . /mnt/home
so now you've coppied everything, but it's not bootable.
The easy option is to make yourself a boot floppy (with mkboot on Debian, not sure if SuSe has that), shut down, pull the old drive out, and plug the new on in it's place, boot off the floppy, log in and run LILO (or GRUB, or whatever) to reinstall the boot block. You may need to install the MBR onto the start of the disk, if you've got LILO on /dev/hda1, say (on Debian, you do that with install-mbr, otherwise you need to get the MBR package, and dd it onto you hard disk --- probably easier to simply put LILO on /dev/hda)
Reboot and your done.
Of course, I always forget the boot disk, and have to do the:
rescue root=/dev/hda2
thing off an install disk, and hope the file systems are supported on that kernel.
If you hate floppies with a vengence, you need to put:
disk=/dev/hdc bios=0x80
in /mnt/etc/lilo.conf when you've just done the disk copy, before rebooting, and then run:
lilo -r /mnt
and if you get no complaints, you've got a good chance of a clean reboot (but I'd still make a floppy ;-)
Have fun.
Cheers, Phil.
At what stage can you remove old drive and move new drive to the other IDE channel? Will it boot after moving - or does it 'know' that it was hdc? -- Alan Davies Head of Computing Birkenhead School