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

Re: Useful use of dd


Teemu Likonen wrote:
> For this new subject I will add another use: quickly create empty file
> of specific size, for example 5 * 1024 bytes:
>    $ dd of=empty obs=1024 seek=5 count=0

Not to forget creation of sparse files with few disk consumption.

For testing zisofs i have this in a script:

  # 100gb with big holes
  for i in {1..100}
    echo $i | dd of=100gb bs=1 seek="$i"G 2>/dev/null

The resulting file "100gb" occupies 404 KB in an ext4 filesystem.
(It shall not contain entirely zeros. So it is not the smallest possible
100 GiB file.)

Have a nice day :)


Reply to: