Skip to content

Instantly share code, notes, and snippets.

@cupracer
Created May 11, 2016 17:29
Show Gist options
  • Save cupracer/e27f031125506bbbd9f2eac8c8d49f98 to your computer and use it in GitHub Desktop.
Save cupracer/e27f031125506bbbd9f2eac8c8d49f98 to your computer and use it in GitHub Desktop.
Resize LUKS-encrypted partition
# http://www.gigahype.com/resize-luks-encryped-lvm-partition/
# 1. Unmount the filesystem:
umount /secret
# 2. Run a filesystem check to clean up the inode tables before working with it:
fsck.ext3 -C 0 -f /dev/mapper/encrypted
# 3. Close out the LUKS filesystem:
cryptsetup luksClose encrypted
# 4. Extend the Logical Volume like you would any other LVM (We are adding additional 20G of space):
lvextend -L +20G /dev/root_VG/encrypted_LV
# 5. Re-open the encrypted filesystem and resize it:
cryptsetup luksOpen /dev/root_VG/encrypted_LV encrypted
cryptsetup --verbose resize myfs
# 6. FSCK again (for good measure) and then resize the underlying filesystem (ext3 in this example):
fsck.ext3 -f /dev/mapper/encrypted
resize2fs /dev/mapper/encrypted
# 7. Mount up the newly sized LUKS filesystem and make sure everything is OK:
mount /dev/mapper/encrypted /secret
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment