tl;dr: if you’re sure you did everything right, use lsblk
or parted
(etc) to see if a partition table is present on your logical volume.
So I am in the process of merging the content of two fileservers, and had the need to extend a logical volume to accommodate some additional data. No problem- that’s one of the benefits of using LVM!
Except after resizing, I ran into a problem:
$ lvextend +150G /dev/vg/lvinquestion
$ resize2fs /dev/vg/lvinquestion
> The filesystem is already 268435200 (4k) blocks long. Nothing to do!
Wait, what? Aside from the fact I could have combined the comments by including the --resizefs
option to lvextend
, why was resize2fs
complaining that there was “Nothing to do!”?
Fortunately SE Arquade user ToxicFrog had the answer:
@bertieb parted reports the partition size, not the filesystem size
If it’s a partitioned LV you need to resize the partition after expanding the VL
*LV
Ah, whoops! I’m not sure why I partitioned the LV (it only had one partition) but I must have done so.
lsblk
confirmed the partition:
sdh 8:112 0 2.7T 0 disk
??sdh1 8:113 0 2.7T 0 part
??md1 9:1 0 10.9T 0 raid6
(...)
??vg-lv 253:9 0 1.2T 0 lvm
? ??vg-lv1 253:18 0 1.1T 0 part
So, then what? Well, I used dd
to copy the filesystem to a new logical volume, then extended that, and finally removed the original:
# dd if=/dev/dm-18 bs=1M | pv -s 1T | dd of=/dev/vg/lv-new bs=1M
# lvextend --resizefs -L 1.15T /dev/vg/lv-new
# lvremove /dev/vg/lv
# lvrename vg lv-new lv
(pv
was included to give a nice progress indicator, rather than faffing around with SIGUSR1
)
And that was that. There was a slight problem with removing the original logical volume, but more on that later…
Pingback: [Solved] “Logical volume is used by another device” « Bertie Baggio's Wonderland