0

I'm running docker containers on my machine which puts it all in /var/. df shows that /var/ is only 5G but I know the total amount of this system if 40G and it has at least 24G available. How can increase the size of /var/ an extra 15G? I'm unclear on if I should be doing this in my docker-compose file or through CentOS itself. The docker documentation on filesystems is incredibly confusing.

Filesystem               Size  Used Avail Use% Mounted on
/dev/mapper/centos-root   27G  2.9G   24G  11% /
/dev/mapper/centos-var   5.0G  4.1G  944M  82% /var

pvs
  PV         VG     Fmt  Attr PSize   PFree
  /dev/sda2  centos lvm2 a--  <39.50g 4.00m

vgs
  VG     #PV #LV #SN Attr   VSize   VFree
  centos   1   4   0 wz--n- <39.50g 4.00m
3
  • Is this a VM or a physical machine? Add the output of pvs and vgs to your question. Jun 12, 2019 at 22:44
  • @NasirRiley it's a VM. I edited the question with the output of the commands.
    – pnus
    Jun 12, 2019 at 22:47
  • Your centos volume group is out of space. There are two other logical volumes in that volume group, most likely centos-home and centos-tmp, that are taking up the rest of the 40GB. You'll need to add a new virtual disk to your VM, create a new physical volume, add it to the centos volume group, and expand some of the free space to centos-var. Jun 12, 2019 at 23:38

2 Answers 2

0

As per my observation, I can see there are lots of unused space is there in / partition so we can reduce this LV and make use this reclaimed space to extend /var

Step 1. Reduce LV "centos-root" Results >> you will get enough space in VG "Centos"

Step 2. Esxtend the size of LV "centos-var"

Note: You have to take precautions as you are reducing the / partition.

1
  • 1
    If the file system on centos-root is xfs then it won't be possible to reduce the size. Jun 16, 2019 at 18:33
0

If it is a VM hopefully you can just add one more disk to it and use that space to extend the volume. Here is a description how you can extend: https://www.linuxtechi.com/extend-lvm-partitions/

Alternatively you can move the docker files to somewhere where you have enough space. (In your case it's only the / dir, what I wouldn't suggest to use, but may work as an emergency solution for short time):

  1. Stop all containers and the dockerd too
  2. Move all docker files:
mv /var/lib/docker/ /somewhere/you/have/space/
  1. Create a symlink to the new dir:
ln -s /somewhere/you/have/space/docker /var/lib/docker
  1. Restart dockerd and the containers.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .