Another amazing utility is DD. DD is what you use to clone devices or parts of devices.
So DD was developed to move blocks between devices. And using DD makes it possible to
make an ISO of an optical disk or to clone a complete hard disk. It's not a utility for
copying individual files or for making archives of files. But if you want to directly work
with block devices, it is an extremely cool utility. Let me show you. So the first command
is DD. IF is dev SDA. OF is dev null. BS is 1M, which is going to do what? Well, it's
kind of useless. It's cloning the entire SDA device to the dev null device. The reason
I'm showing you is that I rather don't show you this. DD. IF is dev 0. OF is dev SDA.
Don't do it. Don't press enter. Because if you press enter and you do have an SDA device,
it will be wiped. Dev 0 is the device that generates 0s. And dev SDA, well, LSB OKs revealing
that on this system, dev SDA is my primary hard disk. It is a very efficient way to wipe
your entire hard disk, though. Now, if you want to clone your device, that is actually
kind of cool. You can use DD. IF is dev SDA. OF is dev SDB. I would advise use BS is 1M.
Because DD by default will stream data. And that means that it will copy byte by byte.
That's not very efficient. If you use it this way with the IF is dev SDA and OF is dev SDB
and a BS is 1M, you tell it to use a 1 megabyte block size. And once it is done, SDB will
be an identical copy of SDA. And that is useful if it's a physical hard drive that next you
want to connect to another computer. I also like DD. IF is dev SDA. OF is slash boot slash
MBR backup. BS is 512 and count is 1. Now, what is so cool about it? Well, what is so
cool about it is that I just made a clone of the first 512 bytes of my SDA disk. That's
my master boot record. And hey, if I show you XXD, which is the hexadecimal viewer minus
L512 on dev SDA, here you can see the master boot record. And I know it's pretty unreadable,
but believe me, the stuff that you see right here is your partition table. So yeah, what
is going to happen if I use DD? IF is dev 0, OF is dev SDA, BS is 512 and count is 1.
Then, oops, I just copied zeros into the master boot record. But fortunately, we can easily
recover using DD. IF is MBR backup. What was the name again that I created? Slash boot slash MBR
backup. So DD. IF is slash boot slash MBR backup. OF is dev SDA. And that should recover access to
my hard disk, as we can see by using XXD right now. Now, you might feel that DD is kind of a
dangerous utility. And that is absolutely true. But it's also a very powerful utility and
combination with a utility like XXD or hexdump, which are hexadecimal viewers, it allows you to
perform chirurgical operations on data blocks on your hard disk. And for troubleshooting, that can
be so nice.