I'm auctioning some hard drives and I want to wipe them and format them. I had all kinds of trouble creating boot floppies for some reason--even though no errors were reported I couldn't boot them. I ended up having success with making a bootable cd.
So I'm using autoclave to wipe the hard drive; is there a linux-based tool (bootable floppy or cd) I can use to format the hd? What flavor should I format it as? Do I need anything other than fdisk?
Hi Todd!
Newbie here myself, but here's what I would do... very simple, though no gui involved:
At a prompt, logged in as ROOT:
(1) unmount all partitions on the drive in question, if any are mounted. Replace /dev/XXX1 with the correct id for the drive (I.e. first partition on slave drive on first IDE controller in your system is /dev/hdb1, master on second controller is /hdc1...). The "mount" command will list all mounted partitions.
umount /dev/XXX1
umount /dev/XXX2
etc.
(2) Find the exact size of the drive, unformatted. Replace /dev/XXX with the correct designation for the drive (e.g. /dev/hdb).
cfdisk /dev/XXX
You may have to type the command "p" to print the partition table to the screen for cfdisk to tell you the size of the drive. I don't recall. I think it give the info in terms of a "block size" which is 1k at least for me, and a number of blocks. If you don't have cfdisk, you can get this info with fdisk as well. According to the man pages, cfdisk is the most reliable of the "fdisk" type programs, between fdisk, cfdisk, and sfdisk. It's also easier to use. cfdisk is on the Mandrake CDs.. so you should be able to install it with "urpmi cfdisk" if you don't have it. Enter "q" to quit out of cfdisk.
(3) Erase all data on the drive... be VERY careful to enter the correct device name for the drive here, or you will irrecoverably wipe out a different drive! Replace /dev/XXX with the drive's designation. "bs" is the block size. "count" is the number of blocks. All that matters with those parameteres is that bs*count = the total number of bytes on the drive.
dd if=/dev/null of=/dev/XXX bs=1024 count=999999
This will replace all bytes on the drive with a NULL, or empty byte. It might be possible to use if=/dev/random instead... this will make forensic analysis of your drive with hi-tech equipment much less feasible, if possible at all. I'm not positive about the ability to use /dev/random, though. It may run very slowly? Perhaps someone else could comment. If you use /dev/random, one consideration is that I am sure you will have to blank the first part of the drive (say, 64k or so) so the partition table is blank and won't confuse any fdisk tools or the bios. This would just be a second dd command, using /dev/null, with a count=64.
(4) That's all you _have_ to do. If you want to...
create a partition table and an empty partition, say, fat32, then go back in to cfdisk:
cfdisk /dev/XXX
cfdisk should tell you that there is no partition table and ask you if you want to create a new one. Say yes. "?" lists available commands. "p" prints the partition table. "g" changes the disk geometry. The geometry doesn't matter to Linux, but to other operatings systems it's very important. I highly reccommend setting the geometry to the default geometry printed on the hard disk's label, as this is the likeliest geometry for other bioses and os's to prefer. Set the geometry before creating any partitions. Don't use the "maximize disk usage" option, as it's incompatible with other operating systems. Type "n" to create a new partition. If you create a fat32 partition, use the "fat32 lba" partition type, and mark it bootable. Only create one primary fat32 partition, as this is what Windows would do. Windows creates all additional partitions within an Extended partition. When you're done, "q" to quit and it will prompt you to write the table to disk. Say yes.
(5) If you created a new partition, format it. If it's fat32, I recommend formatting it under Linux: The format might have problems under DOS or Windows unless the beginning of the partition is blank (for example it would not be blank if you used the /dev/random option with the dd command... ) Note the "1" at the end of the device name, for the first partition. You'll have to repeat this step several time if you created multiple partitions. "-c" checks for bad sectors and creates a bad sector table on the drive.
mkfs.vfat -c /dev/XXX1
You can copy dos system files to the drive if you wish it to be bootable...
Hope I wasn't too verbose.
Asa
____________________________________________________ Want to buy your Pack or Services from MandrakeSoft? Go to http://www.mandrakestore.com Join the Club : http://www.mandrakeclub.com ____________________________________________________
