A few weeks ago I upgraded the hard disk in my notebook from 160GB to 250GB. I copied the whole hard disk using dd from the old drive to the new drive. I still had to change the partition layout to use the new space. So I downloaded the gparted live CD, booted it and discovered that I was not able to move an extended partition using gparted. I have the following partitions:
/dev/sda1 7 HPFS/NTFS
/dev/sda2 7 HPFS/NTFS
/dev/sda3 * 83 Linux
/dev/sda4 5 Extended
/dev/sda5 83 Linux
My plan was to increase the Windows partitions as well as the Linux partitions. To increase the size of /dev/sda2 I had to move /dev/sda3 and /dev/sda4. I was not able, however, using gparted, to move /dev/sda4. So I decided that I had to make a backup of /dev/sda5, then delete it (and /dev/sda4), move /dev/sda3 and increase the size of /dev/sda2.
Therefore I booted a Fedora installation DVD in the rescue mode and made a backup of /dev/sda5:
dd if=/dev/sda5 bs=65536 | ssh adrian@backup-server "dd of=sda5.img bs=65536"
Then I booted the gparted live CD and deleted /dev/sda5 and /dev/sda4, moved /dev/sda3 and increased the size of /dev/sda2. After that I created a new extended partition (/dev/sda4) and created /dev/sda5 using the remaining space. After gparted finished I booted the Fedora installation DVD again in the rescue mode and restored the backup:
ssh adrian@backup-server "dd if=sda5.img bs=65536" | dd of=/dev/sda5 bs=65536
At the end of the operation I booted my system and was happy that it still worked. Now I still had to resize the encrypted partition. This was pretty easy:
cryptsetup resize luks-<uuid>
pvresize /dev/mapper/luks-<uuid>
Before doing the lvresize I checked the available extends with vgdisplay and used that number in the following lvresize command:
lvresize -l +16449 /dev/mapper/vg_dcbz-lv_root
resize2fs /dev/mapper/vg_dcbz-lv_root
And that was already it. It took some time (maybe 4 hours), but everything finished without any problems. To make sure everything finished without any problems I forced a fsck (touch /forcefsck; reboot).
Before:
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_dcbz-lv_root
74G 69G 1.4G 99% /
After:
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/vg_dcbz-lv_root
137G 69G 62G 53% /