This is the mail archive of the cygwin-talk@cygwin.com 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]

Re: find prints wrong file size for files >2GB


Yitzchak Scott-Thoennes wrote:

> > dd if=/dev/zero bs=1 count=0 seek=2G of=filename
> 
> Can that work in place (just modifying a file without creating another)?
> 
> How would you extend/shorten an existing file using that?

$ echo "hello world" >testfile

$ ls -l testfile              
-rw-r--r--    1 brian    None           12 Dec  6 11:50 testfile

$ dd if=/dev/zero bs=1 count=0 seek=150M of=testfile
0+0 records in
0+0 records out

$ ls -l testfile
-rw-r--r--    1 brian    None         150M Dec  6 11:51 testfile

$ dd if=/dev/zero bs=1 count=0 seek=5 of=testfile
0+0 records in
0+0 records out

$ ls -l testfile
-rw-r--r--    1 brian    None            5 Dec  6 11:51 testfile

$ cat testfile 
hello

By using "count=0" there's no actual writing going on, just the
seek/truncate operation.  At least I think that's what's going on..

Brian


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