How to extend a LVM partition
Published: Monday, Apr 28, 2008 Last modified: Monday, Dec 9, 2024
Previously I setup an [[encrypted_LVM|01202]] partition which didn’t work out.
So I wanted to use that defunct ‘crypt’ 10G partition to extend my home partition.
At first I had a problem deactivating the disk. The solution was:
sudo dmsetup remove x61-crypt
Now I am able to deactivate it:
sudo lvremove /dev/x61/crypt
Now I need to resize my home disk to take up all the free space on my drive:
sudo lvextend /dev/x61/home -l+100%FREE
Then finally since the new extended LVM disk is larger, I can do an online resize (not unmounting required) to finish it all off).
x61:~% sudo resize2fs /dev/mapper/x61-home
resize2fs 1.40.8 (13-Mar-2008)
Filesystem at /dev/mapper/x61-home is mounted on /home; on-line resizing required
old desc_blocks = 5, new_desc_blocks = 6
Performing an on-line resize of /dev/mapper/x61-home to 24189952 (4k) blocks.
The filesystem on /dev/mapper/x61-home is now 24189952 blocks long.
Now I am upto:
x61:~% df -h | grep home
/dev/mapper/x61-home 91G 67G 22G 76% /home