Online Expert Day - HPE Data Storage - Live Now
April 24/25 - Online Expert Day - HPE Data Storage - Live Now
Read more
System Administration
cancel
Showing results for 
Search instead for 
Did you mean: 

Filesystem free space is not releasing completly

joseph51
Regular Advisor

Filesystem free space is not releasing completly

Hi,

I would like to know why the Filesystem free space is not completely releasing even if we remove all the data in that Filesystme ,as shown below I have removed all the data in the directory /oracle/IF1/sapdata1 still the used is showing around 1.3 GB Also the %used =0
After Emptying the FS
================
root@s96cof21:/oracle/IF1/sapdata2 : bdf |grep sapd
/dev/vgsapif1/lvsapdata1IF1
1897922560 1360039 1778027507 0% /oracle/IF1/sapdata1
/dev/vgsapif1/lvsapdata2IF1
1987510272 503740 1862818759 0% /oracle/IF1/sapdata2
root@s96cof21:/oracle/IF1/sapdata2 :

Before Emptying the FS
=================

/dev/vgsapif1/lvsapdata1IF1
1897922560 1714122383 172312774 91% /oracle/IF1/sapdata1
/dev/vgsapif1/lvsapdata2IF1
1987510272 1716805068 253786233 87% /oracle/IF1/sapdata2

===================

Can any one Please tell me what is the logic behind this or why this is not releasing the complete space .And if any data is using this space how can we find out this
19 REPLIES
Kenan Erdey
Honored Contributor

Re: Filesystem free space is not releasing completly

Hi,

possibly you deleted opened files with other processes. check them with lsof +aL1 /oracle/IF1/sapdata2. find processes ids and if possible kill them

Computers have lots of memory but no imagination
joseph51
Regular Advisor

Re: Filesystem free space is not releasing completly

Hi,
Before deleting the data I have shutdown the DB then fuser . And confirmed that no process is using this directory . after that only I cleared the data .
Now the restoration of DB is done to this directory . So I cannot check this with the command you given
James R. Ferguson
Acclaimed Contributor

Re: Filesystem free space is not releasing completly

Hi:

Disk blocks belonging to a file will not be released until the last process using the file terminates. This is normal UNIX behavior.

This is actually very handy. It is common to open a temporary file and immediately unlink(2) it. The 'unlink' system call is deployed when you do a 'rm' in a shell.

In so doing the above, only the process creating the temporary file has visibility to it thereby providing heightened security if necessary.

In addition, the technique of opening (creating) and immediately unlinking (removing) a file means that a process's cleanup code (either as an epilog procedure or as a signal trap block) doesn't have to bother with removing the temporary file.

Regards!

...JRF...
joseph51
Regular Advisor

Re: Filesystem free space is not releasing completly

Hi , I have one more doubt .

If we calculate the used size and available size of spdata1 FS it will be around 1696GB
and If we substract the total size from this we are getting a difference of 113GB .
I would like to know where this 113GB gone
Please some one clarify this doubts
James R. Ferguson
Acclaimed Contributor

Re: Filesystem free space is not releasing completly

Hi (again) Binu:

> If we calculate the used size and available size of spdata1 FS it will be around 1696GB

How do you "calculate"; what tools?

Regards!

...JRF...
joseph51
Regular Advisor

Re: Filesystem free space is not releasing completly

Just added used (1360039)+ available (1778027507)= Its not equal to the total size . Its giving the value =1779387546 , which has the difference of 113 GB from the Total space assigned
James R. Ferguson
Acclaimed Contributor

Re: Filesystem free space is not releasing completly

Hi (again) Binu:

The presence 'sparse' files will cause 'bdf' to report a value that reflects what the "inflated" sparse file would be (use), whereas 'du' will report only the actual, allocated blocks.

Since these are Oracle filesystems, it is highly likely that you have such sparse files present. Compare your calculations using 'du' and using 'bdf'. Large discrepancies between what the two methods yield suggest the presence of a sparse file.

Regards!

...JRF...
Dennis Handly
Acclaimed Contributor

Re: Filesystem free space is not releasing completly

>if we remove all the data in that filesystem

(More accurately, you delete files, not remove data.)

>JRF: The presence 'sparse' files will cause 'bdf' to report a value that reflects what the "inflated" sparse file would be (use)

Huh? Only ll(1) does that. bdf(1) works correctly.

>Compare your calculations using 'du' and using 'bdf'.

The difference between these is unlinked files, not sparse files.
James R. Ferguson
Acclaimed Contributor

Re: Filesystem free space is not releasing completly

Hi (again):

> ME: Compare your calculations using 'du' and using 'bdf'.

> Dennis: The difference between these is unlinked files, not sparse files.

Yes, indeed. I was thinking that Binu might have summed sizes using 'ls' and thus with sparse files, the 'ls' summation value would be larger than that of 'bdf'. I mangled my second post's point :-(

Regards!

...JRF...
joseph51
Regular Advisor

Re: Filesystem free space is not releasing completly

the ouput I have pasted is after clearing the FS , and I am sure that no process was using this direcory ,again I unmounted the FS then just did a fsck -F vxfs -o full,nolog . after that I mouted it back . Now now any way there will not be aby process using this ..And One more interesting thing is that when I restored data which is greated than the total available size as per the bdf output , I could do it successfully . and Now its showing the total usage of 95% only . Why this kind of behaviour .
James R. Ferguson
Acclaimed Contributor

Re: Filesystem free space is not releasing completly

Hi (again):

> And One more interesting thing is that when I restored data which is greated than the total available size as per the bdf output , I could do it successfully . and Now its showing the total usage of 95% only . Why this kind of behaviour .

As usual, if you told us *how* [ what tool ] you used to "restore" [ copy ] the data we might be able to enlighten you.

Regards!

...JRF...
Bill Hassell
Honored Contributor

Re: Filesystem free space is not releasing completly

When you copy files and directories to a new location (or restore them from a backup image), there will be very little possibility that the occupied space will be the same. Consider a directory that had 5 million files in it. All the files were removed so the directory is empty. HOWEVER, the space needed to remember all those file names in the directory is NOT reduce. There are a million free entries in the directory that can be used. When this directory is created at the new location, it has no entries and will be significantly smaller in terms of occupied space at the target.

Conversely, a 'sparse' file has very large pieces of undefined space between records. A program writes record 1 then lseeks to record 1000000000 and writes one more record. The file occupies very little space. But when it is copied, the file is read sequentially. Since there is no way to inform the copy program that these records are undefined, a stream of zeros (nulls) is supplied and not the destination copy of the file is one million times larger than the original file. Sparse files are very common in database programs.

So to verify that a copy is correct, you count the number of files and directories. And if you are very paranoid, then run a cksum on every file and compare the values with the original files. Note that cksum will produce identical values with a sparse file and the copy.


Bill Hassell, sysadmin
Michael Steele_2
Honored Contributor

Re: Filesystem free space is not releasing completly

"..t when I restored data which is greated than the total available size as per the bdf output , I could do it successfully . and Now its showing the total usage of 95% only . Why this kind of behaviour .."

It more reliable to compare inodes than bytes for the reasons explained to you above: Bytes are written into 1024 KB blocks. They are not contiguously written like you would write onto tape.

If you copy 10 GB from filesystem A to B, then the bdf in bytes will be wrong. However, the "...bdf -i.., or df -i..." report on inodes will always be exactly the same.

bdf -i
df -i
Support Fatherhood - Stop Family Law
Vivek_Pendse
Valued Contributor

Re: Filesystem free space is not releasing completly

Try the "sync" command after file(s) deletion.
Some times, to clear off the consumed space from file system requires time. Use debugger to drill down.

Thanks,
Vivek
Michael Steele_2
Honored Contributor

Re: Filesystem free space is not releasing completly

the sync command automatically executes every 30 seconds. Unless that's changed. I haven't looked up the execution time interval for awhile, but it was always 30 seconds.
Support Fatherhood - Stop Family Law
Dennis Handly
Acclaimed Contributor

Re: Filesystem free space is not releasing completly

>Vivek: Some times, to clear off the consumed space from file system requires time.

Yes, I've seen that.

>Use debugger to drill down.

What debugger on what program or the kernel?
Vivek_Pendse
Valued Contributor

Re: Filesystem free space is not releasing completly

Hi Dennis,

I was talking about fsdb.

Thanks,
Vivek
MJCMarx
Occasional Visitor

Re: Filesystem free space is not releasing completly

Thx for this, my issue was resovled as a result of this forum. After killing the process the usage went down to 0% as ecxpected.

chindi
Respected Contributor

Re: Filesystem free space is not releasing completly

I hope this is HP-UX  only.

Is it 11iv2 or v3 ?

Would like to know filesystem version , fstyp -v

If you are unable to trace 113gb file , can you create the same using "prealloc" command and then just "rm" it and see if the space gets released .

Let me whether you have online JFS installed or not ??