how to format the hard drive from a console window
Linux - SoftwareThis forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.
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.
Introduction to Linux - A Hands on Guide
This guide was created as an overview of the Linux Operating System, geared toward new users as an exploration tour and getting started guide, with exercises at the end of each chapter.
For more advanced trainees it can be a desktop reference, and a collection of the base knowledge needed to proceed with system and network administration. This book contains many real life examples derived from the author's experience as a Linux system and network administrator, trainer and consultant. They hope these examples will help you to get a better understanding of the Linux system and that you feel encouraged to try out things on your own.
Click Here to receive this Complete Guide absolutely free.
how to format the hard drive from a console window
Can somebody tell me how to format the hard drive from a console window?
I mean - I'm trying to completely wipe it out with zeros (or ones) and I know I'd have to be in root to do it. I saw a thread on this subject, on this forum but I just couldn't find it anymore.
I'm using Mandrake 9.0
Last edited by zebra90210; 09-04-2003 at 12:14 AM.
You can also use the 'shred' command. Check the man page, and in case you didn't notice when MasterC said it, be VERY, VERY CAREFUL. Think about it before you type the command, then type the command VERY CAREFULLY, then read the command (need I say VERY CAREFULLY), then think about it some more, then hit enter. Then say, 'Oh 5#|7!!!' when you realize that you didn't save a copy of that critical file that you really, really needed ;-)
I know I'd have to VERY careful about executing that command but what I meant was - I was trying to format the ENTIRE DRIVE, including root and everything else.
I'm running a 3-disk system. I have three 20Gb hard drives in my PC, one for Win98, used only occasoinally, mostly for games and some stuff that only exists in the Windows (THANK YOU, MR. GATES). The other drive is my primary Linux system, Mandrake 9.0 and finally the third drive is my 'battlefield' where I can experiment with new stuff without any worries about lost data.
I use a Trios switch to select a drive I want to use.
So, coming back to my question - I wanted a quick, final, 'no questions asked just F%$*#N do it NOW!' format command.
Cerbere - how exactly do I execute the 'shred' command?
Forgive me for asking this question again, I'm not a Linux guru, just a user who knows the system, but is not exactly familiarized with the back door commands.
Well, if you're keeping the hard drive, then I wouldn't worry about using the shred command. It's generally for wiping out data so that it can't be recovered, even with state of the art tools (think national security). If you're just looking to wipe out the drive so you can install a new OS or store new data, then just use the fdisk command.
This will bring up an interactive program which is used to add, delete and set the properties of partitions. The first thing you'll want to do once you're in fdisk, is hit the 'm' key to show what options are available.
To list the partitions that are already on your drive, hit 'p'.
To delete a partition, hit 'd' then it will ask what partition you want to delete.
To add a partition, hit 'n', then it will ask if you want to add a primary or extended partition. Stick with primary as long as you can (you're allowed up to four). Then it will ask what number you want to assign to the partition (just count up from one).
To set the filesystem type for a partition, hit 't'. It will ask which partition you want to set, then which filesystem you want. Hit 'L' to see a list of the filesystem types (83 is the native Linux filesystem, 82 is swap, c is FAT32).
Finally, when you have the disk set up as you like, hit 'w' to save the changes you've made and exit fdisk. If you decide you don't want to save the changes, then hit 'q' to quit without saving.
After you've finished setting up the partitions with fdisk, you'll want to format the partition(s) for your filesystem(s) of choice. If you want a standard ext2 Linux filesystem, then use 'mke2fs /dev/hda'.
Now you'll have a nice fresh partition all ready to be mounted and used in Linux.
p.s. If you do want to destroy all the data so no one will ever be able to read it (if you're giving away the disk, for example), then the usage of shred would be:
shred -n 1 -z /dev/hda
The '-n 1' means that it will make one pass of filling the drive with random gibberish. The -z means that it will then fill the drive with zeros.
It's worked like a charm.
As the format progressed the things started disappearing from the desktop,
I was clicking on the icons and they would disappear or freeze.
Finally I couldn't even move a mouse.
Of course, it was all done on my 'battle-field' drive. LOL