Thomas' Tech Tips

Shrink LUKS volume with ext4 filesystem

27 September 2022 - Thomas Damgaard

This is how I managed to shrink an encrypted LUKS volume with ext4 filesystem on Linux

  1. backup data (seriously)
  2. overshrink the ext4 filesystem by a few more GB than needed

    • cryptsetup luksOpen /dev/sdc1 edata
    • umount /dev/mapper/edata
    • e2fsck -f /dev/mapper/edata
    • resize2fs -p /dev/mapper/edata 300G
  3. cryptsetup luksClose edata
  4. truncate LUKS volume using fdisk or gdisk to e.g. 320 GB
  5. cryptsetup luksOpen /dev/sdc1 edata
  6. grow the ext4 filesystem back to 100 %
Filed under: encryption, ext4, linux, luks, security, tips

Back to article list