Skip to content

Instantly share code, notes, and snippets.

@fxlv
Last active August 29, 2015 14:07
Show Gist options
  • Save fxlv/a5b2782ca1735105b4d5 to your computer and use it in GitHub Desktop.
Save fxlv/a5b2782ca1735105b4d5 to your computer and use it in GitHub Desktop.
LVM based crypto filesystem extending
TARGET=/some/dir
CRYPTO_DEVICE_NAME=/dev/mapper/crypto_super_secure
LVM_VOLUME=/dev/SOMETHING/SOME_LVM_VOLUME
#
echo "Unmounting $TARGET"
umount $TARGET
echo "Extending"
lvextend -L +100g $LVM_VOLUME
echo "Resizing crypto"
cryptsetup --verbose resize $CRYPTO_DEVICE_NAME
echo "Checking the file system"
e2fsck -f /dev/mapper/$CRYPTO_DEVICE_NAME
echo "Resizing the file system"
resize2fs -p /dev/mapper/$CRYPTO_DEVICE_NAME
echo "All done, mounting back the filesystem"
mount /dev/mapper/$CRYPTO_DEVICE_NAME $TARGET
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment