Resuming a DD of an entire disk
As @don_crissti already commented, just use seek=
to resume.
dd if=/dev/urandom of=/dev/disk/by-uuid/etc bs=512 seek=464938971
GNU dd
also supports seeking in bytes, so you can resume exactly, regardless of blocksize:
dd if=/dev/urandom of=/dev/disk/by-uuid/etc bs=1M \
seek=238048755782 oflag=seek_bytes
A larger blocksize should help with speeds even for a slow device like /dev/urandom
.
If you are looking for faster alternatives, you could cryptsetup plainOpen
with a random key and zero that, it should beat /dev/urandom
by an order of magnitude (without AES-NI) or even run at full speed (with AES-NI).
You could also use shred -n 1
if pseudorandom data is good enough for your use case. shred
should be able to utilize the full disk speed, even on a very slow machine.
Just a reminder for people who would like to copy rather than just randomizing disks (which is not that common) : you can use skip=BLOCKS
to start reading at the proper position, and seek=BLOCKS
to start writing at the correct position. Both options use blocks, not bytes. When breaking/restarting, it's advisable to remove a bunch of blocks just in case. It is usually worth raising the bs
value above 512, as you can reach better performance if you read a lot of data in a row.
In your case, it is indeed a block value that you need to pass to seek
. Maybe you should try to adjust bs
to see if you can enhance speed, as /dev/random
should go fast (pseudo-random and non-blocking when it has no entropy available)