PDA

View Full Version : Utility to move/copy a HD install



nishtya
03-24-2004, 01:26 AM
Hi all, keep in mind Linux noob, please. I have a nice, stable happy HD install of Knoppix 3.3 2-16-04 that is located on a separate old hard drive that is slave to my w98 installation on my main machine. Lilo is boot loader - with linux as default.

I have purchased a new hard drive that I would like to christen with Linux Have been waiting for 3.4 with new KDE but I think that is a little ways off and would like to keep using this 3.3 install.

In linux, what utilties are available to me to copy this install over to the new disk? Currently I use either the mfr's hard disk copy utilities or my NTI disk image on CDs to copy over to new drives but I don't think that will work for a Linux drive (two partitions, one formatted as swap the ext3). Need tips as well for reconfiguring Lilo (which resides on the boot partition, my windows disk)

It doesn't take that long to do a fresh install from Knoppix CD and I have all data backed up but it would be nice if there was a copy disk utility to keep this humming along as I am so pleased with it to date. Thanks.

Stephen
03-24-2004, 02:32 AM
I have purchased a new hard drive that I would like to christen with Linux Have been waiting for 3.4 with new KDE but I think that is a little ways off and would like to keep using this 3.3 install.


I you have internet access this should not be necessary you can upgrade with few problems with apt-get upgrade.



In linux, what utilties are available to me to copy this install over to the new disk? Currently I use either the mfr's hard disk copy utilities or my NTI disk image on CDs to copy over to new drives but I don't think that will work for a Linux drive (two partitions, one formatted as swap the ext3). Need tips as well for reconfiguring Lilo (which resides on the boot partition, my windows disk)

It doesn't take that long to do a fresh install from Knoppix CD and I have all data backed up but it would be nice if there was a copy disk utility to keep this humming along as I am so pleased with it to date. Thanks.

What I always do is boot with knoppix 2 then once at the prompt.




mount /dev/hd?? /mnt/hd??
mount /dev/hd^^ /mnt/hd^^
cp -Rp /mnt/hd??/* /mnt/hd^^/


Replace the ?? with the drive letter and partition number of the drive being copied from the ^^ with the drive and partition number being copied too. Repeat the process for any other partitions being copied except the /swap. You then need to edit the copied lilo.conf, run lilo and edit the copied fstab for the correct new settings.



vi /mnt/hd^^/etc/lilo.conf
chroot /mnt/hd^^/ /sbin/lilo -v
vi /mnt/hd^^/etc/fstab


This assumes that you have already made the partitons on the drive you are coping too with cfdisk and rebooted to make sure the partition table is updated then formated with the desired filesystem for the partition(s) and you keep the old drive in the machine at least long enough to copy if the new is being moved after the copy to a new location on the cables then you will want to boot again and chroot to write lilo after making changes again if necessary. When editing lilo if you want it to continue to be located in the MBR of your primary windows drive then leave the boot=/dev/hda line alone and just change the root=/dev/hd?? to the proper new value.

Note: Make sure that the DMA is turned on for both drives or it will take forever to check hdparm /dev/hd? you should see a "1 (on)" in the line using_dma to turn on hdparm -d1 /dev/hd? replace the ? with the proper drive letter.

nishtya
03-25-2004, 01:38 AM
Thanks for the input, Stephen. Please bear with me as I try to sort this out. I think I may be losing it around the lilo reconfig and the boot partition (the loader is like a little partition of its own, correct?) That would be on the 98 disk. Although the config file for it is located on my soon-to-be old linux disk. I would need to take one of my optical drives off the secondary channel temporarily in order to have the 98 disk, the old linux disk, and the fresh new drive going at the same time for the procedure? I imagine I should have the new hard drive slave to the 98 drive on primary (which will be where it is staying) and stick my old linux drive to copy from on secondary channel. Tell me if I am on the right track here. I am comfortable editing config files and very comfortable with the hardware swapping about. It seems like a lot just to avoid what basically amounts to an hour or so installing Knoppix to the new disk fresh but I am quite please with my current configuration and other sw installations on it and would like to give it a go at copying rather than starting from scratch.

Stephen
03-25-2004, 04:26 AM
Thanks for the input, Stephen. Please bear with me as I try to sort this out. I think I may be losing it around the lilo reconfig and the boot partition (the loader is like a little partition of its own, correct?)


Yes it is an area on the disk that is reserved for bootloaders.



That would be on the 98 disk.


Good no changes needed for the boot=/dev/hda line in the lilo.conf.



Although the config file for it is located on my soon-to-be old linux disk.


Correct.


I would need to take one of my optical drives off the secondary channel temporarily in order to have the 98 disk, the old linux disk, and the fresh new drive going at the same time for the procedure?


Should be the slave on the secondary channel where you connect the HD some MB's will not boot from a CD as slave plus no playing around with the jumper on the HD.



I imagine I should have the new hard drive slave to the 98 drive on primary (which will be where it is staying) and stick my old linux drive to copy from on secondary channel. Tell me if I am on the right track here.


Exactly put it in the spot where it will remain saves you a reboot to chroot to write lilo after moving things around for a second time.



I am comfortable editing config files and very comfortable with the hardware swapping about. It seems like a lot just to avoid what basically amounts to an hour or so installing Knoppix to the new disk fresh but I am quite please with my current configuration and other sw installations on it and would like to give it a go at copying rather than starting from scratch.

Not really a lot you have things setup like you want, the case will be opened anyway it most likely will save time in the long run. To save the editing if you make the partition(s) identical in their number and formatting on both drives eg. /swap is /dev/hd?1 type swap, / = /dev/hd?2 type ext3, /home = /dev/hd?3 type ext3 they do not have to be the same size then it is just a straight copy of the partition(s) and chroot to write lilo, shutdown remove the old drive connect up the CD and boot the system it should be the same as you left it.

nishtya
03-26-2004, 01:59 AM
8) I think I can handle it, Stephen - will endeavor to have a go at it Saturday. It will be really nice to just have this on a fresh fast disk intact, we'll see.

thanks for all your help and if I make a mess, well, it is just an hour tops to have my base Knoppix HD install again :wink: