LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-27-2006, 01:36 PM   #1
blnkgcrsr001
Newbie
 
Registered: Mar 2006
Posts: 18

Rep: Reputation: 0
How best to format/wipe hard drive clean?


Can anyone post a link for a good step-by-step guide for wiping a hdd clean (like with DBAN) and setting up the cd-rom and floppy drive from scratch so one can install a new os (like FreeDOS, linux, whatever else)...
 
Old 05-27-2006, 01:40 PM   #2
MasterC
LQ Guru
 
Registered: Mar 2002
Location: Salt Lake City, UT - USA
Distribution: Gentoo ; LFS ; Kubuntu ; CentOS ; Raspbian
Posts: 12,613

Rep: Reputation: 69
You can use a LiveCD (such as knoppix) fdisk, and then dd:

fdisk /dev/hda (remove all the partitions, then create 1 using the entire space)

Then:

dd if=/dev/zero of=/dev/hda1

There are probably a zillion other ways too

Cool
 
Old 05-27-2006, 01:53 PM   #3
blnkgcrsr001
Newbie
 
Registered: Mar 2006
Posts: 18

Original Poster
Rep: Reputation: 0
Quote:
Originally Posted by MasterC
You can use a LiveCD (such as knoppix) fdisk, and then dd:

fdisk /dev/hda (remove all the partitions, then create 1 using the entire space)

Then:

dd if=/dev/zero of=/dev/hda1

There are probably a zillion other ways too

Cool
1.)What is "dd"?
2.)Do I type the above commands at a console prompt?
3.)Is

Quote:
dd if=/dev/zero of=/dev/hda1
what I should type verbatim?

Thanks...
 
Old 05-28-2006, 03:40 AM   #4
MasterC
LQ Guru
 
Registered: Mar 2002
Location: Salt Lake City, UT - USA
Distribution: Gentoo ; LFS ; Kubuntu ; CentOS ; Raspbian
Posts: 12,613

Rep: Reputation: 69
You would boot with the LiveCD, then get to a root console, then, assuming it's the primary master drive on an IDE cable:
fdisk /dev/hda

Using fdisk, you'll need to delete the partitions:
d
And do this until all the partitions are gone, then, create the new partition (hit m for more info, I can't remember the exact key off the top of my head).

Then, after the single new partition is created, use dd (yeah, just dd):
dd if=/dev/zero of=/dev/hda1

dd is for data dump (maybe, someone may have a better idea, but that's what I've always taken it to mean). You take the input file (if=) and output it to output file (of=).

HTH

Cool
 
Old 05-28-2006, 08:52 AM   #5
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
Much easier with dd only:

dd if=/dev/zero of=/dev/hda

This wipes everything, including the mbr, partition tables, etc. The other method only zeros the actual partition.

But, DBAN is even easier: Boot from the DBAN floppy, select an option, and go.

Now that we have all that straight, you don't normally need to wipe a disk to install a new OS....
 
Old 05-28-2006, 04:19 PM   #6
MasterC
LQ Guru
 
Registered: Mar 2002
Location: Salt Lake City, UT - USA
Distribution: Gentoo ; LFS ; Kubuntu ; CentOS ; Raspbian
Posts: 12,613

Rep: Reputation: 69
In my experience, I've wasted 2 drives dd then entire thing. I don't see a need to dd /dev/zero to the MBR, it's just the MBR afterall It could be coincidence, but since then I've never dd'd the entire drive, instead I'll create a single partition of the entire drive and then dd that partition. Superstition? Yeah maybe, but I haven't had a drive die doing it that way...

Cool
 
Old 05-28-2006, 04:32 PM   #7
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
Quote:
Originally Posted by MasterC
In my experience, I've wasted 2 drives dd then entire thing. I don't see a need to dd /dev/zero to the MBR, it's just the MBR afterall It could be coincidence, but since then I've never dd'd the entire drive, instead I'll create a single partition of the entire drive and then dd that partition. Superstition? Yeah maybe, but I haven't had a drive die doing it that way...

Cool
Maybe it's my lack of experience, but how do you irreversibly damage a drive by writing data to it...
 
Old 05-28-2006, 04:35 PM   #8
[Rado]
LQ Newbie
 
Registered: May 2006
Posts: 5

Rep: Reputation: 0
I would suggest you to use a bootable CD with Partition Magic 8
It's so user-friendly you just can't mess up the things.
 
Old 05-28-2006, 04:39 PM   #9
pixellany
LQ Veteran
 
Registered: Nov 2005
Location: Annapolis, MD
Distribution: Mint
Posts: 17,809

Rep: Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743Reputation: 743
Quote:
Originally Posted by [Rado]
I would suggest you to use a bootable CD with Partition Magic 8
It's so user-friendly you just can't mess up the things.
That costs MONEY!!
Also, I did not know that PM has a wipe function??
 
Old 05-28-2006, 05:38 PM   #10
Michael_aust
Member
 
Registered: Aug 2005
Location: Lancashire (United Kingdom)
Distribution: Debian Etch, on 686 machine.
Posts: 509

Rep: Reputation: 31
gparted is similar but free in both ways

http://gparted.sourceforge.net/livecd.php
 
Old 05-29-2006, 05:46 PM   #11
MasterC
LQ Guru
 
Registered: Mar 2002
Location: Salt Lake City, UT - USA
Distribution: Gentoo ; LFS ; Kubuntu ; CentOS ; Raspbian
Posts: 12,613

Rep: Reputation: 69
Quote:
Originally Posted by pixellany
Maybe it's my lack of experience, but how do you irreversibly damage a drive by writing data to it...
Good point! I'm just a paranoid delusional... I guess I shouldn't spread my fear to others just because I coincidentally had drives die during the process.

Ah well, good luck.

Cool
 
Old 07-11-2006, 01:06 PM   #12
ilerdl
LQ Newbie
 
Registered: Apr 2004
Location: Cedar City, UT
Distribution: Redhat Enterprise 3 AS
Posts: 3

Rep: Reputation: 0
linux wipe disk

Wiping disks in LINUX
Boot from a knoppix CD

The following will wipe each partition clean. It can take a while to run, so let it run overnight.

Easiest way is to run badblocks. The normal behavior of badblocks with the -w option (destructive write) is to write 0xAA, then 0x55, then 0xFF, and finally 0x00. If you give the -v option, you can watch the progress as badblocks cycles through.


Let's say I have a disk (or disk array) with 7 soft (O/S) partitions: hda0, hda1, hda2, hda3, hda4, hda5, hda6.

The first command wipes the whole disk:

badblocks -vw /dev/hda


Let's say I wanted to wipe the odd partitions only.

for i in 1 3 5; do
badblocks -vw /dev/hda$i
done


Now, let's say I have a disk array with 4 hard (controller based) partitions: sda1, sdb1, sbc1, sdd1.

use the following command.

for i in a b c d; do
badblocks -vw /dev/sd${i}1
done
 
Old 12-12-2006, 05:38 AM   #13
rutabega man
LQ Newbie
 
Registered: Aug 2005
Location: Raleigh NC
Distribution: Mint 19
Posts: 12

Rep: Reputation: 0
I have had similar problems with reloading windows after using linux.

What I did was grab a mandriva installer disc (mandriva's installer cd was the best for doing this that I had found), boot into the installer and go through the steps until I got to the partitioning.

I then setup a fat32 partition and some ext3 partitions and hit next, the installer formatted the partitions. I then quit the installer and put in the WinXP CD and restarted.

The Windows installer came up and was able to load the necessary files, I was able to recreate the partitions the way I wanted and install
 
Old 12-13-2006, 06:01 AM   #14
tayab82
LQ Newbie
 
Registered: Nov 2006
Posts: 2

Rep: Reputation: 0
this command format and assign the filesystem

mkfs.ext3 -c -c -L /yourlabel /dev/hdd1


mount -t ext3 /dev/hdd1 /yourlabel

once u have formated the drive then u have to mount the drive which is done by the above command
 
Old 12-13-2006, 06:27 AM   #15
saikee
Senior Member
 
Registered: Sep 2005
Location: Newcastle upon Tyne UK
Distribution: Any free distro.
Posts: 3,398
Blog Entries: 1

Rep: Reputation: 113Reputation: 113
I never zero a hard disk or its partitions.

When a user starts the cfdisk program with command like
Code:
cfdisk /dev/hda
he can delete any or all of the partitions, click "write" and everything is gone on a reboot.

People can be obsessed with the boot loader in the MBR as it is not supposed to be deleted. Every user needs it for booting and so when installing a new system it will automatically "overwrite" it. If needed One can zero it by
Code:
dd if=/dev/zero of=/dev/hda bs=512 count=1
That only zeros the first sector of 512 bytes which is where MBR is. It is a lot quicker than to zero say a 100Gb hdd, about 200,1000 times quicker. If the partition table, which is inside the MBR, is destroyed then all the information in the partitions will become inaccessible. Any later information will be just overwritten on the same space as the case of normal working with the hard disk. Does it really matter that we have every bit zero to start with? If you want to read this thread 100 times zeroing a disk will give ample time to do it.

People who have a need to "zero" every bit in the hard disk are bankers or secret agents who cannot let others to recover their information. Good forensic people can still recover your data after you have zeroed a hard disk a few times.
 
1 members found this post helpful.
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
How do I format my single, clean hard drive to Linux? deanh2nd Linux - Newbie 2 06-26-2006 10:24 AM
All i want to do is wipe my hard drive clean and install pclos Justin2021 Linux - Newbie 1 04-16-2006 12:53 AM
Wipe Hard Drive Prior to Install? usaf_sp SUSE / openSUSE 2 10-27-2005 01:49 PM
Does the Solaris 10 installer have to wipe the whole hard drive? Eerath Solaris / OpenSolaris 8 07-27-2005 10:15 AM
How can I wipe the hard drive between partitions? tstrickland Mandriva 2 06-14-2005 10:00 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:06 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration