[Gllug] Recovering disk space

Mike Brodbelt mike at coruscant.demon.co.uk
Sun Dec 10 19:49:44 UTC 2006


Martin A. Brooks wrote:
> John G Walker wrote:
>> What's the easiest way to recover my disk space? 
> 
> If you're asking what I think you're asking then just wipe the partition
> table and, optionally, the MBR.
> 
> Both can be done at once with the 'dd' utility.
> 
> Something like:  dd if=/dev/zero of=/dev/<target> bs=1024k count=1
> 
> The 1024k is overkill, the partition table lives much closer to the
> start of the disk than that,  I just don't recall the offset.

The DOS style partition table typically found on x86 based hardware is a
data structure that lives within the MBR, starting 446 bytes from the
beginning of the sector, containing 4 16 byte entries. If you want to
nuke *just* the partition table on a disk, without trashing the MBR, you
can do:-

dd bs=1 count=64 skip=446 if=/dev/zero of=/dev/hda seek=446

However, each partition on the disk also has a partition boot sector
located at the beginning of the partition, which some software will look
for, assuming the first partition begins at the start of the disk. For
extended partitions, you'll also find "sub" partition tables, but that
doesn't cause a problem after the primary partition table is wiped out.

Mike

-- 
Gllug mailing list  -  Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug




More information about the GLLUG mailing list