dd vs. truncate for creating vkernel root images

Matthew Dillon dillon at apollo.backplane.com
Wed Apr 11 21:21:44 PDT 2007

:Hi all,
:Is there any advantage in using
:'dd if=/dev/zero of=/var/vkernel/rootimg.01 bs=1m count=2048'
:over the much quicker
:'truncate -s 2G /var/vkernel/rootimg.01'
:other than getting a root image filled with zeros?

    It's not a good idea to use truncate.  The problem is that no actual
    disk space is reserved for the image file when you just truncate it to
    the desired size.  Blocks on disk are then allocated on the fly, as
    the vkernel is running, and thus can wind up being severely fragmented
    on disk.

					Matthew Dillon 
					<dillon at backplane.com>

More information about the Users mailing list