PDA

View Full Version : how to move current install to a new hard drive



Loafy
06-06-2005, 07:34 PM
all,

I've installed knoppix 2.6 to an old (small) hard drive I had. It took me a while to get the sound, printing and video modes to what I want but now I need to move it to a larger hard drive. What's the best way to do this? Install a new bigger harddrive on the PC then move the boot record and related info?

what steps and what reseach should I do?

TIA

UnderScore
06-06-2005, 07:57 PM
assuming your current HD is:
/dev/hda1 root
/dev/hda2 swap

Then install your current HD in the machine & boot with Knoppix and do all the following as root. If you want to have a different partition layout then you will have to adjust the /etc/fstab file accordingly. So instead partition the new HD the same. I use cfdisk.
/dev/hdb1 root
/dev/hdb2 swap

You may have to reboot to make sure the changes are properly read. Then format the parition with the appropriate filesystem type.
For ext2fs: mke2fs -v /dev/hdb1
For ext3fs: mke2fs -vj /dev/hdb1
For swap: mkswap /dev/hdb2

Now mount the original and the new root paritions:
mount /dev/hda1 /mnt/hda1
mount /dev/hdb1 /mnt/hdb1

Copy your current linux system to the new HD:
cp -Rp /mnt/hda1/* /mnt/hdb1

Once that completes then shutdown the system & remove the old HD and put in its place the new HD. Boot Knoppix again, mount the root partition to /mnt/hda1 & this time you will apply the boot loader. If you are using grub want to install to the MBR then you must run:
grub-install /dev/hda
If you are using lilo & want to install to the mbr then you must:
chroot /mnt/hda1 /bin/bash
/sbin/lilo
exit

If you have installed the bootloader, then you should be fine. Reboot the machine & find out. If you have any problems please post them here.

I hope this helps.
James