[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: clearing data from partitions



>> I have a large hard drive divided into many partitions so that I
>> can try new distros. Two large partitions hold Sarge and Unstable.
>> 
>> Grub picks up everything and I have a quite large menu.lst file.
>> I want to find the safest way to 'clear' the contents of partitions
>> that I no longer need.
>> 
>> I know I can use fdisk or cfdisk to delete each partition, immediately
>> recreate and then format with say ext3.
>> Is there any simple way to accomplish what I want?
>> 
>> John.
>> 
>> P.S. I've tried deletions in the menu.lst file, but the next time
>> try another distro, grub picks up everything again.
>
> One quick, but kludgy way to do it would be say..
> 
> cat /dev/zero to each of the partitions for a few seconds.
> that will murder the partition, and it will end up basically broken.
> at that point, youd want to mke2fs or something on each one.
> 
> If you make a text list of all the partitions you want to do this to
> you can script it!
> 
> something like..
> 
> bash#  for i in `cat partitions.txt`; do dd if=/dev/zero of=$i bs=1024
> count=50; mke2fs $i; done
> 
> that should go through the textfile, overwrite the first ~50k of each
> partition with zeroes
> then mke2fs it.

Whew.  A few comments (mixed to OP and replier):

(1) There is no need to delete, then recreate a partition before running
mke2fs.  You can just run mke2fs.  Or, just delete all of the files on the
existing file system.

(2) grub doesn't have any autodetection routines.  Either the installers for
the other distros are modifying that menu.lst file (which would actually be
pretty smart of them, although maybe not what you want), or else grub is
using a different menu.lst file than you think.

(3) If somehow there is some autodetection going on, then it will probably
"refind" your partition anyway if it has a file system on it.  If you want
to avoid that then you'll have to destroy the file system.  The suggested
method will work just fine for that.  But:

(4) Be extremely careful with that shell code.  You will destroy a lot of
data in a hurry, probably beyond recovery.  Take a long, hard look at the
contents of partitions.txt before you pull that trigger.

Good luck,
Andrew.

P.S. Please reply below a quoted response, not above.  It allows other
readers to follow the conversational thread.




Reply to: