On 1/22/24 6:59 PM, to...@tuxteam.de wrote:
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.
I will check it again but I think that file systems in that LVM are
ext3. So it requires all of them to be unmounted prior to resizing ?
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
That last resize2fs (without params) would not work here, or at least it
would not work for my three file systems that need to be extended: / ,
/usr , and /var . Maybe to extend each of them separately like this:
lvextend --size +1G --resizefs /dev/mapper/localhost-root
lvextend --size +1G --resizefs /dev/mapper/localhost-usr
lvextend --size +1G --resizefs /dev/mapper/localhost-var
?