DragonFly users List (threaded) for 2007-04
DragonFly BSD
DragonFly users List (threaded) for 2007-04
[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]

Re: dd vs. truncate for creating vkernel root images


From: Chris Turner <c.turner@xxxxxxxxxxxxxxxxxxx>
Date: Wed, 11 Apr 2007 19:30:33 -0400

Nuno Antunes wrote:
> 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?

not sure if the 'filled with zeros' counts as the same thing,
but the former will pre-allocate the storage whereas the latter
will not:

  $ truncate -s 100M ./foocate
  $ dd if=/dev/zero of=./ddcate bs=1m count=100
  $ ls -l *cate
  -rw-r--r--  1 foonicator  staff  104857600 Apr 11 19:26 ddcate
  -rw-r--r--  1 foonicator  staff  104857600 Apr 11 19:25 foocate
  $ du -sk *cate
  102448  ddcate
  48      foocate

so it depends on your preference if you want to pre-allocate or
defer allocation.



[Date Prev][Date Next]  [Thread Prev][Thread Next]  [Date Index][Thread Index]