LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   How best to format/wipe hard drive clean? (https://www.linuxquestions.org/questions/linux-newbie-8/how-best-to-format-wipe-hard-drive-clean-449098/)

blnkgcrsr001 05-27-2006 01:36 PM

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)...

MasterC 05-27-2006 01:40 PM

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

blnkgcrsr001 05-27-2006 01:53 PM

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...

MasterC 05-28-2006 03:40 AM

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

pixellany 05-28-2006 08:52 AM

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....

MasterC 05-28-2006 04:19 PM

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

pixellany 05-28-2006 04:32 PM

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...:confused: :confused: :confused:

[Rado] 05-28-2006 04:35 PM

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.

pixellany 05-28-2006 04:39 PM

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??

Michael_aust 05-28-2006 05:38 PM

gparted is similar but free in both ways

http://gparted.sourceforge.net/livecd.php

MasterC 05-29-2006 05:46 PM

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...:confused: :confused: :confused:

:) 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

ilerdl 07-11-2006 01:06 PM

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

rutabega man 12-12-2006 05:38 AM

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

tayab82 12-13-2006 06:01 AM

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

saikee 12-13-2006 06:27 AM

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.


All times are GMT -5. The time now is 10:56 AM.