Featured image of post The DD Command on Unix

The DD Command on Unix

Explaining the basic of the DD Command

What does DD stand for? It really depends on how you use the command, it could stand for Data Duplicator while cloning the HDD or Data Destroyer while securely erasing the HDD by overwriting with zero or random data. In reality it does not stand for anything really. 😉

Just a little heads up, be absolutely sure if you want to run the command it will not give a confirmation. It will just do it.

Writing iso image to memory storage

dd if=/path/to/image.iso of=/dev/sdX bs=1m

This is quite useful for creating bootable pen drive.

Cloning one device to another device

dd if=/dev/sda of=/dev/sdb bs=1m

The destination device should have the same amount of space or more than the source device.

Creating a backup image of the device

dd if=/dev/sda of=/home/user/backup.img bs=1m

Come useful when you want a backup of a SD especially when using it with a Raspberry PI.

Securely erasing the HDD

dd if=/dev/zero of=/dev/sdX bs=1m

This overwrites the entire HDD with zeros, this should to prevent data recovery.

dd if=/dev/urandom of=/dev/sdX bs=1m

Same as above but with random data.

I wouldn’t recommend trying that with solid state drive or SSD, it will only cause extra wear and tear and you will not get the desired effect, you’re better off using encryption from day one, that way you won’t have to worry about securely erasing the drive.

If you haven’t got the patient you can always drill holes in the drive, so it can’t be recovered.

Conclusion

I have pretty much covered the basic of the DD command, there are more advanced use cases, but you can look up the man page for more details.

https://www.man7.org/linux/man-pages/man1/dd.1.html

Also you can find more examples using search engines. 😁

The best part about DD it’s comes as standard on most Unix systems! 😉

comments powered by Disqus
Built with Hugo
Theme Stack designed by Jimmy