Re: file size different from ls to du
From: Bruce Cran (bruce_at_cran.org.uk)
Date: 07/29/03
- Previous message: Joshua Oreman: "Re: file size different from ls to du"
- In reply to: Bogdan TARU: "Re: file size different from ls to du"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 29 Jul 2003 17:02:15 +0100 To: Bogdan TARU <bgd@icomag.de>
On Tue, Jul 29, 2003 at 05:27:14PM +0200, Bogdan TARU wrote:
>
> Hi Drew,
>
> I have tried to create some files of myself, with 'spaces' in them
> (holes?), but they don't act like this. So could you please explain what
> 'sparse' means, and the 'trick' to create them?
>
Try using the 'truncate' utility:
truncate -s 102400G onehundred_terabytes
This will create a file which looks like it's 100TB though 'ls', but
which only uses 64KB in the directory usage via 'du'. Generally, creating
a file, seeking past the end of the file then writing something,
will create a 'sparse' file. This, when read, will appear
to contain zeros for all entries past the previous end of file,
to the entry which was written to.
-- Bruce Cran _______________________________________________ freebsd-hackers@freebsd.org mailing list http://lists.freebsd.org/mailman/listinfo/freebsd-hackers To unsubscribe, send any mail to "freebsd-hackers-unsubscribe@freebsd.org"
- Previous message: Joshua Oreman: "Re: file size different from ls to du"
- In reply to: Bogdan TARU: "Re: file size different from ls to du"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]