No more space in root filesystem, how could I increase the size?

24

8

This is my filesystem :

 $ df -h -x tmpfs -x devtmpfs
Filesystem               Size  Used Avail Use% Mounted on
/dev/mapper/fedora-root  9.8G  7.6G  1.7G  83% /
/dev/mapper/fedora-home   50G   27G   21G  57% /home
/dev/sda9               1022M  8.4M 1014M   1% /boot/efi

And as you can see the root filesystem is full.

I already tried to delete all the useless things but still I don't have enough space.

How could I increase it ? I have 60 giga left in my hard drive, is there any way I can move my root filesystem there ?

Dimitri Danilov

Posted 2016-05-03T13:13:27.020

Reputation: 355

3Can you show the result of sudo pvscan, please? – mattdm – 2016-05-03T13:20:16.977

1@mattdm PV /dev/sda10 VG fedora lvm2 [141.56 GiB / 77.56 GiB free] Total: 1 [141.56 GiB] / in use: 1 [141.56 GiB] / in no VG: 0 [0 ] – Dimitri Danilov – 2016-05-03T13:22:06.723

15Erm, 1.7G free, where is the problem? – Simon Richter – 2016-05-04T00:03:11.180

3If this is your definition of "full" you should see my filesystem lol – Lightness Races with Monica – 2016-05-04T08:44:28.843

2@SimonRichter I had 1.9 giga when I removed all my /var/cache, but this directory filled very quickly and I have ~ 100 mo in average – Dimitri Danilov – 2016-05-04T09:36:56.733

I'd check what is filling it, and how to avoid that. If it's the package manager, can it be configured to clean its cache? – Simon Richter – 2016-05-04T10:44:29.657

Answers

47

Good news! pvscan shows PV /dev/sda10 VG fedora lvm2 [141.56 GiB / 77.56 GiB free] — so you should be able to add up to 77.56GiB to any of your filesystems. I'd suggest adding it in smaller blocks (like 10GiB), so you have a reserve to put into /home if you decide you need growth there later.

This is a relatively well-tested and generally safe operation, but all root-level volume and filesystem operations have some risk — make sure you have a functioning backup first. Then....

You can extend your root logical volume to use the free space with lvextend, like this:

sudo lvextend --size +10G --resizefs /dev/fedora/root

(Or -L and -r instead of --size and --resizefs, if you prefer short options.)

mattdm

Posted 2016-05-03T13:13:27.020

Reputation: 2 324

5While it's always a good idea to have backups. I would consider this to be pretty low risk since no existing data is moved and the filesystem is (presumablly) native linux, not reverse engineered. – plugwash – 2016-05-03T16:09:48.610

141.56 GiB / 77.56 GiB free reads like X out of Y free. So at first I thought it was a joke :P – Insane – 2016-05-04T02:41:27.917

1@Insane Yeah, that's not the best formatting. You can get the same information formatted in different ways from pvs or pvdisplay, if you prefer. – mattdm – 2016-05-04T17:33:17.157

10

More general answer for LVM:

Firstly - make sure you have additional unpartitioned storage. Then:

  1. Use fdisk to create new partition (safer than expanding existing one)

  2. Use pvcreate to create physical LVM volume:

    pvcreate /dev/sdxx
    
  3. Use vgextend to extend existing LVM group using new physical volume:

    vgextend groupname /dev/sdxx
    

    You can get group names with vgdisplay

  4. Use lvextend on lvm mapper to expand lvm volume:

    lvextend -l +100%FREE /dev/mapper/xxx
    
  5. Grow the filesystem:

    xfs_growfs /dev/mapper/xxx
    

    Or

    resize2fs /dev/mapper/xxx
    

Maciej Asembler

Posted 2016-05-03T13:13:27.020

Reputation: 211

1

The / filesystem may be a particular challenge, as that needs to be supported by the boot loader.

This answer doesn't specify how to accomplish the requested task, but does provide a workaround.

Another option: find a sub-directory (e.g., /big/) which has lots of data. Then copy that data onto your 60GB of space, mv the directory with lots of space (e.g., mv /big /bigback), and mount your 60GB (or a portion of it) onto /big. After confirming everything works as expected, rm /bigback to re-gain space on /

TOOGAM

Posted 2016-05-03T13:13:27.020

Reputation: 12 651

If you do this, immediately after, do touch /.autorelabel; reboot to make sure the moved files have the right SELinux labels. – mattdm – 2016-05-03T13:36:00.437

1This is a valid and useful solution (not requiring much knowledge) when we fly without LVM. With it, the change is even less painful. – Gombai Sándor – 2016-05-03T13:36:33.863

There is no reason in principle that / needs to be supported by the bootloader, but in this case it is true because there is no separate /boot. When monkeying with LVM, always make /boot real. – Joshua – 2016-05-04T17:57:39.233

-1

Another option, before you attempt anything more drastic, is to use BleachBit to remove temporary and other unneeded files.

From wikipedia:

BleachBit is a free and open-source disk space cleaner, privacy manager, and computer system optimizer.

It should be in the package manager, so this should do it.

sudo yum install bleachbit

Or download from their page.

user146393

Posted 2016-05-03T13:13:27.020

Reputation: