4 thoughts on “Use DD to Create File of any Size

  1. I’d suggest you put the ‘bs=’ equal to that of your disk block size. That’ll help easier syncing… I don’t know why, but I suggest that is the best option.

    dd if=/dev/zero of=test-dumb-file bs=1K count=100

    and adjust via the ‘count=’ option

    YMMV, I guess

  2. I agree with Carb0n..
    my reason is the bs size limit that i encountered making a 4GB file

    dd if=/dev/zero bs=4G count=1
    yields a 2GB file.. that too silently ! Imagine using it in a script and getting a wrong size !

    dd if=/dev/zero bs=1K count=4M
    yields a 4GB file.. just like I wanted

  3. If you are limited to 4GB this may be because you have some 32bit limitation somewhere (OS architecture,or dd version compiled for 32bit only)

    If the source code deal with signed integer, then the range will be from -2Gb to +2Gb which is a range of 4Gb (32bit) but in this case you may encounter limitation to 2Gb when creating your file.


Leave a Reply

Your email address will not be published. Required fields are marked *