18

I deleted a large file (6 GB) located in my home directory but the free space is not increased.

I have tried looking the file in trash folder by typing cd ~/.local/share/Trash/files but it's not listed there. I have tried running sudo apt-get clean but the problem isn't solved. I have also tried sudo lsof +L1 to see if any other process are using it but it's not showing up there either.

Anyone have any suggestions?

Eliah Kagan
  • 117,780
  • What is the file named? Can you run sudo fdisk -l? – nanofarad Oct 24 '12 at 19:26
  • You can run df -lh to see a list of your partitions including the free space. Even if the file is hidden (starts with a dot .), you should see it in the Nautilus Trash (also called Rubbish Bin). – rosch Oct 24 '12 at 19:41
  • 1
    @ObsessiveSSOℲ: file is named output.file located in home directory. "fdisk -l" just gives the start and end Blocks of each partition. I don't know what to do with this data. – Gaurav Mittal Oct 25 '12 at 10:02
  • @rosch: file was not hidden(name wasn't started with a dot) – Gaurav Mittal Oct 25 '12 at 10:06
  • You may be trying to free space on the wrong partition. fdisk will tell me what partition is the one in question/ – nanofarad Oct 25 '12 at 10:35

2 Answers2

20

The file is still in use by one (or more) process(es). The space occupied by the file will only be released if no processes have the file open.

This is a common gotcha with log files that are filling up a filesystem, when the administrator forgets to restart the accompanying process.

You can check this with lsof | grep DEL

jippie
  • 5,683
  • Thanks for your reply I don't think that the file was being used by any other process at that time. It was a binary file created using "truncate -s 10M output.file" just to meet the minimum sharing required to use DC++ :). – Gaurav Mittal Oct 25 '12 at 10:07
  • So is your question wrong then? You did not delete the file yet and after deleting you saw the free space? – rosch Oct 25 '12 at 12:10
  • @rosch: I deleted the file and after that I saw the space. Why else would I be asking question otherwise ? – Gaurav Mittal Oct 25 '12 at 17:19
  • 1
    Well your question is saying the opposite.."deleting a file does not free up space". So I suggest to rephrase it, or even delete it. I am thinking about people reading the question later on. – rosch Oct 25 '12 at 20:44
4

I have resolved this by the following steps

#lsof +L1

Which will show the list of files that holding memory with deleted quote.

Note the pid ( Process id ) of the file

Kill the process

#kill <pid>

The memory will be released by the process

Check it by command

#df -h
  • saved my day, suprised that no one upvoted this answer. – Bloodmoon Jan 07 '20 at 12:46
  • you can check here too in this link I have explained more in detail in my answer for same scenario @Bloodmoon https://stackoverflow.com/questions/332629/rm-not-freeing-diskspace/48945282#48945282 – Javeed Shakeel Jan 07 '20 at 13:41