Wipe a USB drive with dd

  • Bericht auteur:
  • Berichtcategorie:Memes

Linux, especially Pop!_OS has a tendency of keeping those terrible USB drives busy. If you have a linux image like Pop!_OS or Ubuntu on it, how can you go back to windows?

  • Not with the Disks program
  • GParted won’t do it either

We’re going to just send data to the device on a lower level, with dd.

What drive name are we?

Unmount the device in the file manager

sudo dmesg  | tail -15

gives something like. Ignore the start. It’s all about the last lines.

[28108.043568] BPF: Invalid name
[28108.043569] BPF:
[28108.043570] failed to validate module [cpuid] BTF: -22
[28167.906452] kauditd_printk_skb: 4 callbacks suppressed
[28167.906454] audit: type=1400 audit(1669733116.339:47): apparmor="STATUS" operation="profile_remove" info="profile does not exist" error=-2 profile="unconfined" name="/usr/sbin/mariadbd" pid=49797 comm="apparmor_parser"
[57859.239574] audit: type=1400 audit(1669762807.305:48): apparmor="DENIED" operation="capable" profile="/usr/sbin/cupsd" pid=79116 comm="cupsd" capability=12 capname="net_admin"
[144260.285690] audit: type=1400 audit(1669849207.252:49): apparmor="DENIED" operation="capable" profile="/usr/sbin/cupsd" pid=100390 comm="cupsd" capability=12 capname="net_admin"
[172826.617730] sdb: sdb1 sdb2
[172862.754101] usb 3-7: reset high-speed USB device number 4 using xhci_hcd
[172868.117984] usb 3-7: device descriptor read/64, error -110
[172876.157787] sdb: sdb1
[181009.632703] ISO 9660 Extensions: Microsoft Joliet Level 3
[181009.638292] ISO 9660 Extensions: Microsoft Joliet Level 3
[181009.643161] ISO 9660 Extensions: RRIP_1991A
[181010.624402] sdb: detected capacity change from 30322688 to 0

So it is /dev/sdb we are on.

The DD command

dd if=/dev/null of=/dev/sdb1 bs=1M

Now the device should be wiped. You will need to reboot. Linux can’t handle this,really.

Get the partition type set

Linux support all the filesystems in the world. It needs to be set on the partition table.

fdisk /dev/sdb
t
Hex code or alias (type L to list all): l
07 HPFS/NTFS/exFAT 
Hex code or alias (type L to list all):  7
Changed type of partition 'Linux' to 'HPFS/NTFS/exFAT'.

Command (m for help): wq
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.

Do you have exfat on board

Ir’s not default on pop!_OS. Install exfat-fuse and exfatprogs

sudo apt install exfat-fuse exfatprogs

Have mkfs creating a file system


mkfs.exfat  /dev/sdb1
Cluster size has been automatically set to 4096 bytes.
Initializing device with zeroes: 100% - Done.
Creating NTFS volume structures.
mkntfs completed successfully. Have a nice day.
root@eloqarch:~# cd
ro