Wednesday, August 8, 2012

Using Clonezilla to Image to a Smaller Hard Drive

Cloning from a large drive to a smaller drive

When trying to bring an image from a large drive to a smaller drive, there is a method (while fairly involved) that works. You have to clone the partitions from the larger drive (make sure they are small enough to fit on the new one), then can clone them back to the smaller drive, however, the partition table must match from drive to drive. We will use parted, which comes on the Clonezilla Live to find and match the partition tables. These instructions will point you down the right path.

First and foremost, start Clonezilla on the larger drive. Then follow these commands:

1. Within Linux, hit Ctrl-Alt-F2 -> gets you to a command prompt
2. sudo su -> This will get you to a root prompt.
3. parted
4. print -> find the partition table start and stop bytes, WRITE THEM DOWN FOR THE NEW PARTITION TABLE
Example:
Start    End    Size
32.3k    41.1M    41.1M
41.9M    147M    105M
147M    19.4G    19.2G
5. quit

Then on the new (smaller) drive, start Clonezilla again...follow the commands (using the partition table from above):

1. parted
2. print -> check and see if there are any partitions, if there are then run rm ...the idea is to clear the partition table first.
3. mkpart primary 32.2k 41.1M -> create the 1st partition
4. mkpart primary 41.9M 147M -> create the 2nd partition
5. mkpart primary 147M 19.4G -> create the 3rd partition
6. quit

When you're done, you can then clone the partitions from the larger drive, and clone the partitions back to the smaller one, without worrying about drive geometry.