Ubuntu – Which files should I remove from /var/log directory to free space in Ubuntu 16.04

16.04disk-usageloggingstorage

I have installed Ubuntu 16.04 two days ago on a 158GB HDD and it is already showing 128GB space is used. After checking the drive I've found that the directory /var/log is occupying 116GB and it is constantly expanding its size,

Size of different files in /var/log is :

  • syslog — 21GB
  • syslog1 — 36GB
  • kern.log — 57GB

Now I see this problem is faced by many Ubuntu users and there are different questions have already been asked 1, 2, 3 and 4. But I don't know which folder I should delete.

Furthermore, I am using HP Probook 440 G3.

Help in this regard is highly appreciated. Thanks!

Best Answer

You don't want to delete those files... yet. You need to review them to see what activity is occurring on your computer that causes the log files to get so large. In terminal, type more /var/log/syslog* or more /var/log/kern.log.

If the files are too large, or you have trouble interpreting what you're seeing, monitor them in real time... in terminal, use tail -f /var/log/syslog or tail -f /var/log/kern.log. You'll probably see one error that repeats itself over and over.

In reviewing the log files, you have a problem with your video subsystem. See Nvidia GeForce 930M driver and PCI bus error for a similar problem/fix. Also see https://h30434.www3.hp.com/t5/Notebook-Software-and-How-To-Questions/Error-Spam-AER-id-00e5-PCIe-Bus-Error-severity-Corrected/td-p/5933687 and https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1521173. Google "device id 8086:9d15" if you need more info yet.

In terminal...

  • gksudo gedit /etc/default/grub
  • add pci=nomsi OR pci=noaer (which ever one fixes your problem) to
    • GRUB_CMDLINE_LINUX_DEFAULT="quiet splash pci=nomsi"
    • or
    • GRUB_CMDLINE_LINUX_DEFAULT="quiet splash pci=noaer"
  • save and quit gedit
  • sudo update-grub
  • reboot