[ale] making empty files (sparse files, or how to put a 1TBfile on a 6GB HDD with only 180M free)

Mike Panetta ahuitzot at mindspring.com
Tue Mar 18 22:35:37 EST 2003


Here is something even cooler:

[mike at localhost mike]$ df
Filesystem           1k-blocks      Used Available Use% Mounted on
/dev/hda1              3874076   3493644    183640  96% /
none                     63356         0     63356   0% /dev/shm
/dev/hda5              3739652   3481976     67712  99% /mnt


[mike at localhost mike]$ dd if=/dev/zero of=fooA bs=1 count=1 seek=1024G
1+0 records in
1+0 records out
[mike at localhost mike]$ ls -lh fooA
-rw-rw-r--    1 mike     mike         1.0T Mar 18 19:30 fooA
[mike at localhost mike]$ du -h fooA
28k	fooA
[mike at localhost mike]$ 

In the past I have used files like this to test file servers. The neat
thing about this kind of file is if you try to copy it over samba to a
windows box, it will actually try to copy all 1TB of the file filling
the sparse bits with nulls.  Or at least it did 3 years ago when I did
this last.   So if you want to test copy lots of data, but not actually
use any space on your file server you can make several files of
different sizes this way and serve them all up.

Mike


On Tue, 2003-03-18 at 16:18, Chris Fowler wrote:
> Interesting..
> [cfowler at minime cfowler]$ dd if=/dev/zero of=testf bs=1024k count=1
> [cfowler at minime cfowler]$ ls -l testf 
> -rw-r--r--   1 cfowler  devel     1048576 Mar 18 19:15 testf
> [cfowler at minime cfowler]$ dd if=/dev/zero of=testf bs=1024k count=1
> seek=20
> [cfowler at minime cfowler]$ ls -l testf
> -rw-r--r--   1 cfowler  devel    22020096 Mar 18 19:15 testf
> [cfowler at minime cfowler]$ du -h testf
> 2.0M    testf
> 
> There is a file that has 1mb in front, 20mb of nothing, than 1mb in the
> back.
> 
> That is how to create an empty file
> 
> On Tue, 2003-03-18 at 18:46, Geoffrey wrote:
> > Jim wrote:
> > > On Tuesday 18 March 2003 04:38 pm, Jason Vinson wrote:
> > > 
> > >>i am attempting to make files of various sizes to do transfer tests on
> > >>my network, and i know there is a command to make an empty file of a
> > >>specific size.  Can anyone give me a hint?
> > 
> > Hmmmm, make an empty fiel of a specific size?  If it's empty, size 
> > should be zero.  Are you trying to create a file containing nulls?
> > 
> > touch foo
> > 
> > will create an empty file foo if it doesn't already exist.
> > 
> > > 
> > > 
> > > I think "touch" will do that. See the man page.
> > > _______________________________________________
> > > Ale mailing list
> > > Ale at ale.org
> > > http://www.ale.org/mailman/listinfo/ale
> > > 
> > > 
> > 
> > -- 
> > Until later: Geoffrey		esoteric at 3times25.net
> > 
> > The latest, most widespread virus?  Microsoft end user agreement.
> > Think about it...
> > 
> > _______________________________________________
> > Ale mailing list
> > Ale at ale.org
> > http://www.ale.org/mailman/listinfo/ale
> 
> 
> _______________________________________________
> Ale mailing list
> Ale at ale.org
> http://www.ale.org/mailman/listinfo/ale
-- 
Mike Panetta <ahuitzot at mindspring.com>
TauZero Technologies

_______________________________________________
Ale mailing list
Ale at ale.org
http://www.ale.org/mailman/listinfo/ale






More information about the Ale mailing list