How to speed-up your DD (DataDump) for file creation.
To create a large file VERY quickly (without dumping data into), for example a 20GB file, I usually use DataDump:
dd if=/dev/zero of=mylargefile.img seek=$(( 20 *1024*1024*1024 -1 )) bs=1 count=1 |
This will create your file in a second without dump zeroes using the classic ‘dd’ command:
dd if=/dev/zero of=mylargefile.img bs=1M count=$((20 * 1024)) |
Useful to create Xen image files.
Resize of a Xen image
If we need to resize the disk or a simple file, for example to expand ‘mylargefile.img’ of 10GB, use the following command:
dd if=/dev/zero of=mylargefile.img conv=notrunc bs=1 seek=$((1024*1024*1024 * (20+10)-1)) count=1 |
Where 20 is the disk’s original size.
We have to subtract 1byte into the seek expression because ‘dd’ don’t accept zero as ‘bs’ value.