Re: dd vs. truncate for creating vkernel root images
: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? : :Thanks, :Nuno 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. -Matt Matthew Dillon <[EMAIL PROTECTED]>
Re: dd vs. truncate for creating vkernel root images
Forgot to copy to [EMAIL PROTECTED] On 4/12/07, Nuno Antunes <[EMAIL PROTECTED]> wrote: On 4/12/07, Nuno Antunes <[EMAIL PROTECTED]> wrote: > On 4/12/07, Justin C. Sherrill <[EMAIL PROTECTED]> wrote: > > On Wed, April 11, 2007 6:00 pm, 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? > > > > Have you tried it? What happened? > > > > > > Yes I have, and it works. Vkernels can use a root image created this > way. So does it mean that the file will grow on demand (up to the > established size, of course)? > > Thanks, > Nuno > Here are my image sizes: whitewidow# ll -h /var/vkernel/devel.rootimg.01 -rw-rw-r-- 1 root wheel 512M Apr 12 00:32 /var/vkernel/devel.rootimg.01 whitewidow# du -sh /var/vkernel/devel.rootimg.01 339M/var/vkernel/devel.rootimg.01 And inside the vkernel: # df -h Filesystem Size Used Avail Capacity Mounted on /dev/vkd0a 496M 186M 270M41%/ Cheers, Nuno
Re: dd vs. truncate for creating vkernel root images
On 4/12/07, Justin C. Sherrill <[EMAIL PROTECTED]> wrote: On Wed, April 11, 2007 6:00 pm, 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? Have you tried it? What happened? Yes I have, and it works. Vkernels can use a root image created this way. So does it mean that the file will grow on demand (up to the established size, of course)? Thanks, Nuno
Re: dd vs. truncate for creating vkernel root images
On Wed, April 11, 2007 6:00 pm, 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? Have you tried it? What happened?
Re: dd vs. truncate for creating vkernel root images
Chris Turner wrote: > so it depends on your preference if you want to pre-allocate or > defer allocation. although I just remembered the 'skip' argument to 'dd' does the same..
Re: dd vs. truncate for creating vkernel root images
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.