When the drive of an Ubuntu 20.04 server is full, how can we find out the directories/files with the largest sizes, ranked from largest to smallest? This can allow me to find some files to delete (likely log files)
Tried installing ncdu
but theres insufficient space
# sudo apt install ncdu
Reading package lists... Error!
E: Write error - write (28: No space left on device)
E: Write error - write (28: No space left on device)
E: The package lists or status file could not be parsed or opened.
Tried du
with sort
but it cant run with no disk space left.
# du --max-depth=7 /* | sort -n
sort: write failed: /tmp/sort5SKbZn: No space left on device
df -h
Output:
# df -h
Filesystem Size Used Avail Use% Mounted on
udev 474M 0 474M 0% /dev
tmpfs 99M 11M 88M 12% /run
/dev/vda1 25G 25G 0 100% /
tmpfs 491M 40K 491M 1% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 491M 0 491M 0% /sys/fs/cgroup
/dev/loop0 56M 56M 0 100% /snap/core18/2066
/dev/loop2 68M 68M 0 100% /snap/lxd/20326
/dev/vda15 105M 7.9M 97M 8% /boot/efi
tmpfs 99M 0 99M 0% /run/user/0
overlay 25G 25G 0 100% /var/lib/docker/overlay2/183819e24cd73185c27ef0af229e31e909f4af51dd7a4e0178eeab68a2f924e1/merged
/dev/loop3 33M 33M 0 100% /snap/snapd/12398
/dev/loop4 56M 56M 0 100% /snap/core18/2074
shm 64M 16K 64M 1% /var/lib/docker/containers/fdcf13f925676b32eaac67a55ff245d4ed7f0c91c78db26169106af56b15e77f/mounts/shm
/dev/loop5 71M 71M 0 100% /snap/lxd/21029
/dev/loop6 33M 33M 0 100% /snap/snapd/12704