SUMMARY: copied files is bigger than source.

From: Abu Ihsan (ihsannm@yahoo.com)
Date: Tue Mar 14 2000 - 03:04:01 CST


Hi Managers,
Firstly, forgive me for not putting anything at the
subject and for this late reply.

The reason of diffecrences on du result was due the so
called "sparce file" which contains holes.
The rdist and default sun's tar will copy all the
"zeros" in sparce file to the destination.(As what I
did before). See Brett Lymn explaination below.
The solution is, as msntioned by most of the replies
are to either use dump or gnu tar or use a script to
open each database file and then write them to
destination.
I chosed gnu tar because, using dump requires me to
use rsh which will take longer time compare to using
gnu tar with nfs mount. So as using script to open and
then write them back to destination.
But remember, if with gnu tar, we need to specify -S
option so that it handles sparse files smartly as what
dump does.
What I did was :
(At oldserv, export /a with anon=0 to avoid read error
on certain files since root will be treated as nobody)
At newserv,
#mount oldserv:/a /a
#cd /a
#gnutar -Scpf - . | (cd /dest; gnutar -Sxpvf -)
(I'd rename the gnu tar as gnutar)

Thanks to the entire list. I received many replies,too
many to mention here. I just thank the entire list.

--Abu Ihsan

Explaination from brett lymn regarding sparce file :

" Use dump and restore to copy the files. What you
are seeing is files that have "holes" in them. These
files are used a lot by the DB code, what they do is
open the file then seek to the right spot and write a
block. This "preallocates" the file size but does not
allocate all the blocks for the file. When you read a
"holey" file all the holes will be read as zeros, so
when you cp or tar the file to the new place the holes
will be filled in with zeros resulting in more disk
space
being used. Dump, on the other hand, knows how to
handle "holey" files and only copies the allocated
blocks so your disk usage does not go up."

----------- Original Question -----------------
Hi,

I tried copying some data from a sunos4.1.4 system
to a solaris 2.6 system. I did a nfs mount and then
did a rdist locally (rdist -bc . localhost:/home)to
copy the files. I did try using tar but the result
was almost the same - the destination files reported
by du has been doubled or bigger. But, ls -l shows
same
size. I found that this happened to the database files
but not the others. Is there a special way needed to
copy database files ?
Please refer to below result of doing du and ls -l to
one of the file.
Any advice or hint is greatly appreciated.

thanks,
--Abu Ihsan

du and ls -l result for oldserv (source machine, sunos
4.1.4) and newserv (destination machine, solaris 2.6).

oldserv% du -s DB26.pag
20080 DB26.pag
oldserv% ls -l DB26.pag
-rw-r--r-- 1 abu 244124672 Mar 1 01:40 DB26.pag
oldserv% du -s DB26.dir
32 DB26.dir
oldserv% ls -l DB26.dir
-rw-r--r-- 1 abu 32768 Mar 1 01:23 DB26.dir
oldserv%

newserv# du -ks DB26.pag
238536 DB26.pag
newserv# ls -l DB26.pag
-rw-r--r-- 1 abu staff 244124672 Mar 1 01:40
DB26.pag
newjaring# du -sk DB26.dir
32 DB26.dir
newserv# ls -l DB26.dir
-rw-r--r-- 1 abu staff 32768 Mar 1 01:23
DB26.dir
newserv#
__________________________________________________
__________________________________________________
Do You Yahoo!?
Talk to your friends online with Yahoo! Messenger.
http://im.yahoo.com



This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:14:04 CDT