Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I'm telnetting into a Solaris 5.9 box that's supposed to store our oracle database. I deleted the old version of the database, tried to move in the new version (the entire database is 90GB) but I kept getting "disk is full" errors. I ran

df -hk

and found that the partition (called "/d02") I was trying to move files to had 135GB total, 123GB used, and 10GB available. However, when I run

ls -lah /d02

I get 4 directories: 3 of them are 512B and 1 is 8KB.

When I deleted the old oracle database, did the space somehow not get freed? How can I free up the space, or at least see how my space is being taken up?

Thanks for your time.

share|improve this question
add comment

3 Answers 3

I figured it out. I had to kill any processes that were holding on to that data--in this case Oracle.

Also I think I was supposed to post this to serverfault. Sorry!

share|improve this answer
    
In your defence, thanks for posting an answer to your question. Now you just need to accept it! :) –  user3463 Nov 12 '09 at 14:50
add comment

Yes, you discovered the root cause. On unix, removing a file removes the link from the access list in the directory. However, it may not remove the contents until the file handle is closed, which is associated with the file. This is a rather common issue, which is hard to track down, after the fact.

Once the file handle is closed, the data links can then be released to the free list, as you found out. Most likely, a log file was still open. You might have found some odd behaviour once the database restarted, as it's log location was missing, and it starts logging to the console or other strange places like /tmp.

share|improve this answer
add comment

+1 for @UnixGeek answer: deleting a file does not free up disk space until the process(es) with the file open are gone.

The "standard" tool to list open files is lsof -- I still don't think it's included with Solaris (it's been several years since I was a Solaris admin, or even used it), but is available from sunfreeware.

A quick google finds the Solaris utility pfiles can do something similar (but I haven't used it).

Also, fuser on the file name, but you need to check it before you delete the file(s). fuser is also useful for finding what has a port open, when a process tell's you it's already in use.

I will plug A Sysadmin's Unixersal Translator (ROSETTA STONE), a very useful guide for anyone using multiple Unices and translating between them.

Bonus trick for recovering deleted files in /proc-based systems which are still open by a process:

cat /proc/<pid>/fd/<fd-of-delete-file>  > recovered.data

I have used this in Linux, where ls -l /proc/<pid>/fd shows the initial file name (and [deleted]) in the output.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.