Operating System - HP-UX
1751840 Members
5278 Online
108782 Solutions
New Discussion юеВ

Re: How is it possible for a file larger than free space to exist?

 
SOLVED
Go to solution
Randy Hagedorn
Regular Advisor

How is it possible for a file larger than free space to exist?

Hi there,

I have a question of curiosity.

I am running an Oracle backup with RMAN to disk, which allocates a file that is initially equal to the file space of the datafiles being backed-up.

When I do an ll of the directory where the backup is being copied to, there is a file that is larger than the remaining free-space, as reported by bdf.

How is that possible?

# ll
total 14666692
-rw-rw---- 1 oracle dba 5388485632 Feb 10 11:02 b_6ofdo9ce_216_1
-rw-rw---- 1 oracle dba 328376320 Feb 10 11:08 b_6pfdodri_217_1
-rw-rw---- 1 oracle dba 330092544 Feb 10 11:13 b_6qfdoe5b_218_1
-rw-rw---- 1 oracle dba 330000384 Feb 10 11:17 b_6rfdoees_219_1
-rw-rw---- 1 oracle dba 322347008 Feb 10 11:22 b_6sfdoen6_220_1
-rw-rw---- 1 oracle dba 7485350912 Feb 10 15:52 b_6tfdou2i_221_1 <== file in question!


# bdf (shortened)
Filesystem kbytes used avail %used Mounted on
/dev/vg02/Group6 9252864 7433402 1762610 81% /u07

Thanks in advance,
Randy
6 REPLIES 6
Rodney Hills
Honored Contributor
Solution

Re: How is it possible for a file larger than free space to exist?

Two factors.

1) Some file systems reserve a portion for expansion that is not reported.

2) Some files have holes. You can define space for a file, but if it is not allocated it will not show up in bdf. An oracle DB may cause this situation.

HTH

-- Rod Hills
There be dragons...
Steven E. Protter
Exalted Contributor

Re: How is it possible for a file larger than free space to exist?

no

7485350912/1024 to get kb

kb is what is being displayed on bdf.

Taht file is attempting to use all remaining free space.

I would expect the rman backup to hang or crash

bytes/1024=kilobytes

SEP
Steven E Protter
Owner of ISN Corporation
http://isnamerica.com
http://hpuxconsulting.com
Sponsor: http://hpux.ws
Twitter: http://twitter.com/hpuxlinux
Founder http://newdatacloud.com
A. Clay Stephenson
Acclaimed Contributor

Re: How is it possible for a file larger than free space to exist?

Well, if I answer the question that you actually asked -- then, of course, that is possible. There was enough free space in the filesystem before the file was created.

This is the question that I think you meant to ask: Is is possible for the total of the file sizes reported by ll for an entire filesystem to exceed the size of the filesystem itself? If so, how?

Answer: Yes, absolutely. How: Sparse files.

Here is how you might create one:
fdes = open("/user",tmp1,O_CREAT | O_RDWR,0660);
char dummy = "X";
(void) write(fdes,(void *) &dummy,sizeof(dummy));
lseek(fdes,10000000L,0);
(void) write(fdes,(void *) &dummy,sizeof(dummy));
(void) close(fdes);

You created a file, write 1 byte, seeked to offset 10,000,000 and write 1 more byte.
The file's size as reported by ls -l will be 10,000,000 bytes although from the perspective of bdf only 2 blocks were used.
Sparse files are handy for preallocating large files but you do run the risk of "over subscribing" a filesystems ---- kinda like them there airlines.

If it ain't broke, I can fix that.
Dietmar Konermann
Honored Contributor

Re: How is it possible for a file larger than free space to exist?

Just a small example what "file that contains holes" aka "sparse file" means... on a largefile-enabled fs do this:

# echo | dd bs=1024k seek=10000 of=laaaarge

Then compare the results of "du -k laaaarge" and "ll laaaarge".


Best regards...
Dietmar.
"Logic is the beginning of wisdom; not the end." -- Spock (Star Trek VI: The Undiscovered Country)
Sridhar Bhaskarla
Honored Contributor

Re: How is it possible for a file larger than free space to exist?

Hi Randy,

Both the above replies are true. There is a little extra space not visible to us in a filesystem under minfree area reserved in the filesystem. So, you may be able to keep a file that's more than what appears in the 'bdf''s available column.

Also bdf is reported in KBs. So, the file you have is really of 7485350912/1024 = 7309913 which is less than the available space you have in the 'bdf' output.

-Sri
You may be disappointed if you fail, but you are doomed if you don't try
Michael Schulte zur Sur
Honored Contributor

Re: How is it possible for a file larger than free space to exist?

Hi Randy,

could it be, that you are confusing used and free space?

The first plus the last file is clearly more than the file system will yield. :-( As SEP says, it will crash.

I know Oracle for this. Once I accidently tried to resize a file to 2tb instead of 2gb on a production machine, of course the file system was full. It showed 2tb although they weren't there.

Michael