# Can I delete /var/log ? Root full

While doing a " Dnf update" on Fedrora 25, it failed with reported errors of not enough disk space on "root" My/root is 10gb in size and so i was a little surprised. After looking through this wonderful website, it turns out that my /var/log file is nearly 800mb in size and would solve the problem if I can delete it So..Can I delete /var/log file ?

ALSO, I have 10Gb free on the Hard Disk as unused space ( non formatted) Can I add that to "root" to try and avoid this problem again ?

edit retag close merge delete

Also take a look at the cache of PackageKit (/var/cache/PackageKit). That can easily go > 1GB.

( 2017-03-01 07:43:59 -0600 )edit

Sort by » oldest newest most voted

Use vgdisplay for getting Volume Group name, i.e. fedora. lvdisplay will tell you wich Logical Volume your root is in. You need to add a partition for your free space, use fdisk -l to find your hd device name, usually /dev/sda, then fdisk /dev/sda for adding a partition. Now you create a Physical Volume with pvcreate /dev/sda3 (replace /dev/sda3 with the partition you already made). After that add the new Physical Volume to your Volume Group with vgextend /dev/<VGNAME> /dev/sda3 (again replace the names with the actual names for your system). Not done yet, you have to extend the Logical Volume where your root filesystem resides: lvextend -L +10G /dev/<VGNAME/<LVNAME>. You can now extend the EXT4 root filesystem with resize2fs /dev/<VGNAME/<LVNAME> (it can be done even if the filesystem is mounted). Backing up your important data is advised when fiddling with partitions/filesystems, check yourself if you can achieve the same result using a GUI tool like gparted, kde-partitionmanager or similar software if you prefer doing it that way.

more

I did this via terminal and using the commands suggested and it worked like a dream..THANK YOU And I would just like to say, Brilliant reply..perfect Answer to a problem i expect a few will have at some point or another ;-)

( 2017-03-01 11:17:41 -0600 )edit

It is generally safe to delete .log files (Just do not delete the /var/log directory itself and its subdirectories), the only disadvantage of doing so is that if a problem arises later you will not be able to examine the log.

more

Thanks for thta..Maybe if I just VI the log ( name not extension ) file and just delete all the entries...that should reduce the file size yes ?

( 2017-03-01 05:30:12 -0600 )edit

I think so, you should try with one file.

( 2017-03-01 05:43:47 -0600 )edit

I'd try sudo dnf clean all first. If you chose LVM on installation it's very easy to add free space to your root file system, another option would be creating a file system on the free space and mounting /var there.

more

It did try dnf clean all and it made no difference sadly

As for the LVM - Any hints on how to add that free space there please ?

( 2017-03-01 05:32:04 -0600 )edit