Hard Drive Upgrade on Windows 7 and Fedora 17 Laptops

I recently upgraded the system drive in my Windows7 HP dv9000 laptop from its original 160G drive to a 500G drive using Clonezilla on a USB flash drive. I then used the 160G drive to upgrade my Fedora 17 T61 ThinkPad from its original 80G drive using using Clonezilla and System Rescue CD (also installed on a USB flash drive).

Step 1 – Windows 7 HP dv9000 Drive Upgrade

The first step was to clone my old system drive to the new one. I’d never used Clonezilla before, but installing it to a bootable USB drive was the hardest part of the exercise (download Clonezilla zip distribution, expand to a USB drive, execute Makeboot.bat – it’s all described under “USB setup with MS Windows – Method B: Manual” on the Clonezilla Live on USB flash drive or USB hard drive page). The dv9000 has two drive bays, so I moved the system drive to the secondary drive bay, put the new 500G drive in the primary drive bay, booted the laptop from the new Clonezilla USB drive, and accepted all the defaults for a disk to disk clone (including using novice mode). There was a confusing bit was when the screen text implied I needed to select an option with the space bar, but simply hitting Enter was what worked.

After cloning the drive, I removed the Clonezilla USB drive and the old system drive from the secondary drive bay, and rebooted. Woo hoo! Everything looks good, except I’ve got the same partitions on the new system drive that were on the old system drive (a ~159G “main” partition with Windows, my programs and my data, and a ~1G system restore partition where HP had put the WinXP install disks), and ~360G of unused space. The main partition needed to be grown to include the unused space.

Windows 7 Home Premium includes the capability to extend a disk partition, so I opened the Windows Disk Management tool (Control Panel / System and Security / Create and format hard disk partitions), but unfortunately found that partitions can only be extended into empty space on their right in the allocation display, and that’s where the system restore partition was. Hmmm….

The simplest solution was to delete the system restore partition, so everthing to the right of the 159G main partition was unused space. I rationalizing doing this as the system restore partition has the original 32-bit Windows Vista install, and since I was now using 64-bit Windows 7 from a DVD, and with no extra drivers needed, I didn’t think I would ever need the Vista install again. OK, right-click to delete the system restore partition, and another right-click to extend the (now only) partition. Easy peasy! I’ve now got lots more drive space for programs, pictures and video.

Step 2 – Fedora 17 ThinkPad T61 Drive Upgrade

Upgrading the drive in the Fedora T61 ThinkPad turned out to be a bit more complicated, partially because Fedora uses LVM  (Logical Volume Manager) and partially because the only USB flash drive the T61 would boot from (out of a half-dozen 1G to 8G drives) was the 1G drive I had installed Clonezilla on. Go figure, there must be magic involved in booting from USB drives (“Any technology sufficiently advanced is indisguishable from magic.”)

The T61 doesn’t have a 2nd internal drive bay like the dv9000, so instead of using Clonezilla to do a disk to disk clone, I cloned the T61’s 80G internal drive to an image file on an external USB drive (which was formatted with NTFS by the way), then replaced the old system drive with the “new” 160G drive from the dv9000, and cloned the image file to the new system drive (if I was more concerned about security, I should have wiped the drive first to eradicate its Windows data, but I didn’t).

Next I needed to extend the file system to make use of the 80G of unused space on the drive after cloning. Googling, I learned that Fedora 17 (and at least Fedora 16) by default creates partitions based on LVM (Logical Volume Manager), rather than a more simple system, which meant that extending a partition wasn’t going to be as easy as simply growing it into the unused space.

I had already assumed I was going to use GParted to grow an existing partition before I found out about LVM, and had gone ahead and installed System Rescue CD on a USB flash drive (because it includes GParted, and because I’d heard about it and had been waiting for a reason to try it out). Even though I now couldn’t use GParted, I still needed to boot the T61 with a live environment to work with the disk unmounted, so System Rescue CD still got a workout

I could probably have used the Fedora 17 live system I installed Fedora 17 with in the first place, except that the flash drive I had used had already been overwritten with Clonezilla, and then the System Rescue CD.

After a bit more research, making use of the unused space on the drive turned out to be a multiple step process:

  • Note the starting and ending cluster numbers of the LVM partition on the drive, and also the very last cluster number on the drive.
  • Use fdisk to delete the LVM partition (which removes the partition reference from the drive index structure, but doesn’t affect the data), and then create a new LVM partition starting at the same cluster as the original one, but ending with the last cluster on the drive (get what’s happening?)
  • Use pvresize to expand the physical volume used by the LVM, so that it occupies the entire partition (as extended by fdisk).
  • Use lvextend to extend the /home logical volume by the free space now available in the expanded physical volume (I could also have extended /root and /swap by giving up some /home space, but they seemed adequate already – /root was 45G and /swap was 6G).

The details are in the LVM Partition Resizing thread on LinuxQuestions.org (and a big thank you to mpdavig for a very clear and concise article!). I simply followed mpdavig’s instructions in a terminal shell from the System Rescue CD.