Shrink An Encrypted LUKS Partition

From Nearline Storage
Revision as of 01:23, 9 May 2011 by Dlk (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

Jump to navigation Jump to search

I needed to shrink my root ("/") partition in order to make my "/boot" partition larger so that could run the preupgrade utility to update from F13 to F14. My disk geometry was:

    Device Boot      Start         End      Blocks   Id  System
 /dev/sda1   *          63     3662109     1831023+  83  Linux
 /dev/sda2         3665352   976773167   486553908   83  Linux

/dev/sda1 contains "/boot" as a native ext3 partition /dev/sda2 is a LUKS encrypted partition, home to a Logical Volume Group, which contains a logical swap partition and another partition which contains my root ("/") ext3 filesystem.

My steps were:

  1. Shrink the root partition
  2. Shrink the volume group that contains it
  3. Shrink the LUKS encrypted partition
  4. Shrink /dev/sda2
  5. Move /dev/sda2 to the end of the physical disk
  6. Expand /dev/sda1
  7. Expand the /boot filesystem

My guidance for this came from http://ubuntuforums.org/showthread.php?p=4530641

  1. Boot from Knoppix DVD
  2. Decrypt the LUKS partition

>sudo cryptsetup luksOpen /dev/sda5 crypt1

  1. Activate the LVM partitions

>sudo vgscan --mknodes >sudo vgchange -ay