On 1/23/24 7:36 AM, Andy Smith wrote:
ext filesystems do need to be unmounted when shrinking them (they can
grow online, though). When you use the --resizefs (-r) option, LVM asks
you if you wish to unmount. Obviously you cannot do that on a
fiulesystme which is in use, which means you'll need a live or rescue
environment to do it for the root filesystem.
I'd shrink what else I could and then see where I am at. It's okay to do
them one at a time. LVM will just not do it if there's a problem.
Another thing I sometimes do in these situations is make a new LV and
move some of the things in / out into it where possible, to free up some
more space on /.
Dunno ... in any case, for some reason the rescue mode I went to by
booting from an old installation CD (dated back to Debian 6.0.1A
Squeeze!) did not see partitions in form of e.g.
/dev/mapper/localhost-home, but rather /dev/localhost/home, so lvreduce
rejected to proceed.
So I tried vgdisplay. It returned ... among the others ...
...
Total PE 76249
Alloc PE / Size 74378 / 290.54 GiB
Free PE / Size 1871 / 7.31 GiB
... so I considered that 7.31 GB could be used for extending /, /usr,
and /var file systems. I rebooted machine into normal operation and did
the following:
# vgdisplay
--- Volume group ---
VG Name localhost
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 17
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 6
Open LV 6
Max PV 0
Cur PV 1
Act PV 1
VG Size <297.85 GiB
PE Size 4.00 MiB
Total PE 76249
Alloc PE / Size 74378 / <290.54 GiB
Free PE / Size 1871 / <7.31 GiB
VG UUID fbCaw1-u3SN-2HCy-w6y8-v0nK-QsFE-FETNZM
# df -h
Filesystem Size Used Avail Use% Mounted on
udev 1.5G 0 1.5G 0% /dev
tmpfs 297M 8.8M 288M 3% /run
/dev/mapper/localhost-root 5.2G 4.7G 211M 96% /
/dev/mapper/localhost-usr 14G 12G 948M 93% /usr
tmpfs 1.5G 0 1.5G 0% /dev/shm
tmpfs 5.0M 4.0K 5.0M 1% /run/lock
tmpfs 1.5G 0 1.5G 0% /sys/fs/cgroup
/dev/sda1 228M 133M 84M 62% /boot
/dev/mapper/localhost-tmp 2.3G 55K 2.2G 1% /tmp
/dev/mapper/localhost-var 2.7G 1.9G 659M 75% /var
/dev/mapper/localhost-home 257G 63G 182G 26% /home
tmpfs 297M 32K 297M 1% /run/user/1000
# lvextend --size +1G --resizefs /dev/mapper/localhost-root
Size of logical volume localhost/root changed from 5.32 GiB (1363
extents) to 6.32 GiB (1619 extents).
Logical volume localhost/root successfully resized.
resize2fs 1.44.5 (15-Dec-2018)
Filesystem at /dev/mapper/localhost-root is mounted on /; on-line
resizing required
old_desc_blocks = 22, new_desc_blocks = 26
The filesystem on /dev/mapper/localhost-root is now 6631424 (1k) blocks
long.
# df -h (to check the new status)
Filesystem Size Used Avail Use% Mounted on
udev 1.5G 0 1.5G 0% /dev
tmpfs 297M 8.8M 288M 3% /run
/dev/mapper/localhost-root 6.2G 4.7G 1.2G 81% /
/dev/mapper/localhost-usr 14G 12G 948M 93% /usr
tmpfs 1.5G 0 1.5G 0% /dev/shm
tmpfs 5.0M 4.0K 5.0M 1% /run/lock
tmpfs 1.5G 0 1.5G 0% /sys/fs/cgroup
/dev/sda1 228M 133M 84M 62% /boot
/dev/mapper/localhost-tmp 2.3G 55K 2.2G 1% /tmp
/dev/mapper/localhost-var 2.7G 1.9G 659M 75% /var
/dev/mapper/localhost-home 257G 63G 182G 26% /home
tmpfs 297M 32K 297M 1% /run/user/1000
# lvextend --size +1G --resizefs /dev/mapper/localhost-usr
Size of logical volume localhost/usr changed from <13.38 GiB (3425
extents) to <14.38 GiB (3681 extents).
Logical volume localhost/usr successfully resized.
resize2fs 1.44.5 (15-Dec-2018)
Filesystem at /dev/mapper/localhost-usr is mounted on /usr; on-line
resizing required
old_desc_blocks = 1, new_desc_blocks = 1
The filesystem on /dev/mapper/localhost-usr is now 3769344 (4k) blocks long.
# df -h
Filesystem Size Used Avail Use% Mounted on
udev 1.5G 0 1.5G 0% /dev
tmpfs 297M 8.8M 288M 3% /run
/dev/mapper/localhost-root 6.2G 4.7G 1.2G 81% /
/dev/mapper/localhost-usr 15G 12G 1.9G 86% /usr
tmpfs 1.5G 0 1.5G 0% /dev/shm
tmpfs 5.0M 4.0K 5.0M 1% /run/lock
tmpfs 1.5G 0 1.5G 0% /sys/fs/cgroup
/dev/sda1 228M 133M 84M 62% /boot
/dev/mapper/localhost-tmp 2.3G 55K 2.2G 1% /tmp
/dev/mapper/localhost-var 2.7G 1.9G 659M 75% /var
/dev/mapper/localhost-home 257G 63G 182G 26% /home
tmpfs 297M 32K 297M 1% /run/user/1000
# lvextend --size +1G --resizefs /dev/mapper/localhost-var
Size of logical volume localhost/var changed from 2.79 GiB (715
extents) to 3.79 GiB (971 extents).
Logical volume localhost/var successfully resized.
resize2fs 1.44.5 (15-Dec-2018)
Filesystem at /dev/mapper/localhost-var is mounted on /var; on-line
resizing required
old_desc_blocks = 1, new_desc_blocks = 1
The filesystem on /dev/mapper/localhost-var is now 994304 (4k) blocks long.
# df -h
Filesystem Size Used Avail Use% Mounted on
udev 1.5G 0 1.5G 0% /dev
tmpfs 297M 8.8M 288M 3% /run
/dev/mapper/localhost-root 6.2G 4.7G 1.2G 81% /
/dev/mapper/localhost-usr 15G 12G 1.9G 86% /usr
tmpfs 1.5G 0 1.5G 0% /dev/shm
tmpfs 5.0M 4.0K 5.0M 1% /run/lock
tmpfs 1.5G 0 1.5G 0% /sys/fs/cgroup
/dev/sda1 228M 133M 84M 62% /boot
/dev/mapper/localhost-tmp 2.3G 55K 2.2G 1% /tmp
/dev/mapper/localhost-var 3.7G 1.9G 1.6G 55% /var
/dev/mapper/localhost-home 257G 63G 182G 26% /home
tmpfs 297M 32K 297M 1% /run/user/1000
# vgdisplay
--- Volume group ---
VG Name localhost
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 20
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 6
Open LV 6
Max PV 0
Cur PV 1
Act PV 1
VG Size <297.85 GiB
PE Size 4.00 MiB
Total PE 76249
Alloc PE / Size 75146 / <293.54 GiB
Free PE / Size 1103 / <4.31 GiB
VG UUID fbCaw1-u3SN-2HCy-w6y8-v0nK-QsFE-FETNZM
... seems that I still have some 4 GB of unallocated space to add
somewhere if/when needed. (I remain unsure whether the above-mentioned
7.31 GB of free space has probably left from the earlier resizing some
years ago, or from initial installation.)
In any case, what is left to do is to find the best way to take some
space from /home which is largely underused.
Thank you all for comments ...