Page 1 of 1

when starts partiton 1?

Posted: Tue Jun 02, 2009 6:37 pm
by frindly
i backup my root partition with
dd if=/dev/sda1 of=/backup/debian.img
and the bootsektor with
dd if=/dev/sda of=/backup/boot.img bs=512 count=
in this way i backup the first 32kb of the hdd.
there is the bootsector, but where is the partiton table? after the bootsector comes some code of grub, correct? where is the bootsector, where starts the firtst partition?
i played with dd and deletet the first 256kb with zeros. nothing works anymore. so i used testdisk to find the partition with the backup files, restored the partitiontable and then restore the bootpartiton and the bootsector with dd.
with the boot.img i restored 32kb of the first data of the hdd. is in the first 32kb the partition table?

Posted: Tue Jun 02, 2009 6:58 pm
by admin
The first 512 bytes (1st sector in msdos tables which are the most common type) are the contents of the MBR. It contains both the four primary partitions and the very first instructions to boot.

In general the MBR contains grub-stage1 which allows to load grub-stage-1.5 which can be stored before the 1st partition after the MBR.

There is no fixed sector for the first partition it depends. You can use sfdisk to save/restore your partition table. You can also write a parted script to recreate your partition table automatically.

Posted: Wed Jun 03, 2009 7:01 pm
by frindly
hmm how would look such a script?
how i wrote, till now i backup the first 63 sectors with dd into a image file.
with this solution i will backup all necessary data, correct???

Posted: Thu Jun 11, 2009 9:50 am
by admin
It's not a script to backup the partition table, just a script that will always recreate the partition the same way.

You can do something like that:

Code: Select all

echo 'mkpart primary ext2 0 100%' | parted -s /dev/sda