sparse files from shell [Re: file size different from ls to du]

Dmitry Morozovsky marck at rinet.ru
Tue Jul 29 22:14:33 PDT 2003


On Tue, 29 Jul 2003, Joshua Oreman wrote:

[snip]

JO> Usually programs will manage their own sparse files; it's something hard
JO> to do at the shell.

dd is your friend.

These commands make sparse file of some ks physical and 1g logical:

VNFILE=/tmp/sparsefile
VNSZ=$((1024*1024))
dd if=/dev/zero of=${VNFILE} bs=1k count=1 seek=$((${VNSZ} - 1))


Sincerely,
D.Marck                                     [DM5020, MCK-RIPE, DM3-RIPN]
------------------------------------------------------------------------
*** Dmitry Morozovsky --- D.Marck --- Wild Woozle --- marck at rinet.ru ***
------------------------------------------------------------------------


More information about the freebsd-hackers mailing list