Backing up your Partition Table.

By Pratik Shivarkar | Labels: , ,

You don't want your data go unsafe, don't you?
This one is common problem, getting your partition table corrupt.

So I always keep a Backup of it.
Which is more than easy, I'm using dd command, which for coping/converting/cloning/and imaging the file.
So the drives, because everything in Linux is file, except your NIC.

For those who don't know where is the partition table, -
Partition table is a part of your MBR ( Master Boot Record )
The MBR size totals to 512 byte ( 1 Byte = 8 Bits, 1 Byte is used to store one binary value either 0 or 1 )
The Structure of MBR is like this
Address (Decimal) Content Size (Bytes)
0 Code Area 440
440 Optional Disk Signature 4
444 NULL 2
446 Table of Primary Partition 64
510 55h MBR Singnature 1
511 AAh MBR Signature 1

Totaling 512 Bytes

First, We will back up the MBR.

dd if=/dev/hda of=mbr.bak bs=512 count=1

Now to Restore the Backup MBR

dd if=mbr.bak of=/dev/hda skip=446 seek=446 bs=1 count=64

/dev/hda might change as per your Hard Drive setup.
For SCSI drives it will list as /dev/sda
To List your drives and partition
You can always use fdisk –l

Technorati Tags: , , , , ,

Reblog this post [with Zemanta]

blog comments powered by Disqus


Your Ad Here