Which way is the fastest to `dd` to the last 512 kilobytes of disk
As already pointed out, dd
accepts the seek=BLOCKS
parameter, which skips BLOCKS
blocks in the output file.
Now you need to know the exact size of the disk, if you want to write the last 512kB. On linux, you can use the blockdev --getsz DEVICE
command to get the size, in units of 512B.
So the command-line becomes something like:
dd if=/dev/zero of=$YOUR_DEV bs=512 seek=$(( $(blockdev --getsz $YOUR_DEV) - 1 )) count=1