hi there - good day dear exüerts
background: i have a iinux in a notebook - running as a live-dvd - before installation i want to zero out the
root@ /home/demo# dd if=/dev/zero of=/dev/sda bs=4096 count=4096
i get back:
dd: failed to open ‘/def/zero/’ : No such file or directory
why do i get this error?
dd if=/dev/zero of=/dev/sda bs=512 count=4096 seek=$(expr blockdev --getsz /dev/sda - 4096)
Q: What exactly does this do?
https://unix.stackexchange.com/questions/275243/what-does-dd-if-dev-zero-of-dev-sda-do/275260
background: i have a mx-linux in a notebook - running as a live-dvd - before installation i want to zero out the
root@mx1: /home/demo# dd if=/dev/zero of=/dev/sda bs=4096 count=4096
i get back:
dd: failed to open ‘/def/zero/’ : No such file or directory
why do i get this error?
Well i allways thougth that this will zero out the first 16 MiB of the drive. 16 MiB is probably more than enough to nuke any “start of disk” structures
while being small enough that it won’t take very long.
dd if=/dev/zero of=/dev/sda bs=512 count=4096 seek=$(expr blockdev --getsz /dev/sda - 4096)
Q: What does this exactly?
blockdev --getsz gets the size of the block device in “512 byte sectors”.
So this command looks like it was intended to zero out the last 2 MiB of the drive.
Unfortunately this command is broken syntax wise. I expect the command was originally intended to be
dd if=/dev/zero of=/dev/sda bs=512 count=4096 seek=$(expr blockdev --getsz /dev/sda
- 4096)
and the backticks got lost somewhere along the line of people copy/pasting it between different environments.
Old partition tables, LVM metadata, raid metadata etc can cause problems when reusing a drive.
Zeroing out sections at the start and end of the drive will generally avoid these problems while being much faster than zeroing out the whole drive.
This will erase the first 40964096=16MB and last 5124096=2MB of your hard drive, which contain important structures useful for recovery. I assume this code was posted maliciously.
I’ve never encounter a situation where explicitly specifying a count other than 1 was useful. I have erased the first block if I wanted to ensure I wasn’t leaving any traces of the MBR behind …