User Tools

Site Tools



Resize an encrypted LV managed by cryptsetup

While it is seems to be quiet obvious for most people 1) how to resize any stack of LUKS, ext2,3,4, LVM, MSDOS or GPT partitions, it becomes strange if you're using Ubuntus package cryptsetup 2)

~ # lvresize -L 22.5G /dev/vg_sys/lv_home
~ # cryptsetup resize home
~ # resize2fs /dev/mapper/home
resize2fs 1.42.10 (18-May-2014)
resize2fs: Device or resource busy while trying to open /dev/mapper/home
Couldn't find valid filesystem superblock.
~ # mount | fgrep home  
/dev/mapper/home_unformatted on /home type ext3 (rw,relatime,data=ordered)
~ # resize2fs /dev/mapper/home_unformatted
resize2fs 1.42.10 (18-May-2014)
open: No such file or directory while opening /dev/mapper/home_unformatted
~ #

The remedy is simple:

dmsetup rename home home_unformatted
resize2fs /dev/mapper/home_unformatted
dmsetup rename home_unformatted home 

Meaning, if you are using /etc/crypttab and cryptdisks_(start|stop) for automatic handling of mounts
docs/tips_n_tricks/luks.html.txt · Last modified: 17.12.2015 10:45 by peter