D
D
dotzero2013-05-31 18:21:06
linux
dotzero, 2013-05-31 18:21:06

Is it possible to restore the partition table?

Today on one of the servers hetzner replaced one of the disks in the raid. I connected through the recovery system and when it became necessary to synchronize the old disk with the new one, when transferring the partition table, I mixed up the names of the old and new disks in the command

sgdisk -R /dev/sda /dev/sdb

. Can I somehow restore this raid to work?

Answer the question

In order to leave comments, you need to log in

3 answer(s)
S
Sergey Petrikov, 2013-05-31
@RicoX

You can try, but it will take a long time gpart -if /dev/sda
A quick option without keys.

M
merlin-vrn, 2013-05-31
@merlin-vrn

If the system is on the fly, partition information is still in memory. Namely, in /sys/block/sd?/sd??/start and /sys/block/sd?/sd??/size. They are in sectors. Start is literally the same as start in the partition table, and size is, well, size, entered as +sectors in fdisk. In general, you can write the partition table again using this information from / sys
In general, I would not have such a problem. It's not about neatness. It's just that partitioning the disk is very standard - if it's an MBR disk, then 2048..+127M is /boot (there is a 1M gap in front of it, as it is understood, because the partition starts in sector 2048), the rest is LVM PV. If this is a GPT disk, then 1M gap, then from sector 2048 to 4095 - 1M - bios_grub, then + 126M - /boot, the rest is LVM PV. If there are two disks, they are all Software RAID arrays.
This standardization is very, very helpful.

Y
YourChief, 2013-06-01
@YourChief

and if not on the fly, then testdisk

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question