LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Space not freeing up after rm (https://www.linuxquestions.org/questions/linux-general-1/space-not-freeing-up-after-rm-761859/)

bryanvick 10-14-2009 10:27 AM

Space not freeing up after rm
 
I have a 500GB external HD mounted @ /media/backuphdd. I deleted everything on it with "sudo rm -rf /media/backuphdd/*".

df still shows 223GB being used:
Filesystem Size Used Avail Use% Mounted on
/dev/sdb1 451G 223G 205G 53% /media/backuphdd

du shows 68kb being used:
68K /media/backuphdd/

I have remounted, and rebooted. Why can't I reclaim this space?

Also, there is one tiny file on the hdd that I couldn't delete because of a "stale NFS file handle". I don't really care about that file, and am not looking for a solution to that problem, but I wanted to include that info for completeness.

It seems I am missing something pretty basic.

pljvaldez 10-14-2009 10:45 AM

Why not just reformat the drive?

bryanvick 10-14-2009 10:55 AM

I will eventually
 
That is what I will eventually do if I can't find a solution. But what if I was not trying to delete everything, just a couple large files. I wouldn't turn to reformatting as a solution because I have a bunch of other files on the drive that I want.

I could have reformatted by now, but it really bugs me that something as simple as rm -rf * is not removing all the files. There absolutely has to be a solution to this other than reformatting. rm is so fundamental.

Guttorm 10-14-2009 11:03 AM

Hi

The disk space is not free unless all programs with open files on the disk close them. If you're using NFS maybe that's the problem? If not, lsof can identify which program. I would try unmount and mount again.

bryanvick 10-14-2009 11:27 AM

I have run lsof, unmount/remount + reboot multiple times. Not working. Output of lsof /media/backuphdd = Nothing.

tredegar 10-14-2009 12:31 PM

There could be filesystem corruption. Maybe it's time to run fsck on your unmounted external HD ?

bryanvick 10-14-2009 04:01 PM

Corrupted
 
It was corrupted. I ran fsck to fix everything and when it was done I had a lost+found folder full of 250GB of stuff. Deleted it and df was reporting the correct usage of 0%. Thanks for the help.

tredegar 10-14-2009 04:22 PM

Pleased that that is sorted now.

In future, remember that removable devices need to be unmounted before you unplug them (I believe it is the same with the win OS also).

Quakeboy02 10-14-2009 04:40 PM

Are you just hitting the power button to shut it off, or smashing reset to boot to Windows, or are you going through a Linux power down cycle? I ask, because the last time I saw that much corruption was due to not shutting down properly.


All times are GMT -5. The time now is 06:42 PM.