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

[ Available lists | Index of freebsd-hackers | Month of Jul 2003 | Week of 29 Jul 2003 | Raw email | View thread | Wrap long lines | Reply | Tag ]
From
Dmitry Morozovsky <marck@rinet.ru>
Date
29 Jul 2003 22:14:32
Subject
sparse files from shell [Re: file size different from ls to du]
Message-ID
20030730090934.L90518@woozle.rinet.ru

In reply to
Replies
Referenced by

[ Hide this part ]
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@rinet.ru ***
------------------------------------------------------------------------


Elapsed time: 0.118 seconds