sparse files

Mike Reinehr cmr
Tue May 24 16:11:03 PDT 2005


On Tuesday 24 May 2005 01:20 am, Roger Oberholtzer wrote:
> On Sat, 2005-05-21 at 12:37 +0800, Man-wai Chang wrote:
> > > Next I wanted to copy the image to another computer. So, I thought I
> > > would use tar's --sparse option to make a file to copy, and then untar
> > > it and have the sparse file on the other computer. Nope. The untarred
> > > file stops at 2GB. So, I thought I had some file size limit. So, I
> > > tried
> >
> > What file system does your target system use?
>
> Same as the source - ext3.
>
> The sparse file is not re-created correctly on the same system the
> original sparse file exists. The odd thing is that if the original
> sparse file contains, say, 500MB of actual content in a 6GB sparse file,
> the recreated sparse file is always 2 GB. Could it be that there is a
> 2GB limit on the ext3 file system that does not apply to sparse files? I
> wonder what would happen if I tried to fill the sparse file with more
> than 2GB of content. I also need to check if the file created by tar is
> really sparse. Anyone know how to fine how much space is really used in
> a sparse file?
>
> What confuses me is that all the discussions of this are joyous about
> how well tar does this. Many predate the newer file systems, so I guess
> they are for ext2/3 file systems. Sadly they seldom tell.
>
> I will experiment a bit more.

Roger,

I have no direct experience with sparse files, so this may just be a waste of 
your time, but this afternoon I was reading up on an unrelated problem & came 
across this little tidbit:

> The linux 2.2 kernel does not support files larger than 2 GB, so the size of 
your image must not exceed this limit. You can solve this problem using the 
2.4 kernel, which doesn't have this limitation. You can also split your image 
into small files (of 1,9 GB for example). You also require a recent glibc 
version: 2.2 or newer

which made me wonder if some applications like tar may still retain a file 
size limit even though it no longer is true. So, I started reading the info 
documentation for tar on my Debian system. I haven't found anything so far 
about file size limits but I did find this:

> `tar' ignores the `--sparse' (`-S') option when reading an archive.

All of the information regarding sparse files pertained to creating the 
archive. I got the distinct impression that tar makes no effort to recreate 
the sparse file in it's original form.

I'm wondering now, if the answer to your problem is to use a tool such as gzip 
or bzip2 to create a compressed archive of your qemu file, rather than tar.

HTH's!

cmr
-- 
Debian 'Sarge': Registered Linux User #241964

"More laws, less justice." -- Marcus Tullius Ciceroca, 42 BC


More information about the Linux-users mailing list