Hy, I accidentially overwrote the first 1M of my harddisk on linux (using dd). So, the partition-table is gone. I can still access all partition (except the first one) using /dev/sda2 (and so on), so the data is still there. I only need the partition boundaries to restore the table. How can I do this? The Linux-Kernel must still know them because all mount-points still work. fdisk -l /dev/sda
doesn't work because it acctualy reads the partition table.
Thanks!
Answer
The extents of the partitions can be read from /sys/block/sda/sda1/start
, /sys/block/sda/sda1/size
and so on. The values are in sectors. Write down these values before doing anything else, especially rebooting.
Once you have the values, you can recreate the partitions with fdisk
. Use the u
command to switch the unit to sectors, then create the partitions by entering
n
p
rimary/l
ogical/e
xtended- partition number (except for logical partitions: do them in order)
- initial sector
+
size in sectors
Comments
Post a Comment