You are not logged in.

#1 2015-03-09 22:05:03

theblackdog
Member
Registered: 2014-08-23
Posts: 14

[SOLVED] The best way to recover a Partition Table. (LVM)

I just did something really stupid I accidently had a typo in gdisk and changed the wrong hard drive partition table.
So before I do something really stupid I post here.

The hard drive is still mounted and I luckily have the output of the former partition table, this is it:

fdisk -l /dev/sdb

Festplatte /dev/sdb: 2,7 TiB, 3000558944256 Bytes, 732558336 Sektoren
Einheiten: Sektoren von 1 * 4096 = 4096 Bytes
Sektorgröße (logisch/physikalisch): 4096 Bytes / 4096 Bytes
E/A-Größe (minimal/optimal): 4096 Bytes / 4096 Bytes
Festplattenbezeichnungstyp: dos
Festplattenbezeichner: 0x00028375

Device     Boot     Start       End   Sectors  Size Id Type
/dev/sdb1             256 366211193 366210938  1,4T 83 Linux
/dev/sdb2       366211194 732558335 366347142  1,4T 83 Linux

The partition table was a LVM partition table.

This is the current one:

gdisk -l /dev/sdb
GPT fdisk (gdisk) version 0.8.10

Partition table scan:
  MBR: protective
  BSD: not present
  APM: not present
  GPT: present

Found valid GPT with protective MBR; using GPT.
Disk /dev/sdb: 732558336 sectors, 2.7 TiB
Logical sector size: 4096 bytes
Disk identifier (GUID): DA7956E1-B120-4F78-925A-B5DDE14E7C9C
Partition table holds up to 128 entries
First usable sector is 6, last usable sector is 732558330
Partitions will be aligned on 256-sector boundaries
Total free space is 250 sectors (1000.0 KiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1             256          131327   512.0 MiB   EF00  EFI
   2          131328        13238527   50.0 GiB    8E00  Arch
   3        13238528       732558330   2.7 TiB     8300  EXT

I really hope someone can help me with that, I'm currently a total nerve wrack.
If its a more or less impossible task (well or there is no guarantee that it works) I will buy a new Drive tomorow to save the currently still mounted files.

Thank You!

[EDIT]
Forget about copying the file system isn't really accessible, I can open a few folders but everything in there are 0byte files

Last edited by theblackdog (2015-03-10 14:16:59)

Offline

#2 2015-03-09 23:17:59

theblackdog
Member
Registered: 2014-08-23
Posts: 14

Re: [SOLVED] The best way to recover a Partition Table. (LVM)

So because no one gave me a answer so far (ok it's already pretty late and I was a bit imatient) I took the leap of faith and used fdisk to recreate the partition sheme,  so far everything seems to work.

There is only one thing that would interest me, as far as I know a GPT partition table is bigger than a dos partition table, how big is the risk that data got corrupted because of the bigger table?

I will mark the thread as solved after that.

Offline

#3 2015-03-10 06:21:26

chaonaut
Member
From: Kyiv, Ukraine
Registered: 2014-02-05
Posts: 382

Re: [SOLVED] The best way to recover a Partition Table. (LVM)

if you operated only with gdisk, it changed only partition table. this action by itself does not write anything to partitions / filesystems.
so if you have the output of previous partition table, reverting to prevous partition table should be sufficient.
note that start & end sector numbers of partitions MUST be EXACTLY the same in this case.


— love is the law, love under wheel, — said aleister crowley and typed in his terminal:
usermod -a -G wheel love

Offline

Board footer

Powered by FluxBB