file size on disk vs used drastically different

der.hans PLUGd at LuftHans.com
Thu Apr 15 11:08:26 MST 2010


Am 15. Apr, 2010 schwätzte Shawn Badger so:

> I came across a weird problem this morning. What would cause a file to be
> reported as 251M for used space and 1.3G for size on disk?
>
> [root at cc1lnx5 axprac]# ls -sh cafrap_1.dbf; ls -lh cafrap_1.dbf
> *251M* cafrap_1.dbf
> -rw-r----- 1 oraxprac axprac *1.3G* Apr 15 09:47 cafrap_1.dbf
> [root at cc1lnx5 axprac]#

A bunch of nulls.

Essentially, the file has allocated 1.3GB of space, but since a bunch of
what it's storing are nulls the filesystem cheats and doesn't use space
for them.

That space can expand out during backups and other operations, so be
careful copying it around.

> I have seen this to a smaller extent with some files but never a variance of
> this size.
> This file happens to be an Oracle 11G database table file.

I believe Oracle allots a configured amount of space for DB tables. The
space alloted but not used should be nulls.

$ qemu-img create /tmp/Beispiel.img 10G
Formatting '/tmp/Beispiel.img', fmt=raw size=10737418240

$ ls -sh /tmp/Beispiel.img ; ls -lh /tmp/Beispiel.img 
0 /tmp/Beispiel.img
-rw-r--r-- 1 lufthans lufthans 10G 2010-04-15 11:06 /tmp/Beispiel.img

It is to filesystem allocation what ticket overselling is to airlines :).

ciao,

der.hans
-- 
#  http://www.LuftHans.com/Classes        http://www.TwoGeekTechs.com/
#  Director of Engineering, FonWallet Transaction Solutions, Inc.
#  "Printing and publishing has been a big industry in the city since the
#  early 1800s, when New York publishers were the first American printers
#  with access to pirated English best sellers."
#  -- New York Magazine, 2007Jun04


More information about the PLUG-discuss mailing list