Saturday, December 20, 2008

Ghosting Ubuntu to a different Hard Drive

Cloning a Hard Disk

When we originally set up Godzilla, the dual Xeon Evo 6000 it had plenty of disk space, a 73 gig boot drive and an 18 gig drive for storing junk. However, over the year it has had vmware installed to do virtual machine, transmission for getting torrents and a raft of video conversion tools. The plus is the machine is very useful, the downside is that it is filling up. A temporary solution was to plug in an old external USB 80 gig drive. But now that the term is over we need a longer term solution.

The first goal of the project is to get more disk space without re-installing the OS. With a simple machine consisting of a single IDE drive this can be easily accomplished by cloning or 'ghosting' the smaller drive to the larger. We have used Norton Ghost to do this successfully for many years. Put in the new larger drive on the 2nd IDE controller, boot to a ghost floppy and start the clone. Remove the first drive and put the new drive on the primary controller and boot away.

However, the situation gets more complicated if you use multiple drive types such as IDE, SCSI and SATA. Windows has rules about the order in which drive letters are assigned- it is possible to clone a SCSI to an IDE or vice-versa but a system with multiple scsi and ide drives is more difficult. Linux has a similar problem - a simple clone from ide to ide can be done but what if your needs are more complex?

In our case the system has 2 SCSI drives and 1 external IDE mounted in a USB case. We want to clone to scsi boot disk to a old 320 gig IDE disk and maybe later clone that to a 1 terabyte SATA disk.

The first step is to find out exactly what the disk are labelled. We open a terminal window get the following:

gnickers@godzilla:~$ sudo fdisk -l
[sudo] password for gnickers:

Disk /dev/sda: 18.2 GB, 18209792000 bytes
255 heads, 63 sectors/track, 2213 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00006694

Device Boot Start End Blocks Id System
/dev/sda1 * 1 2213 17775891 b W95 FAT32

Disk /dev/sdb: 73.4 GB, 73407868928 bytes
255 heads, 63 sectors/track, 8924 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00045a17

Device Boot Start End Blocks Id System
/dev/sdb1 * 1 8555 68718006 83 Linux
/dev/sdb2 8556 8924 2963992+ 5 Extended
/dev/sdb5 8556 8924 2963961 82 Linux swap / Solaris

WARNING: GPT (GUID Partition Table) detected on '/dev/sdc'!
The util fdisk doesn't support GPT. Use GNU Parted.

Disk /dev/sdc: 80.0 GB, 80026361856 bytes
255 heads, 63 sectors/track, 9729 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000000

Device Boot Start End Blocks Id System
/dev/sdc1 1 9730 78150743+ ee EFI GPT

We decide to use a couple of other methods to check our results.

gnickers@godzilla:~$ sudo cfdisk -P s /dev/sda
[sudo] password for gnickers:
Partition Table for /dev/sda

First Last
# Type Sector Sector Offset Length Filesystem Type (ID) Flag
1 Primary 0 35551844 63 35551845 W95 FAT32(0B) Boot

and

gnickers@godzilla:~$ sudo tune2fs -l /dev/sda1 | grep UUID
tune2fs: Bad magic number in super-block while trying to open /dev/sda1
Couldn't find valid filesystem superblock.

Which gives an error message. I'm thinking we could simplify matters by disconnecting the external USB disk and the 18 gig internal scsi drive. We probably should reboot the system anyway as it has been up all term and probably needs to fsck the filesystem anyway.

Reboot - nothing. It does not come up to sdb1. Check connections and ensure adaptec scsi controller is set to boot the hd with id = 1. Reboot. no joy. So let's put the 18gig scsi back in and reboot again. The GRUB boot loader appears but lists Error 21 which means it cannot find the disk. We go into the scsi bios and see the 18gig is ID = 0 but the 73 gig has disappeared. A loose power connector. Fix and restart. no boot. So i undo the only other changes and set the scsi bios to boot to id0 which is the 18 gig and it works.

We need to take a closer look at this.

No comments: