Discussion Locked

file deletion

0 helpful
12 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.
i have deleted a file in a unix system, but the system has not reclaimed the space. What steps are needed to reclaim the space? sorry but i am not unix savy

12 replies

by timthetoolman

Hi,

You probably deleted a link to a file rather than the file itself. Now that the link is gone, you probably wont know where the file was... Search the disk for the file again.

Cheers,
Tim.

by cpfeiffe

In many flavors of Unix deleting a link deletes the original file. Using unlink will remove just the link and then the original file and space will still exist. What kind of file was this? If it was a database file, then the database may have a hold on the space and you will have to reconfigure the database to reclaim the space. Many different databases work this way.

by shanghai sam

Another possibility is that some process has that file open. For instance, a license daemon may open a log file and then you delete the log file but do not restart the license process. The directory entry for that log file will be deleted but the actual file will not be deleted until all processes that have that file open are gone (reboot?). On solaris, the utility /usr/sbin/fuser can show which process have files open for a particular mount point.

by bgjkl

If the file belongs to a database, shutting down and restarting the database will usually free the space.

Sometimes also, a process will have a hold on the filespace and not release it. I saw another partial answer above, but to elaborate:

1)Shutdown any application that is using the filesystem that contains the deleted file

2) unmount (umount or unmount depending on UNIX flavor) then remount the filesystem....the space should be released. (make sure that you 'cd' out of the filesystem mount point before trying to unmount, or the unmount will not work).

3) If filesystem will not umount, issue
fuser -k -u /filesystem/name
(this will kill any process holding the fs. This is generic UNIX and should work for all flavors..).

4) Remount the filesystem and space should be back..

5) On rare occasions, the space may not come back, because a 'shadow' process is holding the file. A shadow process is not running, but is still residing in memory somewhere. In this case the best thing to do is to re-boot the box to clear.

by bgjkl

If the file belongs to a database, shutting down and restarting the database will usually free the space.

Sometimes also, a process will have a hold on the filespace and not release it. I saw another partial answer above, but to elaborate:

1)Shutdown any application that is using the filesystem that contains the deleted file

2) unmount (umount or unmount depending on UNIX flavor) then remount the filesystem....the space should be released. (make sure that you 'cd' out of the filesystem mount point before trying to unmount, or the unmount will not work).

3) If filesystem will not umount, issue
fuser -k -u /filesystem/name
(this will kill any process holding the fs. This is generic UNIX and should work for all flavors..).

4) Remount the filesystem and space should be back..

5) On rare occasions, the space may not come back, because a 'shadow' process is holding the file. A shadow process is not running, but is still residing in memory somewhere. In this case the best thing to do is to re-boot the box to clear.

by bgjkl

If the file belongs to a database, shutting down and restarting the database will usually free the space.

Sometimes also, a process will have a hold on the filespace and not release it. I saw another partial answer above, but to elaborate:

1)Shutdown any application that is using the filesystem that contains the deleted file

2) unmount (umount or unmount depending on UNIX flavor) then remount the filesystem....the space should be released. (make sure that you 'cd' out of the filesystem mount point before trying to unmount, or the unmount will not work).

3) If filesystem will not umount, issue
fuser -k -u /filesystem/name
(this will kill any process holding the fs. This is generic UNIX and should work for all flavors..).

4) Remount the filesystem and space should be back..

5) On rare occasions, the space may not come back, because a 'shadow' process is holding the file. A shadow process is not running, but is still residing in memory somewhere. In this case the best thing to do is to re-boot the box to clear.

This discussion is closed to new replies.