3

I deleted an about 200GB big file 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 keept 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 its still reserved or how i can get rid of it.

Image of space

2
  • 1
    What filesystem are you using? Oct 19, 2020 at 20:32
  • 1
    How did you delete it?
    – roaima
    Oct 21, 2020 at 6:41

3 Answers 3

5
  • 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)

3

Find the file with this command line (it searches and prints the names of files whose size is 180G or more):

$ 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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.