Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 16 Jan 2013 16:19:56 -0500
From:      Fbsd8 <fbsd8@a1poweruser.com>
To:        FreeBSD questions <questions@freebsd.org>
Subject:   understanding sparse files
Message-ID:  <50F7197C.1060503@a1poweruser.com>

next in thread | raw e-mail | index | archive | help
I want to understand what is going on inside of sparse files.

I have a test case set up.

I have a small directory tree set up containing just the systems running 
libraries. The directory tree contains a copy of the following systems 
directories, /bin. /lib, /libexec, /sbin, and /usr which has a combined 
size of 195M. This directory tree is what gets copied into the sparse 
files I create.

Now I create a sparse file with a allocated file size of 300M and copy 
that 195M directory tree into it.
ls -lh shows 300M as the allocation size
du -h  shows 270M as the occupied size

I would expect the occupied size to be 195M, the size of the source 
loaded into that sparse file.


Now I reran the same test again changing only the allocation size to 1G.
ls -lh shows 1G as the allocation size
du -h  shows 463M as the occupied size

So my question is, why does the occupied size not match the real size of 
the data content in the sparse file?

Also why as the allocated space increases does the occupied size increase?





Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?50F7197C.1060503>