A
A
Anton2018-03-17 22:55:38
RAID
Anton, 2018-03-17 22:55:38

How to restore disk partition after unsuccessful use of sgdisk?

I wanted to copy the disk layout with the sgdisk command and mixed up the arguments and erased the partition table. But before that I ran fdisk -l:

spoiler
Device Start End Sectors Size Type
/dev/sda1 2048 1026047 1024000 500M Linux RAID
/dev/sda2 1026048 105883647 104857600 50G Linux RAID
/dev/sda3 105883648 105887743 4096 2M BIOS boot
/dev/sda4 105887744 5860533134 5754645391 2.7T Linux RAID

those. the disk structure is preserved. The question is how to recreate it without loss? The server hasn't rebooted yet. I tried the cfdisk utility, but it only managed to make the 1st 3 partitions:
spoiler
Device Boot Start End Sectors Size Id Type
/dev/sda1 2048 1026047 1024000 500M fd Linux raid autodetect
/dev/sda2 1026048 105883647 104857600 50G 83 Linux
/dev/sda3 * 105883648 105887743 4096 2M 83 Linux

and the last one, which 2.7Tb does not work out, cuts 2TB each and that's it.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Anton, 2018-03-21
@tosick4

Resolved the issue. Based on the existing disk layout, I created the same one on both disks via cfdisk. Include disk partitions in an array:

mdadm --manage /dev/md0 --add /dev/sdba
.....

I waited for synchronization, just in case I reinstalled grub
and rebooted. Everything went up.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question