Missing partition table on Linux/RAID/LVM/ext4
Posted: 19 Jul 2017, 15:07
Need a little help with what appears to be a missing partition table on one drive. I was working on zeroing out some bad sectors on a drive that was showing read errors. As part of that, I ran 'fdisk -lu /dev/sdb' early on the session to check where partition blocks started and ended and got:
Exactly as expected. I continued working on specific blocks and got through a couple. I was checking what block a specific file was in and happened to run fdisk again:
No idea what happened, but obviously something screwed up the partition table. I have not rebooted to everything work right now as expected, but this obviously has me a bit concerned that it will break as soon as I do.
/dev/sdb should have /dev/sdb1 on it. Then /dev/md2 is all of /dev/sdb1. Then I have an LVM2 spanned partition (RAID 0) sitting on top of that and spread across /dev/md2 and /dev/sdc1. That LV is mounted as /dev/maildata/data and is has an ext4 filesystem.
TestDisk immediately finds two missing partitions, but I'm not sure which to recover or how to ensure the parameters right. As I understand it, this needs to be exactly correct or my entire LV will stop working. I still have access to /etc/lvm/backup, and I've seen ways to recreate the format with that backup. I just don't fully understand the relationship between all of the devices on top of each other and what does what. Output from TestDisk:
I would guess only one of these are correct to add back to the partition table. Also, the start, end, and size look different than what came out of fdisk. I want to make sure I'm getting these exactly correct to ensure this works.
Could anyone provide some insight into what I need to do?
Code: Select all
root@mail:/# fdisk -lu /dev/sdb
Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders, total 1953525168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0009bc71
Device Boot Start End Blocks Id System
/dev/sdb1 * 63 1953520064 976760001 fd Linux raid autodetect
Code: Select all
root@mail:~# fdisk -lu /dev/sdb
Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders, total 1953525168 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000
Disk /dev/sdb doesn't contain a valid partition table
/dev/sdb should have /dev/sdb1 on it. Then /dev/md2 is all of /dev/sdb1. Then I have an LVM2 spanned partition (RAID 0) sitting on top of that and spread across /dev/md2 and /dev/sdc1. That LV is mounted as /dev/maildata/data and is has an ext4 filesystem.
TestDisk immediately finds two missing partitions, but I'm not sure which to recover or how to ensure the parameters right. As I understand it, this needs to be exactly correct or my entire LV will stop working. I still have access to /etc/lvm/backup, and I've seen ways to recreate the format with that backup. I just don't fully understand the relationship between all of the devices on top of each other and what does what. Output from TestDisk:
Code: Select all
TestDisk 6.13, Data Recovery Utility, November 2011
Christophe GRENIER <grenier@cgsecurity.org>
http://www.cgsecurity.org
Disk /dev/sdb - 1000 GB / 931 GiB - CHS 121602 255 63
Partition Start End Size in sectors
>D Linux LVM 0 1 1 121600 254 63 1953520002
D Linux RAID 0 1 1 121600 254 63 1953520002 [md2]
Could anyone provide some insight into what I need to do?