I accidentally filled up my hard drive and I cannot recover from it.
I've deleted several Gigabyte of files, but the df command still shows that the disk is full, and even a simple echo hello > aFile results in the error write error: No space left on disk. Here is the command output of the relevant line of df
Filesystem Size Used Avail Use% Mounted on /dev/mapper/mint--vg-root 441G 421G 0 100% / From reading other similar questions/answers, I'm aware that Linux does not delete files that are part of active processes, even if they disappear from the file system. Most accepted solutions involve restarting the process holding the file open or rebooting the computer. I've rebooted several times after deleting files and I still have the same issue. Using all the inodes can result in a similar error but my inode use is 18%.
I'm also aware that the system reserves space for the root user and that df does not report this accurately. In my case, the difference between disk size and used is 20G. I can write files as root, but I don't know how to make use of this fact.
In case it's relevant, my system is set up to use KDE on Linux Mint. I only have one LUKS-encrypted ext4 partition.
The disk space being full stops the X server starting as the system cannot write to a lock file so I end up having three options:
- log in via TTY1 into a terminal,
sudo startxwhich launches a Cinnamon graphical environment,- Boot a live CD/USB.
What should I do to recover my disk space?
e2fsck /dev/device, check again. Lastly, are you sure you're in the right directory? You could be trying to create a file in another directory which e.g. belongs to a full partition/mount point.startxrun as a normal user from TTY1 also cannot write to various files in /tmpfstrim? For example runfstrim -avand see if there will be a difference in sizetune2fs -m 0. alternatively set it to 1% instead of the default 5% to leave a (smaller) reserve for root. in the long term you'll just have to provide more storage space if you're that close to full capacity… that or usencduand similar to identify space hogs (log files, caches, ...)apt-get clean. Other distros will differ. Also, /var/cache and /var/log are good places to search for stuff that can be deleted. Also worth considering: switch to btrfs or zfs or some other fs with transparent compression.