r/linuxadmin • u/TheDafca • Oct 24 '25
dd command not working
Hi, I’m a beginner sysadmin and I had to wipe a company computer. I booted a live Debian and ran lsblk, which showed that I had sda as the system disk and sdb as the live USB. So I ran sudo dd if=/dev/zero of=/dev/sda status=progress bs=4M. After the task finished successfully, I tried restarting the computer, and it booted into Windows as if nothing had happened.
Does anyone know why it didn’t wipe the drive, or any other reliable method that’s guaranteed to work?
0
Upvotes
6
u/mro21 Oct 25 '25
Describe everything. Do you think anyone here has a crystal ball? As a sysadmin you need to be able to think, and you're mostly alone doing that.
So how big is the disk? How long did dd take? Does it all make sense with what you have seen? Without seeing any ouput or system state it's difficult to tell. Clearly if windows still boots then you didn't do what you thought :)
5
u/The_Real_Grand_Nagus Oct 24 '25
Boot back into Debian run lsblk. Hard for us to tell without seeing the system, but my guess is windows is booting from something other than sda Hopefully you didn’t blow away some other disk with data on it
6
u/mgedmin Oct 24 '25
Is network boot a possibility?
1
u/bobj33 Oct 24 '25
I would boot the live Debian again and run fdisk against /dev/sda and check the partitions and look for any kind of recovery partition.
How long did your dd command take? Are you sure you didn't type sda1 instead of sda?
Also GPT partition tables have an entry at the start of the disk and also a backup at the very end so if your dd did not finish completely the partition table would still be there.
https://en.wikipedia.org/wiki/GUID_Partition_Table
My standard method of wiping a disk is to delete all the partitions, make a new single partition for the entire disk, format it, and then copy garbage data into it.
1
u/resonantfate Oct 25 '25
if you boot back into the livecd environment, try using parted to view the disks, and information about the disks.
example:
echo "print all" | sudo parted | less # this sends "print all" to parted, and pipes that output to less so it's easier to read. press q to exit less.
This output should tell you the names of the disks, their manufacturer, serial number, etc.
I'd guess that you didn't pick the correct drive after all.
Keep in mind that the dynamic drive names assigned (/dev/sda, /dev/sdb, etc) can change between boots, or stay the same. So if you booted once, saw your flash drive as /dev/sda, then rebooted, the flash drive and the windows disk could have switched places.
I'd bet that your flash drive got wiped instead.
Also, consider physically opening the system, and looking for any other drives. Check the back for flash drives.
1
u/zoredache Oct 26 '25
Are you sure /dev/sda was the device you thought it was suppose to be? Are you sure you weren't suppose to be going to /dev/nvme...?
Did you just wipe the wrong device?
The output of
lsblkwould have been very useful here. To verify which drive you where wiping.After wiping the drive it can also be useful to do something like run
hexdump -C /dev/sd...Which should basically just report a line of zeros and starting with an 0x0000 offset, and then ending with whatever the last offset is of your device.1
u/Alexandre_Man Oct 26 '25
Maybe you formatted your USB key instead of the drive with Windows.
1
u/notseelen Nov 01 '25
I'm laughing at the thought of this conversation at work..."what do you mean, you accidentally didn't delete the system? We need that system destroyed!"
This is the first time I've seen someone say they can't make dd destructive enough
1
u/michaelpaoli Oct 24 '25
Some systems may be configured with "hidden" partition(s), so, e.g., it may have booted to a "recovery" partition or the like, that my be "hidden". And in hidden, I don't mean some partition type that Microsoft might customarily hide, I mean at the CMOS/BIOS and hardware level, where the hardware will mostly make a partition not seen at all, and generally make the drive appear smaller than it actual is, hiding all the space used by the "hidden" partition - and perhaps a bit more.
Also possible the system may have been in some kind of sleep or hibernate sate, and Microsoft Windows wasn't actually fully and properly shut down cold, and it may have resumed from that, from RAM, swap, and/or similar to above, "hidden" partition area.
Anyway, you want to blow away the 'doze stuff, make sure that OS is all they damn way down, not some sleep or hibernate, none of that "quick start" still enabled (which is effectively a version of that), and shut it all the damn way down. Then be sure there's no "hidden" partition or "reserved" area on the drive or anything like that - well go through all the CMOS/BIOS settings. And then rather than dd, for non-ancient drives, use the drive's own secure erase capability. That also has the advantage that'll wipe mapped out reserved sectors/block - whereas dd will never be able to write those.
Edit/P.S.: I see zero evidence that the dd command didn't work. You likely missed something(s) else.
1
u/What-A-Baller Oct 24 '25
Hard to say without seeing the disk list, what you ran and the output. Try shredos instead - https://github.com/PartialVolume/shredos.x86_64
1
u/ElectronicFlamingo36 Oct 25 '25
I have no standard method of deleting a disk of mine.
Luks full disk encryption without headers (stored elsewhere) is so amazing.
dd'ing is always recommended via /dev/disk/by-id/ata, scsi or wwn instead of the oldschool method.
1
u/Superb_Raccoon Oct 26 '25
Use a utility from the drive manufacturer to erase the drive.
-2
u/AlySalama Oct 24 '25
I am not quite sure, but you always have to run sync after dd to make sure all changes actually flush to disk
-8
u/chock-a-block Oct 24 '25
because you have partitions on sda that get wiped, not the device node.
so, get your partition scheme, and run your dd command on the partitions.
1
u/klaasbob88 Oct 27 '25
Have you considered that you might have wanted to nuke a SSD at /dev/nvme* instead? /dev/sd* is a bit old school for more or less up to date systems