Terminal commands to erase partitions and hard drives please!!
Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Terminal commands to erase partitions and hard drives please!!
Could any LQ members please provide me with the terminal commands that will completely erase everything within a hard drive partition and completely erase everything on a entire hard drive?? Thanks!!
Is there a terminal command that will reveal the exact designation of the hard drive inside of my computer?
lsblk -f should give you what you need.
Can I ask what you're trying to do here? If you're trying to erase the whole hard disk in your computer, you need to boot from another medium. In that case, you could also look at something like Darik's Boot and Nuke (https://dban.org/).
There are many commands for listing information about system installed hard drives and partitions, here are some of them:
cat /proc/partitions
sudo fdisk -l
sudo parted /dev/sda print
df -h
The first command for erasing a disk consists of using the dd Linux / Unix command. After deciding which partition or external disk you want to erase, open the terminal and run this command:
sudo dd if=/dev/urandom of=/dev/sdaX
The next command consists of using the shred command line tool. You can erase a disk with this command:
Thank You All Very Much!! I messed up one of my two old computers and I am trying to get the mistakes out of the hard drive!!
In that case you shouldn't really need to erase a partition or disk, just initialise a filesystem in it, either by using a bootable tool such as GParted Live or by simply installing another distro over an older one.
I bought the repository discs for an old PCLinuxOS system and, as usual, I messed the install up. There were others, much more experienced Linux users, who stated the discs also messed up their computers!! At any rate I have never been able to get rid of all of that junk. I hope to finally get it all out now!!
Side notes.
Every once in a while you may have to nuke or dd it or wipe a drive. Many newer installer programs refuse to destroy what they think to be a working linux.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.