
DD, DU and DF – The Three Linux Commands You Should Commit to Memory - TheLastSamurai
https://techtudor.blogspot.com/2018/09/dd-du-df-three-linux-commands-you.html
======
rdc12
"sudo dd if=/dev/zero of=/dev/sda

This will wipe your disk entirely and there is no recovery possible, though
some sysadmins are of the opinion that you should repeat the above at least
three times to be absolutely sure!"

The secure erase ATA command is probably a better bet, between bad block
management and over-provisioning there is too many places data can survive an
OS level purge.

But if you really want to be sure, take the disc out of the case and smash it
with a hammer, pretty difficult to recover data after that.

~~~
Pi-ena
Not sure if you're being sarcastic of not, but the intent was to wipe the
drive of data for another user of repair, and keeping the drive usable. Not to
simply the delete the data to the point of no recovery.

------
badrabbit
Oh,how frustrated I was when finding out you can't just dd a windows disk
image and expect it to work in the new environment. Makes me appreciate unix
os design. I have been dd'ing *nix variants,having to change only the kernel
and I will always get a bootable system.

<insert rant about uefi and tpm>

~~~
tortasaur
If you're looking to make an installable Windows USB from an installation ISO,
woeusb works well.

~~~
badrabbit
I'm used to dd'ing an image to a usb or to a file. There are different tricks
using random programs with windows to do similar things. I wanted the source
to be an installed system not an installation iso(also win10 has a builtin
tool that does what you said)

------
znpy
dd is also useful when working with initramfs files.

it took me a bit to discover that ubuntu's initramfs has cpu microcode
prepended to it. if you try to cpio the initramfs directly it will only take
out the microcode, spitting out something like "44 blocks extracted".

if you want to cut out only some part of a file, you can do something like:

    
    
        dd if=./file.ext out=./cutout.ext bs=<blocksize> skip=n count=m
    

this will skim n _blocksize bytes and then pull out m_ blocksize bytes.

in the case of an initramfs, you would just want to skip the initial microcode
blocks. for me, it was:

    
    
        dd if=/boot/initramfs.<ext> out=/tmp/initramfs.gz bs=512 skip=56
    
    

for the records, it turns out that ubuntu packs a lot of stuff in its
initramfs, and playing with initramfs is quite a funny activity

