On 1/22/24 10:17, Alain D D Williams wrote:
On Mon, Jan 22, 2024 at 03:32:30PM +0100, sko...@uns.ac.rs wrote:
I am getting the following message at any boot:
"The volume "Filesystem root" has only 221.1 MB disk space remaining."
df -h says:
Filesystem Size Used Avail Use% Mounted on
udev 1.5G 0 1.5G 0% /dev
tmpfs 297M 9.0M 288M 4% /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 57K 2.2G 1% /tmp
/dev/mapper/localhost-var 2.7G 2.5G 55M 98% /var
/dev/mapper/localhost-home 257G 73G 172G 30% /home
tmpfs 297M 40K 297M 1% /run/user/1000
As my system has encrypted LVM, I suppose that I shall reduce some space
used for /home, and then use it to extend /, /usr, and /var logical
partitions. I think I did (or tried to do) something similar several years
ago, but forgot the proper procedure. Any link for a good tutorial is
welcomed. Thanks.
The shrinking of /home is the hard part. You MUST first unmount /home, then
resize the file system, then resize the logical volume.
umount /home
Find out how big it is:
resize2fs /dev/mapper/localhost-home
Change the filesystem size:
resize2fs /dev/mapper/localhost-home NEW-SIZE
Change the partition size:
lvextend --size 200G /dev/mapper/localhost-home
The hard bit is working out what NEW-SIZE should be and having it such
that you use all of the partition but without making the file system size
greater than the partition size - ie getting the last few megabytes right.
What I do is make NEW-SIZE 2GB smaller than I want (assuming that it still
fits),
the size I give to lvextend 1GB smaller - so it all works, but there is wasted
space & it is not quite big enough. I then do:
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!
mount /home
Extending the others is easy and can be done when the system is running &
active, something like:
lvextend --size +1G --resizefs /dev/mapper/localhost-var
Finally: ensure that you have a good backup of /home before you start.
I use to use LVM and RAID but I quit using that after finding out that
partition the drive and using gparted was way more easier