3

I deleted a file about 200 GB big, but it still seems as the space is reserved for some reason.  I tried clearing it with a bunch of commands I found, but nothing worked for me (for files being kept in cache since they are still opened by some application).  I also rebooted a bunch of times, but nothing worked.

The parent folder still has the original size, but it seems the subfolders are all the right size.

I hope someone has an idea why it’s still reserved or how I can get rid of it.

du output:

# du  -sh /home/vincent/
200G    /home/vincent/
# du -bsh /home/vincent/*
14K     /home/vincent/Desktop
8.2G    /home/vincent/Documents
3.8G    /home/vincent/Downloads
11K     /home/vincent/java_error_in_PHPSTORM_3425.log
1.8K    /home/vincent/java_error_in_PHPSTORM_6837.log
1.8K    /home/vincent/java_error_in_WEBIDE_3683.log
4.0K    /home/vincent/Music
0       /home/vincent/myCA.key
4.0K    /home/vincent/Pictures
39      /home/vincent/PlayOnLinux's virtual drives
8.0K    /home/vincent/Postman
4.0K    /home/vincent/Public
4.0K    /home/vincent/Templates
4.0K    /home/vincent/Videos

[Transcribed from screenshot.]

3 Answers3

6
  • If you didn't reboot : You should probably use : lsof -a +L1 can help you find out which deleted (rm'd) files still have opened "file handles" (ie, some program still points to it and thus the file itself is not deleted yet from the filesystem, even though its last name entry has been deleted by rm). The offset will hint at the largest files amongst them. If you see one that seems to fit the bill: you should cleanly kill (not kill -9 pid, try just kill pid) the corresponding application and it should release that file handle, and the file should be reclaimed.

  • however you state that you rebooted: you may have hidden files somewhere underneath your home directory. You could try: find /home/vincent/ -size +1G -ls to get a view of files larger than 1G under /home/vincent directory

  • And please note: your invotation with a * of du, ie du ... * will only do du on files that do not start with a . (* will be expanded by your shell to all files and directories that do not start with a .). So it will not run on the "hidden files" of /home/vincent). The printf I give above should ignore this (unless you have specific additionnal rights restrictions on them) and explore both shown and hidden directories and files. You can also re-run the find as root, by pre-pending it with sudo, and see if, when launched as root, it shows more things: sudo find /home/vincent/ -size +1G -ls

  • lastly, if you deleted using a recent graphical interface: you may need to empty a "trashcan" to really free the space. (and that trashcan could live underneath your home directory as a ".something" directory, explaining why your home is still as big, and why your du ... * didn't see it)

Kusalananda
  • 333,661
3

Find the file with this command line (it searches and prints the names of files whose size is greater than 180GiB):

$ find /home/vincent -size +180G

That might return more than one file.

Then you can remove that. It is probably inside a trash folder.

1

The most likely reason that the space wasn't feed up is because you have an open file handle. The space will only be freed up when nothing is holding the file open. So restart the app the file belonged to and the space will probably become available.

Run lsof to see open files. There is a post on removing files which haven't freed their space

You can also write nothing into the file before deleting it. eg > /path/to/file or echo "" >/path/to/file note the single > which writes from the start of the file instead of appending (>>) to the end.

Timothy c
  • 191