Expanding an Encrypted Filesystem with LVM and Fedora 10

dale's picture

My encrypted home directory on my Fedora 10 laptop is filling up.
Let's expand it.

[root@seitan ~]# df -h /home
Filesystem            Size  Used Avail Use% Mounted on
                       14G   13G  862M  94% /home

First identify the logical volume beneath this encrypted LUKS device.

[root@seitan ~]# grep CryptHome /etc/crypttab 
CryptHome /dev/VolGroup00/LVCryptHome none luks,check=ext2,retry=5

Then see what is available in LVM.

[root@seitan ~]# lvs
  LV          VG         Attr   LSize  Origin Snap%  Move Log Copy%  Convert
  LVCryptHome VolGroup00 -wi-ao 14.00G  
[root@seitan ~]# vgs
  VG         #PV #LV #SN Attr   VSize  VFree 
  VolGroup00   2   5   0 wz--n- 74.19G 19.34G

Expand the logical volume beneath CryptHome.

[root@seitan ~]# lvextend -L+5G /dev/VolGroup00/LVCryptHome
  Extending logical volume LVCryptHome to 19.00 GB
  Logical volume LVCryptHome successfully resized

Then make the LUKS device aware of the new space beneath it.

[root@seitan ~]# cryptsetup resize CryptHome

And finally the filesystem on top needs to grow into the new space.

[root@seitan ~]# resize2fs /dev/mapper/CryptHome 
resize2fs 1.41.3 (12-Oct-2008)
Filesystem at /dev/mapper/CryptHome is mounted on /home; on-line resizing required
old desc_blocks = 1, new_desc_blocks = 2
Performing an on-line resize of /dev/mapper/CryptHome to 4980607 (4k) blocks.
The filesystem on /dev/mapper/CryptHome is now 4980607 blocks long.

[root@seitan ~]# df -h /home
Filesystem            Size  Used Avail Use% Mounted on
                       19G   13G  5.8G  70% /home