Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #266477

Re: Resizing LVM partitions

From Miroslav Skoric <skoric@uns.ac.rs>
Newsgroups linux.debian.user
Subject Re: Resizing LVM partitions
Date 2024-01-22 23:20 +0100
Message-ID <HZaO5-4Ub1-5@gated-at.bofh.it> (permalink)
References <HZ3Wi-4PQj-9@gated-at.bofh.it> <HZ4fD-4Qcu-13@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On 1/22/24 4:17 PM, Alain D D Williams wrote:
> On Mon, Jan 22, 2024 at 03:32:30PM +0100, skoric@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.
> 

Sounds interesting. Thank you. Will see other opinions too.

Back to linux.debian.user | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

Resizing LVM partitions skoric@uns.ac.rs - 2024-01-22 16:00 +0100
  Re: Resizing LVM partitions Alain D D Williams <addw@phcomp.co.uk> - 2024-01-22 16:20 +0100
    Re: Resizing LVM partitions Stefan Monnier <monnier@iro.umontreal.ca> - 2024-01-22 16:40 +0100
      Re: Resizing LVM partitions Alain D D Williams <addw@phcomp.co.uk> - 2024-01-22 16:50 +0100
        Re: Resizing LVM partitions <tomas@tuxteam.de> - 2024-01-22 19:00 +0100
          Re: Resizing LVM partitions Miroslav Skoric <skoric@uns.ac.rs> - 2024-01-22 23:20 +0100
            Re: Resizing LVM partitions <tomas@tuxteam.de> - 2024-01-23 06:50 +0100
            Re: Resizing LVM partitions Andy Smith <andy@strugglers.net> - 2024-01-23 07:40 +0100
              Re: Resizing LVM partitions Miroslav Skoric <skoric@uns.ac.rs> - 2024-01-24 00:40 +0100
                Re: Resizing LVM partitions Greg Wooledge <greg@wooledge.org> - 2024-01-24 00:50 +0100
                Re: Resizing LVM partitions <tomas@tuxteam.de> - 2024-01-24 06:50 +0100
                Re: Resizing LVM partitions Greg Wooledge <greg@wooledge.org> - 2024-01-24 13:10 +0100
                Re: Resizing LVM partitions Miroslav Skoric <skoric@uns.ac.rs> - 2024-01-24 23:10 +0100
                Re: Resizing LVM partitions Greg Wooledge <greg@wooledge.org> - 2024-01-24 23:30 +0100
                Re: Resizing LVM partitions Stefan Monnier <monnier@iro.umontreal.ca> - 2024-01-25 15:20 +0100
                Re: Resizing LVM partitions Miroslav Skoric <skoric@uns.ac.rs> - 2024-01-26 13:40 +0100
                Re: Resizing LVM partitions Max Nikulin <manikulin@gmail.com> - 2024-01-24 03:30 +0100
                Re: Resizing LVM partitions Miroslav Skoric <skoric@uns.ac.rs> - 2024-01-24 23:20 +0100
                On the deprecation of separate /usr (Was: Re: Resizing LVM  partitions) Andy Smith <andy@strugglers.net> - 2024-01-24 23:30 +0100
                Re: Resizing LVM partitions Andy Smith <andy@strugglers.net> - 2024-01-24 13:10 +0100
        Re: Resizing LVM partitions Miroslav Skoric <skoric@uns.ac.rs> - 2024-01-22 23:20 +0100
          Re: Resizing LVM partitions Greg Wooledge <greg@wooledge.org> - 2024-01-22 23:30 +0100
            Re: Resizing LVM partitions Miroslav Skoric <skoric@uns.ac.rs> - 2024-01-24 00:40 +0100
    Re: Resizing LVM partitions Greg Wooledge <greg@wooledge.org> - 2024-01-22 17:10 +0100
      Re: Resizing LVM partitions <tomas@tuxteam.de> - 2024-01-22 19:10 +0100
        Re: Resizing LVM partitions Greg Wooledge <greg@wooledge.org> - 2024-01-22 19:50 +0100
        Re: Resizing LVM partitions Miroslav Skoric <skoric@uns.ac.rs> - 2024-01-24 00:40 +0100
      Re: Resizing LVM partitions Miroslav Skoric <skoric@uns.ac.rs> - 2024-01-24 00:40 +0100
    Re: Resizing LVM partitions Gremlin <scott-andrews@columbus.rr.com> - 2024-01-22 19:20 +0100
      Re: Resizing LVM partitions Greg Wooledge <greg@wooledge.org> - 2024-01-22 19:50 +0100
    Re: Resizing LVM partitions Miroslav Skoric <skoric@uns.ac.rs> - 2024-01-22 23:20 +0100

csiph-web