Re: Best partitioning?

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

 



On 5/26/05, Michael Hennebry <hennebry@xxxxxxxxxxxxxxxxxxxxx> wrote:
> On Wed, 25 May 2005, Deron Meranda wrote:
> 
> > If nothing else you can always wipe the drive the forceful way;
> > boot into Linux (or the recovery disk) and do something like,
> >
> >    dd if=/dev/zero of=/dev/hda bs=512
> >
> > **Warning, that will delete EVERYTHING on the hard drive!
> 
> Is bs=512 necessary or useful?

It's good practice to always specify a blocksize when copying to a
block device (such as /dev/hda).  The blocksize is how many bytes
it writes with each "transaction".  It should ideally be exactly (or a
multiple of) the actual physical device's block size (which for ATA
disks is almost always 512 bytes).  If you specify 4096 for instance
the writing may be faster (although there is a point of diminishing
returns for making bs too large).  

> Would cp /dev/zero /dev/hda do the same thing?

No.  cp operates at the filesystem level, while dd operates
at the device level.  cp actually wouldn't work because /dev/hda
is not a filesystem (although it contains an image of a filesystem
which you access by mounting it first).  Also even if cp could
work, you still might want to erase the non-filesystem portions
of your disk (e.g., partition tables, boot blocks, swap partitions,
LVM structures, etc.)  dd lets you scribble across the whole storage
media without regards to filesystems, partitions, or anything.


Note that when scrubbing a disk in this fasion, it may take a
very long time for the dd command to complete on today's
large hard drives (hour or so).  If you don't care about erasing
all data, sometimes you just want to "soft" erase the disk which
means clearing the partition table, boot sectors, etc.  You can
quickly do that with,

  dd if=/dev/zero of=/dev/hdz bs=512 count=64

And future OS installs (whether Linux or Windows) would then
see the disk as being an uninitialized from-the-factory disk and
format it (which helps greatly if/when you have a corrupted
partition table that crashes the OS installers).

However, if you're selling your computer do the dd one the
whole disk.  That's also useful to do if you suspect you have some
bad blocks/tracks on the disk as it is one easy way to insure that
you've tried writing to every single sector.
-- 
Deron Meranda


[Index of Archives]     [Current Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Yosemite News]     [Yosemite Photos]     [KDE Users]     [Fedora Tools]     [Fedora Docs]

  Powered by Linux