3 ms·
I wipe USB sticks with: # dd if=/dev/zero of=/dev/sdd (CTRL-C after a few seconds) It's quick and easy and only a slip away from a wiped hard disc. On a SSD,
by gerdesj 4y ago
I wipe USB sticks with:
# dd if=/dev/zero of=/dev/sdd (CTRL-C after a few seconds)
It's quick and easy and only a slip away from a wiped hard disc. On a SSD, that would probably rip through /boot (EFI) and swap and be munching on my / before I stopped it. Oh well I could restore the OS and /home should still be intact ... probably.
As I current use Arch and prior to that Gentoo for over a decade, it's probably not the worst breakage I've done to a laptop 8)
- gizmo686 4y agoI routinly need to dd to a thumbdrive at work. On newer computers the internal harddrive tends to be on /dev/nvme*, making the usb drive sda. Apart from several months of being very nervous when I went to flash a drive, this significantly reduced the risk of an accidental destruction of you computer. Having said that, I have forgotten that I had an ssh session open and accidentally destroyed a dev server like that.
- usr1106 4y agoI have thought for years that I should patch dd to require some force option if it writes to a block device bigger than a typical USB stick/SD card. Never did, but now my development machines have NVME and I hardly ever use USB sticks anymore because my target systems have OTA updates most of the time. So the need has become history.
- gizmo686 4y agoYou can do better than that. Assuming you don't care about portability, it is easy to tell if a disk is USB or not by poking around /sys. Linux also seems to have a notion of "removable disk", as the eject command can tell the difference, but I'm not sure what that looks at. If I really cared, I would suggest setting up udev so the relevent disk is created with DAC permissions that allow you to flash it without needing root.
- usr1106 4y agoUSB or removable is not the right differentiator. The only time I really did screwed up in 15 years of using dd was when I exceptionally had my external USB backup disk connected and it had received the drive letter that normally was used by the SD card of for my embedded target. Right, the udev rule idea sounds great. That should work based on model name, I don't see any other good attriute in udevadm info output right now. Unless you use the same model for important data and transferring disk images.
- pabs3 4y agoI use the GNOME Disks app (udisks frontend) because it provides a lot more context for wiping drives, which helps prevent the sort of problems you mention. https://wiki.gnome.org/Apps/Disks https://wiki.gnome.org/Apps/Disks