Best way to wipe linux and reinstall from a USB drive [closed]
Solution 1:
As stated in comments, the OS has an erase option before installing.
But you said that you would like to erase the current hard drive in its entirety before installing a fresh installation of Ubuntu. I don’t know about the purpose of this but its your business and I respect that.
Now assuming this is the hard drive in which any OS (any) is installed, that OS will prevent the OS partition from erasing.
So to achieve your task, you can use this hard drive on another computer as internal sata or external sata and use partition manager to delete every partition on that disk.
Alternatively, install any os on another hard drive in the same pc and connect the hard drive you need to delete and remove the partitions all together from that drive.
Now, once you are done erasing the drive, connect the drive to the pc and insert the Bootable USB with ubuntu and it would automatically boot from usb. If it doesn’t boot from USB automatically when you turn on the pc, just go to bios and change the boot order to boot from the pen drive .
Solution 2:
The best way to wipe a drive depends on your drive (type).
For example there's the sanitize and format command that are available in many (I believe) NVMe SSDs, which can be issued with nvme-cli.
blkdiscard
is a nice alternative as well if your drive is "Read Zero After TRIM" (it's even the case with some recent WD HDDs). This is probably the "safest" method as well since other methods are claimed by some to be "brick-prone".
There are also the Security Erase and Sanitize Device feature set that you can make use of with hdparm
in SATA SSDs (in HDDs they might be extremely slow because it might overwrite the whole drive), if your drive support any of that. Those are accessible on USB-bridged SATA drive as well even if your bridge does not support UNMAP to TRIM translation but ATA PASSTHROUGH. However, they are considered the most dangerous methods (implementations are often buggy) and often requires trick to be acessible (e.g. a suspend/resume cycle).
If none the above is not available / preferred, you can still use wipefs
that zeroes out "signatures" that are recognized by common OSes. Better use it on every partition first then the drive (partition table). Otherwise they will come up again if the new partitions has the same location.
P.S. Sanitize mentioned above refer to the block erase, or perhaps crypto if available, method. The overwrite method is not preferred for the same reason as HDD Security Erase.