Skip to content

Resizing partitions Pt. 2 –And partimage rocks my world

September 20, 2007

If you’ve ever wanted to backup and restore a hard drive partition you may have come across partimage. It has a nice clean text interface and works fast because it only copies the used space in the partition (unlike dd or dcfldd). It also gives a great progress indicator, so you know how long it will take.

While working on resizing the partition on two different laptops, and trying out various LiveCD’s to do the job, I found that partimage appears to be a faster and safer method of resizing a partition when compared to using gparted. In the end I’m now thinking gparted is horribly slow for resizing because you should do a backup first anyway before resizing.

Here’s the situation. I keep all my /home directory on a separate partition with Ubuntu, and it was 96% full (too many episodes of scrubs I’ll bet!?). I was going to resize it using gparted on a liveCD, but thought I’d start making a backup copy of the 15 Gb partition.

I’d found a lovely 500GB (half terra!) Seagate Freeagent USB2.0 drive for only $140 bucks Canadian on redflagdeals. My first try was this new sexy liveCD Partedmagic1.8 which gave me only 8mb/s and everything slowed to crawl. I think there’s a problem with that distro when using a USB drive. It was going to sit there forever, I’m guessing, cause dd is annoying in that it doesn’t display an ETA with estimated time and progress… (dcfldd does a better job at this).  So I cancel and try something else.
I try SystemRescueCD again, which booted this time with the USB drive. When I copied the parition with partimage, I got a blazing 1.4GB/minute and was done imaging the partition in only 12 minutes.

I made my backup copy first, just in case gparted dies during the resizing process… or end up choosing to cancel part way through. Which is what I ended up doing…. It appeared to move the partition, and do a filesystem check and 15 minutes later I start to get an ETA for completing the task… and it tells me that it’s going to take at least another hour to do a read only test of copying the filesystem separately. What!? Probably another 2 hours to actually do it?! Augh! No time for this nonsense. I cancel the process impatiently, and feel smug that I’d actually backed up my partition first before risking losing everything. Now to test if it actually worked. The actual /home partition is now totally messed up with my canceling the gparted resizing process… so I delete it. (I felt brave and hopeful with my new partimage file on the new half terra segate drive. BRING-IT-ON!)

I make a new partition in it’s place, twice as big and restore the partition data with partimage at a blazing 1.63Gib / min a total of 15GiB in less than 10 minutes. In the time it takes me to drive up to the corner store for some eggs, I’d completely imaged, resized and restored my /home partition! SWEET!

The key is that I needed to use gparted to perform a filesystem check on the partitition after it’s been restored so that the filesystem is made to match the partition size.
After imaging and restoring, use gparted or resize2fs to adjust the files system to match the new partition size. Otherwise you’ll have problems with fsck or parted saying “Warning; partition is 18.5 Gib but file system is 16.8GiB” and so on.

In a little over 20 minutes I’d made a backup copy of the partition and restored it.

No comments yet

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: