0
Filesystem      Size  Used Avail Use% Mounted on
/dev/sda5        31G   28G  1.4G  96% /
none            4.0K     0  4.0K   0% /sys/fs/cgroup
udev            5.8G  4.0K  5.8G   1% /dev
tmpfs           1.2G  1.7M  1.2G   1% /run
none            5.0M     0  5.0M   0% /run/lock
none            5.9G  113M  5.8G   2% /run/shm
none            100M   60K  100M   1% /run/user
  • Size: 31G
  • User: 28G
  • Avail: 1.4G

If my math serves me correct, it's that slightly incorrect? I'm trying to free up some space!

You can ignore /opt and /home, they sit on their own partitions.

karl@karl-laptop:/$ sudo du -sh *
9.8M    bin
450M    boot
4.0K    cdrom
241M    data
4.0K    dev
81M etc
50G home
0   initrd.img
0   initrd.img.old
2.3G    lib
3.5M    lib32
4.0K    lib64
16K lost+found
12K media
4.0K    mnt
15G opt
du: cannot access ‘proc/9592/task/9592/fd/4’: No such file or directory
du: cannot access ‘proc/9592/task/9592/fdinfo/4’: No such file or directory
du: cannot access ‘proc/9592/fd/4’: No such file or directory
du: cannot access ‘proc/9592/fdinfo/4’: No such file or directory
0   proc
364M    root
du: cannot access ‘run/user/1000/gvfs’: Permission denied
3.6M    run
15M sbin
16G srv
0   sys
26M tmp
7.2G    usr
1.3G    var
0   vmlinuz
0   vmlinuz.old

1 Answers1

2

By default, 5% of the filesystem blocks will be reserved for the super-user, to avoid fragmentation and "allow root-owned daemons to continue to function correctly after non-privileged processes are prevented from writing to the filesystem" (from man mkfs.ext4).

https://wiki.archlinux.org/index.php/Ext4#Reserved_blocks

With that in mind, it adds up to 31GB (some rounding is taking place):

>>> 0.05 * 31
1.55
>>> 28 + 1.4 + 1.55
30.95

You can tune that value to be less than 5% (follow the aforementioned link), though that is not recommended in this case. To free up space consider apt-get clean (see the man page for details). Also, consider installing the software ncdu, which is like a du file browser in ncurses, where you can navigate through the filesystem and folders/files are ordered by the size they take up. Check out what libraries/binaries/docs are taking up the most space and uninstall them via apt-get purge <package>. First make sure you don't need them, of course: apt-cache rdepends --installed <package>. The later lists what packages depend on the one you intend to uinstall. Do not uninstall if you see something in there (unless there is some "circular" dependencies, i.e. call apt-cache ... again on the results if you think that might be the case).

You can also look for uninstalled packages of which config files etc were kept back: dpkg -l | grep ^rc. You can automatically purge them using some cut shenanigans: dpkg -l | grep ^rc | cut -d" " -f3 | perl -p -e 's/\n/ /g'

You can also safely remove old logs if that's taking up too much space.

Alex
  • 1,249