Wiped out my Partition table
Posted: 18 Feb 2021, 21:10
I inadvertently overwrote the partition table on an Ubuntu system using LVM residing on, I believe a HW RAID1.
The system is/was running Ubuntu 18.04 LTS Server.
I was trying to add an external 10TB USB disk for local backups but I wrote a GPT partition table to the system disk instead of the USB disk.
I don't think I have done anything else that has modified the disks since updating the partition table.
The original machine is powered off right now.
I have used dd to make take an image copy of the disk and am trying out testdisk on that image file.
Below is the log file from an initial inspection of it.
Questions:
1. Is there a way to just extract the files from the LVM partition?
2. If I run testdisk from a liveDVD and have it update the GPT table would that make my original system bootable again?
3. Can I update the GPT table on the image file. Save it and then on a spare machine write that updated image to a raw disk to
make it bootable? If so, what tool to use for that?
Thanks for any help.
------------------------------------------------------
Using locale 'en_US.UTF-8'.
Thu Feb 18 13:54:55 2021
Command line: TestDisk /log /logname /home/john/testdiskLog.log /diske/backup_image_sda.img
TestDisk 7.0, Data Recovery Utility, April 2015
Christophe GRENIER <grenier@cgsecurity.org>
http://www.cgsecurity.org
OS: Linux, kernel 4.15.0-135-generic (#139-Ubuntu SMP Mon Jan 18 17:38:24 UTC 2021) x86_64
Compiler: GCC 7.2
ext2fs lib: 1.44.1, ntfs lib: libntfs-3g, reiserfs lib: none, ewf lib: none, curses lib: ncurses 6.0
User is not root!
Hard disk list
Disk /diske/backup_image_sda.img - 999 GB / 931 GiB - CHS 121535 255 63 (RO), sector size=512
Partition table type (auto): Intel
Media is opened in read-only.
Geometry from i386 MBR: head=255 sector=63
Disk /diske/backup_image_sda.img - 999 GB / 931 GiB (RO)
Partition table type: Intel
Analyse Disk /diske/backup_image_sda.img - 999 GB / 931 GiB - CHS 121535 255 63 (RO)
Geometry from i386 MBR: head=255 sector=63
BAD_RS LBA=1 0
Current partition structure:
1 P EFI GPT 0 0 2 121534 76 14 1952448511
Bad relative sector.
No partition is bootable
search_part()
Disk /diske/backup_image_sda.img - 999 GB / 931 GiB - CHS 121535 255 63 (RO)
Linux 6 127 58 25 126 37 305152
ext3 blocksize=1024 Sparse_SB, 156 MB / 149 MiB
Linux LVM 25 127 38 121533 254 63 1952034047
LVM2, 999 GB / 930 GiB
interface_write()
1 * Linux 6 127 58 25 126 37 305152
2 P Linux LVM 25 127 38 121533 254 63 1952034047
simulate write!
No extended partition
TestDisk exited normally.
The system is/was running Ubuntu 18.04 LTS Server.
I was trying to add an external 10TB USB disk for local backups but I wrote a GPT partition table to the system disk instead of the USB disk.
I don't think I have done anything else that has modified the disks since updating the partition table.
The original machine is powered off right now.
I have used dd to make take an image copy of the disk and am trying out testdisk on that image file.
Below is the log file from an initial inspection of it.
Questions:
1. Is there a way to just extract the files from the LVM partition?
2. If I run testdisk from a liveDVD and have it update the GPT table would that make my original system bootable again?
3. Can I update the GPT table on the image file. Save it and then on a spare machine write that updated image to a raw disk to
make it bootable? If so, what tool to use for that?
Thanks for any help.
------------------------------------------------------
Using locale 'en_US.UTF-8'.
Thu Feb 18 13:54:55 2021
Command line: TestDisk /log /logname /home/john/testdiskLog.log /diske/backup_image_sda.img
TestDisk 7.0, Data Recovery Utility, April 2015
Christophe GRENIER <grenier@cgsecurity.org>
http://www.cgsecurity.org
OS: Linux, kernel 4.15.0-135-generic (#139-Ubuntu SMP Mon Jan 18 17:38:24 UTC 2021) x86_64
Compiler: GCC 7.2
ext2fs lib: 1.44.1, ntfs lib: libntfs-3g, reiserfs lib: none, ewf lib: none, curses lib: ncurses 6.0
User is not root!
Hard disk list
Disk /diske/backup_image_sda.img - 999 GB / 931 GiB - CHS 121535 255 63 (RO), sector size=512
Partition table type (auto): Intel
Media is opened in read-only.
Geometry from i386 MBR: head=255 sector=63
Disk /diske/backup_image_sda.img - 999 GB / 931 GiB (RO)
Partition table type: Intel
Analyse Disk /diske/backup_image_sda.img - 999 GB / 931 GiB - CHS 121535 255 63 (RO)
Geometry from i386 MBR: head=255 sector=63
BAD_RS LBA=1 0
Current partition structure:
1 P EFI GPT 0 0 2 121534 76 14 1952448511
Bad relative sector.
No partition is bootable
search_part()
Disk /diske/backup_image_sda.img - 999 GB / 931 GiB - CHS 121535 255 63 (RO)
Linux 6 127 58 25 126 37 305152
ext3 blocksize=1024 Sparse_SB, 156 MB / 149 MiB
Linux LVM 25 127 38 121533 254 63 1952034047
LVM2, 999 GB / 930 GiB
interface_write()
1 * Linux 6 127 58 25 126 37 305152
2 P Linux LVM 25 127 38 121533 254 63 1952034047
simulate write!
No extended partition
TestDisk exited normally.