On Mon, Jan 22, 2024 at 03:40:06PM +0000, Alain D D Williams wrote:
On Mon, Jan 22, 2024 at 10:29:55AM -0500, Stefan Monnier wrote:
lvextend --size +1G --resizefs /dev/mapper/localhost-home
Ie get lvextend to do the maths & work it out for me.
Those who are cleverer than me might be able to tell you how to get it right
first time!
lvreduce --size -50G --resizefs /dev/mapper/localhost-home
Oh, even better. It is a long time since I looked at than man page.
Does this still need to be done with the file system unmounted or can it be
done with an active file system these days ?
You have first to shrink the file system (if it's ext4, you can use
resize2fs: note that you can only *grow* an ext4 which is mounted
(called "online resizing) -- to *shrink* it, it has to be unmounted.
Since I wasn't quite sure whether ext2's Gs are the same as LVM's
and didn't want to bother with whatever clippings each process
takes, what I did in this situation was:
- shrink (resize2fs) the file system to a size clearly below target
- resize the LVM to my target size
- resize2fs again without params, which lets it take whatever the
partition offers