LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Debian (http://www.linuxquestions.org/questions/debian-26/)
-   -   Cloning a hard drive (http://www.linuxquestions.org/questions/debian-26/cloning-a-hard-drive-387038/)

davcefai 11-27-2005 03:21 PM

Cloning a hard drive
 
I have the following drive configuration:
hda: Windows 2000 40G ATA
hdb: Mandrake 10.1 40G ATA
hdc: CD-writer
hdd: DVD-ROM
sda: Debian 160G SATA
sdb: not used (yet)

I need an ATA drive for another PC so, rather than buy one I would prefer to buy a SATA drive and transfer the Mandrake installation to it. Possible even transfer the Windows installation and gain a spare drive (which will soon be snapped up by another machine, no doubt).

Is there a way to transfer the Mandrake installation to the SATA drive while not using all of the drive. I don't need 160MB for the Mandrake installation, it's essentailly there to get me out of trouble if I mess up Debian. It is stable and I would prefer not to have to install from scratch.

Ideally I'd use 40GB or less for Mandrake, same for Windows (It's only there for AutoCAD, Access and testing purposes) and use the remaining 80 or more GB for things like backup, shared folders etc.

I've googled for this but didn't get quite what I wanted. Would Ghost do the job?

Brian1 11-27-2005 05:37 PM

What boot loader you using? Grub or lilo
I would use Ghost for Linux. Its a bootable cd you can download and burn.

This is the way I would do it.
You need Ghost for Linux
Also a Live CD like Knoppix or Rescue CD (Knoppix perfered)
Know where the following files are on which partition: /etc/fstab, etc/mtab, /boot/grub/grub.conf. I would make backups of all the files and also make a print off of them so you can make changes on paper to make sure you fully understand.

Now the tricky part. I will use grub as the example. Also I assuming you are going to remove the Debian install. If not you should be able to edit the files mentioned above and below for placement of all partitions.

1. Plugin all harddrives you need. Before starting:
If you need to shrink partitions on the sata drive before copy over partition use the knoppix or rescue CD and use the program parted or qtparted to modify partition sizes.
2. Boot up using Ghost for Linux CD
3. Copy your partitions from your /dev/hdb drive to /dev/sda (guessing it will be sda)
4. Once done remove the hdb ide drive
5. Boot up using the knoppix disk.
6. Goto your /boot/grub directory on the sata drive.
7. You need to edit grub.conf or if not there menu.1st.
8. Here you need to change references from /dev/hdb* to match number /dev/sda*. Example /dev/hdb1 to /dev/sda1
9. Also need to edit /etc/fstab and do the same. Change /dev/hdb* to /dev/sda*.
10 Only other file maybe is /etc/mtab. This is needed if fstab file is using LABELS instead of /dev/. It mostly a Redhat/FC and similiar distros.
11. You may have to run grub-install unless the grub mbr is on the first /dev/hda drive. From what I can tell you plan on not removing that drive.

Reboot and ready to go.

Hope this helps.
Brian

davcefai 11-27-2005 11:17 PM

Sounds good, thanks.

Actually sda stays. It's my Debian installation. hdb goes to sdb.

I assume that I can then play with the remainig space on the drive.

Thanks.

Brian1 11-28-2005 05:36 PM

No problem using the extra space. Either add partitions or expand or shrink others.

Brian


All times are GMT -5. The time now is 08:06 AM.