In addition to the above, files that are open(2)
ed for write will take up diskspace. I use bigopenfiles
to see them.
alias bigopenfiles='sudo lsof / | awk '\''{if($7 > 1048576) print $7/1048576 "MB" " " $9 }'\'' | sort -n -u'
Other "invisible" files are those which programs open(2) O_TMPFILE
option, or have been opened and unlink(2)
ed.
alias deletedfiles='sudo lsof / | egrep '\''PID|\(deleted\)'\'''
For example,
walt@bat:~(0)$ bigopenfiles
lsof: WARNING: can't stat() fuse.gvfsd-fuse file system /run/user/1000/gvfs
Output information may be incomplete.
0MB NAME
1.03851MB /lib/x86_64-linux-gnu/libm-2.23.so
1.05076MB /usr/lib/firefox/browser/features/screenshots@mozilla.org.xpi
1.06348MB /lib/x86_64-linux-gnu/libglib-2.0.so.0.4800.2
1.07173MB /usr/lib/x86_64-linux-gnu/libcairo.so.2.11400.6
1.07496MB /usr/lib/x86_64-linux-gnu/libexempi.so.3.2.4
1.08072MB /usr/lib/x86_64-linux-gnu/libunistring.so.0.1.2
1.0952MB /usr/lib/evolution/libevolution-calendar.so.0.0.0
1.10789MB /usr/lib/x86_64-linux-gnu/libcamel-1.2.so.54.0.0
1.11092MB /usr/lib/x86_64-linux-gnu/indicator-datetime/indicator-datetime-service
1.11611MB /usr/lib/x86_64-linux-gnu/libprotobuf.so.9.0.1
1.12474MB /usr/sbin/ModemManager
...
walt@bat:~(0)$ deletedfiles
lsof: WARNING: can't stat() fuse.gvfsd-fuse file system /run/user/1000/gvfs
Output information may be incomplete.
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
mysqld 2233 mysql 4u REG 8,5 0 651554 /tmp/ibjp8exA (deleted)
mysqld 2233 mysql 5u REG 8,5 0 651560 /tmp/ibaGTQ9E (deleted)
mysqld 2233 mysql 6u REG 8,5 0 651561 /tmp/ibzy9sMJ (deleted)
mysqld 2233 mysql 7u REG 8,5 0 651575 /tmp/ibeDES4S (deleted)
mysqld 2233 mysql 11u REG 8,5 0 651710 /tmp/ibZSq7P0 (deleted)
dropbox 6614 walt 7u REG 8,5 0 651721 /tmp/#651721 (deleted)
gnome-ter 7035 walt 18u REG 8,5 65536 655802 /tmp/#655802 (deleted)
sudo du -hca --time / | grep -E "^[0-9\.]*[G]"
. Read here for extra info: https://askubuntu.com/a/1167390/968501 – Raffa Oct 04 '19 at 02:11