/var is full, update problem

Hey. I’ve just tried to update my fedora but after downloading many files, it said that /var is full and I need 80 mb, at least, in /var. My questions are, is there anyway to extend my /var space? Can I remove some files and then force it to install updates? Many thanks.

Be careful with deleting files in /var as applications/daemons/kernel(-modules) need them.

You can increase your file system size if the file system supports this function. You may look into
https://docs.fedoraproject.org/en-US/Fedora/14/html/Storage_Administration_Guide/index.html

Most fedora installations use ext4 or XFS:
https://docs.fedoraproject.org/en-US/Fedora/14/html/Storage_Administration_Guide/xfsgrow.html
https://docs.fedoraproject.org/en-US/Fedora/14/html/Storage_Administration_Guide/ext4grow.html

If you are not sure which fs is used, have a look into /etc/fstab. If “/var” is not listed as separate mount point, it is part of “/”. E.g. the line “/dev/mapper/vg-root / ext4 defaults 1 1” implies an ext4 fs.

Another possibility is removing virtual machines, which usually need much space. libvirt-based VM’s/containers are usually stored in /var. You may have a look into /var/lib/libvirt/images or /var/lib/containers. You should use your administration tool to remove VM’s/containers and not deleting them by yourself.

Another possibility is creating a new partition that has sufficient space and then copy -R a folder into it. E.g. /var/ itself if it is part of /, or /var/lib/libvirt/images. Then add the new partition to /etc/fstab with the corresponding mount point. E.g. add “/dev/mapper/vg-libvirt /var/lib/libvirt/images ext4 defaults 1 2”. But you should do all of this using a live system. You could then delete the original folder to release space.

But be aware that all above solutions contain some risk of losing data. So backup critical files before. Depending on the directory, the latter solution maybe needs to relabel SELinux. You can do this by root “touch /.autorelabel”.

Further, just removing programs with DNF will not make a difference since these are not stored in /var but /usr. But you can try to “dnf clean packages” to remove the dnf cache in /var.

Regards,
0xc3

2 Likes

The first thing I would do is clean up old journal logs. This will not affect any system operations. Run as root or under sudo:

journalctl --vacuum-time=50days

You can specify any time period you want, but I like to keep some history for possible troubleshooting purposes.

1 Like

Install ncdu and check biggest files/folders in /var:
$ dnf install -y ncdu; cd /var; ncdu
You can delete files touching “d” on the keyboard.

If you have big logs in /var/log, you can try:
$ logrotate -f /etc/logrotate.conf

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.