This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Sparse files?


OK.  Then there must be a problem in the way cygwin creates sparse files,
since the files created by seeking past the end in cygwin always take up the
full amount of disk space.  I've verified this with both Windows and cygwin
tools.  I'll try taking it up on the cygwin list to see what I can learn.  I
would like to understand why dd works perfectly for creating sparse files
under unix, but not under cygwin.

$ df .
Filesystem           1k-blocks      Used Available Use% Mounted on
q:                    42756964  17119760  25637204  41% /cygdrive/q

$ dd if=/dev/zero bs=1k of=foo seek=25637204 count=0
0+0 records in
0+0 records out

$ df .
Filesystem           1k-blocks      Used Available Use% Mounted on
q:                    42756964  42756964         0 100% /cygdrive/q

I have figured a workaround for this problem, which is if I have a sparse
file, I can then successfully truncate it to the desired size with dd.  The
initial sparse file can be created under Linux where dd works correctly for
creating sparse files.

docbill@docbill002 /cygdrive/q
$ tar xSjf sparse.tar.bz2 huge

docbill@docbill002 /cygdrive/q
$ dd if=/dev/zero of=huge bs=4M seek=1024 count=0
0+0 records in
0+0 records out

docbill@docbill002 /cygdrive/q
$ df .
Filesystem           1k-blocks      Used Available Use% Mounted on
q:                    42756964  15777568  26979396  37% /cygdrive/q

                     Bill

----- Original Message ----- 
From: "Brian Dunford-Shore" <bhds@earthlink.net>
To: <colinux-devel@lists.sourceforge.net>
Sent: Thursday, May 13, 2004 1:02 AM
Subject: Re: [coLinux-devel] Re: Installer for CoLinux


> > Do you really save any filesystem space with NTFS?
> >
> > Certainly it is much faster to create a sparse file:
> >
> > i.e.
> > dd if=/dev/zero of=foo bs=4M seek=1024 count=0
> >
> > is much faster than
> >
> > dd if=/dev/zero of=foo bs=4M count=1024
> >
> > but either way Windows will still report the same amount of disk used
when
> > you are done.
> >
> > As I understand NTFS, it reserves the disk space used for filesystem
> > holes...  I do not believe VFAT supports file system holes at all.
> >
> >                                   Bill
> >
>
> If you do a right-click properties on a sparse file, it shows 'size' and
'size
> on disk'.  The 'size on disk' for a sparse file (just as for compressed
files)
> is the real amount of space that Windows uses and reserves.  I have put
sparse
> files on partitions where the 'size' is larger than the whole
partition--Windows
> is not reserving the disk space.  This is documented also on the articles
on the
> subject on MSDN.
>
> You are right about FAT, FAT32/VFAT--they don't support sparse files.  I
haven't
> heard if Microsoft's new file system will support sparse files.
>
> Brian Dunford-Shore
> bhds@earthlink.net
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by: SourceForge.net Broadband
> Sign-up now for SourceForge Broadband and get the fastest
> 6.0/768 connection for only $19.95/mo for the first 3 months!
> http://ads.osdn.com/?ad_id=2562&alloc_id=6184&op=click
> _______________________________________________
> coLinux-devel mailing list
> coLinux-devel@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/colinux-devel
>



--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Problem reports:       http://cygwin.com/problems.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]