Page 1 of 1

UNIX sparse file

Posted: Wed May 22, 2013 3:03 pm
by cah
When rsyncing from laxm1711 to laxm1811, I found vertexTST file system on laxm1811 is 4 GB larger than on 1711.
After digging deeper, I found the following file that is worth checking:

Code: Select all

-rw-r----- 1 oratst dba 4294975488 May 17 22:00 /oracle/vertexTST/data/temp.data1

[root@laxm1711 data]# du -h temp.data1
984K    temp.data1
 
On the VM C460, it reports correctly:
 
[root@laxm1331 data]# du -h temp.data1
4.1G    temp.data1
Same file, same size from `ls -l` but `du` shows different size.

Later on, when checking with Carsten Clasohm (Redhat consultant), he thought it is a sparse file.
Hi Chang,

I guess that temp.data1 is a sparse file. You can check that as described on

http://en.wikipedia.org/wiki/Sparse_fil ... es_in_Unix

If you had used the "--sparse" option for rsync, it would consume the same amount of space on the target system.

Carsten
I checked with Mohan yesterday and he confirmed the app created the sparse file.

In order for rsync to copy sparse files, I have to add a flag of "-S or --sparse" according to man page.

Code: Select all

        -S, --sparse                handle sparse files efficiently
Lesson learned!