So I had just put the installation images and other files on my main drive, initially sda(full drive)… switched sda with blank sdb and begun install.
long story I accidentally deleted partitions on sdb(full drive) rather than sda(empty drive) oops… Good thing for back-ups, and Testdisk allows me access to all data (all as far as i can tell but i’m sure there are errors).
Halted install and keystroked to reboot and bios setup to prevent any more disk writing. I believe that the partition table was written and that is all.
the old partition table was written in a laptop as a single drive sda. it is now sdb in a desktop untill it has partitions again.
If possible I would like to restore this drive to usable. if not, I would like to just re-partition the partitions to access data. not critical because of back-ups, but I would like to know how so that I can avoid a reload in this situation if ever again. I am lost with partitions and likely am having syntax and command errors.
I used Testdisk, it reads all the files. but It also reccognises the new, default install filesystem.
sdb is the drive, I am booting from sda:
>Disk /dev/sdb - 1000 GB / 931 GiB - HGST HTS721010A9E630
quick scan:
Disk /dev/sdb - 1000 GB / 931 GiB - CHS 121601 255 63
Partition Start End Size in sectors
>* Linux Swap 0 32 33 261 248 51 4206592
P Linux 261 248 52 5484 6 26 83892224
P Linux 5484 6 27 121601 57 56 1865422848
these are what install added, not the old partitions.
Deeper Search finds the old partitions but size is wrong as they overlap. pressing p allows me to access and c to copy all data.
I will post edit when deeper search completes... 1 million sectors left...
Recovery of /ect/lvm yields the metadata and filesystem layout I want to restore
# Generated by LVM2 version 2.02.98(2) (2012-10-15): Mon Aug 4 21:06:13 2014
contents = "Text Format Volume Group"
version = 1
description = "Created *after* executing '/sbin/lvextend -l +225311 /dev/system/home'"
creation_host = "linux-ans3.site" # Linux linux-ans3.site 3.11.6-4-desktop #1 SMP PREEMPT Wed Oct 30 18:04:56 UTC 2013 (e6d4a27) x86_64
creation_time = 1407207973 # Mon Aug 4 21:06:13 2014
system {
id = "QqYah9-RT2x-K5du-jx8S-JmOi-tfrk-Zv8KOz"
seqno = 5
format = "lvm2" # informational
status = "RESIZEABLE", "READ", "WRITE"]
flags = ]
extent_size = 8192 # 4 Megabytes
max_lv = 0
max_pv = 0
metadata_copies = 0
physical_volumes {
pv0 {
id = "YqWjBv-TgqE-cZLt-3FFL-jUM2-CzWW-wMHuvt"
device = "/dev/sda2" # Hint only
status = "ALLOCATABLE"]
flags = ]
dev_size = 1952704512 # 931.122 Gigabytes
pe_start = 2048
pe_count = 238367 # 931.121 Gigabytes
}
}
logical_volumes {
home {
id = "eYXIxQ-EA9L-amUe-IY3k-xRtS-oBrJ-z7ZSBh"
status = "READ", "WRITE", "VISIBLE"]
flags = ]
creation_host = "linux.site"
creation_time = 1407172889 # 2014-08-04 11:21:29 -0600
segment_count = 2
segment1 {
start_extent = 0
extent_count = 6400 # 25 Gigabytes
type = "striped"
stripe_count = 1 # linear
stripes =
"pv0", 0
]
}
segment2 {
start_extent = 6400
extent_count = 225311 # 880.121 Gigabytes
type = "striped"
stripe_count = 1 # linear
stripes =
"pv0", 13056
]
}
}
root {
id = "44viKo-uJd9-2voK-Qfx1-b8HR-sUVS-OQhC7p"
status = "READ", "WRITE", "VISIBLE"]
flags = ]
creation_host = "linux.site"
creation_time = 1407172889 # 2014-08-04 11:21:29 -0600
segment_count = 1
segment1 {
start_extent = 0
extent_count = 5120 # 20 Gigabytes
type = "striped"
stripe_count = 1 # linear
stripes =
"pv0", 6400
]
}
}
swap {
id = "gLbGK8-W0wD-ISDS-y2mj-fey9-IOIX-lLbyec"
status = "READ", "WRITE", "VISIBLE"]
flags = ]
creation_host = "linux.site"
creation_time = 1407172889 # 2014-08-04 11:21:29 -0600
segment_count = 1
segment1 {
start_extent = 0
extent_count = 1536 # 6 Gigabytes
type = "striped"
stripe_count = 1 # linear
stripes =
"pv0", 11520
]
}
}
}
}
This is where I get lost. I believe I need to use vgcfgrestore, but am not wanting to try too much and mess up and lose data.
:/srv/etc/lvm/backup # vgcfgrestore -f system /dev/sdb
Couldn't find device with uuid YqWjBv-TgqE-cZLt-3FFL-jUM2-CzWW-wMHuvt.
'system' does not contain volume group 'sdb'.
*** Error in `vgcfgrestore': double free or corruption (!prev): 0x0000000000ab6040 ***
======= Backtrace: =========
/lib64/libc.so.6(+0x7283f)[0x7f4766b8a83f]
/lib64/libc.so.6(+0x780ae)[0x7f4766b900ae]
/lib64/libc.so.6(+0x78db6)[0x7f4766b90db6]
/lib64/libdevmapper.so.1.02(dm_pool_destroy+0x2c)[0x7f47673332ac]
vgcfgrestore(backup_read_vg+0x9e)[0x452d7e]
vgcfgrestore(backup_restore_from_file+0xe)[0x452f4e]
vgcfgrestore(vgcfgrestore+0x24e)[0x43567e]
vgcfgrestore(lvm_run_command+0xbbb)[0x426ceb]
vgcfgrestore(lvm2_main+0x20c)[0x4271cc]
/lib64/libc.so.6(__libc_start_main+0xf5)[0x7f4766b39b05]
vgcfgrestore[0x416c2e]
======= Memory map: ========
00400000-004ea000 r-xp 00000000 fe:01 2490539 /sbin/lvm
006ea000-006ed000 r--p 000ea000 fe:01 2490539 /sbin/lvm
006ed000-006f0000 rw-p 000ed000 fe:01 2490539 /sbin/lvm
006f0000-00710000 rw-p 00000000 00:00 0
00a61000-00adb000 rw-p 00000000 00:00 0 [heap]
7f4766010000-7f4766026000 r-xp 00000000 fe:01 1572937 /lib64/libgcc_s.so.1
7f4766026000-7f4766225000 ---p 00016000 fe:01 1572937 /lib64/libgcc_s.so.1
7f4766225000-7f4766226000 r--p 00015000 fe:01 1572937 /lib64/libgcc_s.so.1
7f4766226000-7f4766227000 rw-p 00016000 fe:01 1572937 /lib64/libgcc_s.so.1
7f4766228000-7f4766291000 r-xp 00000000 fe:01 265352 /usr/lib64/libpcre.so.1.2.3
7f4766291000-7f4766490000 ---p 00069000 fe:01 265352 /usr/lib64/libpcre.so.1.2.3
7f4766490000-7f4766491000 r--p 00068000 fe:01 265352 /usr/lib64/libpcre.so.1.2.3
7f4766491000-7f4766492000 rw-p 00069000 fe:01 265352 /usr/lib64/libpcre.so.1.2.3
7f4766498000-7f47664c3000 r-xp 00000000 fe:01 1572965 /lib64/libtinfo.so.5.9
7f47664c3000-7f47666c2000 ---p 0002b000 fe:01 1572965 /lib64/libtinfo.so.5.9
7f47666c2000-7f47666c6000 r--p 0002a000 fe:01 1572965 /lib64/libtinfo.so.5.9
7f47666c6000-7f47666cb000 rw-p 0002e000 fe:01 1572965 /lib64/libtinfo.so.5.9
7f47666cb000-7f47666cc000 rw-p 00000000 00:00 0
7f47666d0000-7f47666f1000 r-xp 00000000 fe:01 1572948 /lib64/libselinux.so.1
7f47666f1000-7f47668f0000 ---p 00021000 fe:01 1572948 /lib64/libselinux.so.1
7f47668f0000-7f47668f1000 r--p 00020000 fe:01 1572948 /lib64/libselinux.so.1
7f47668f1000-7f47668f2000 rw-p 00021000 fe:01 1572948 /lib64/libselinux.so.1
7f47668f2000-7f47668f4000 rw-p 00000000 00:00 0
7f47668f8000-7f4766910000 r-xp 00000000 fe:01 1572901 /lib64/libpthread-2.19.so
7f4766910000-7f4766b0f000 ---p 00018000 fe:01 1572901 /lib64/libpthread-2.19.so
7f4766b0f000-7f4766b10000 r--p 00017000 fe:01 1572901 /lib64/libpthread-2.19.so
7f4766b10000-7f4766b11000 rw-p 00018000 fe:01 1572901 /lib64/libpthread-2.19.so
7f4766b11000-7f4766b15000 rw-p 00000000 00:00 0
7f4766b18000-7f4766cb6000 r-xp 00000000 fe:01 1572873 /lib64/libc-2.19.so
7f4766cb6000-7f4766eb5000 ---p 0019e000 fe:01 1572873 /lib64/libc-2.19.so
7f4766eb5000-7f4766eb9000 r--p 0019d000 fe:01 1572873 /lib64/libc-2.19.so
7f4766eb9000-7f4766ebb000 rw-p 001a1000 fe:01 1572873 /lib64/libc-2.19.so
7f4766ebb000-7f4766ebf000 rw-p 00000000 00:00 0
7f4766ec0000-7f4766ec7000 r-xp 00000000 fe:01 1572905 /lib64/librt-2.19.so
7f4766ec7000-7f47670c6000 ---p 00007000 fe:01 1572905 /lib64/librt-2.19.so
7f47670c6000-7f47670c7000 r--p 00006000 fe:01 1572905 /lib64/librt-2.19.so
7f47670c7000-7f47670c8000 rw-p 00007000 fe:01 1572905 /lib64/librt-2.19.so
7f47670c8000-7f4767106000 r-xp 00000000 fe:01 1572969 /lib64/libreadline.so.6.2
7f4767106000-7f4767306000 ---p 0003e000 fe:01 1572969 /lib64/libreadline.so.6.2
7f4767306000-7f4767308000 r--p 0003e000 fe:01 1572969 /lib64/libreadline.so.6.2
7f4767308000-7f476730e000 rw-p 00040000 fe:01 1572969 /lib64/libreadline.so.6.2
7f476730e000-7f4767310000 rw-p 00000000 00:00 0
7f4767310000-7f4767347000 r-xp 00000000 fe:01 1573049 /lib64/libdevmapper.so.1.02
7f4767347000-7f4767546000 ---p 00037000 fe:01 1573049 /lib64/libdevmapper.so.1.02
7f4767546000-7f4767547000 r--p 00036000 fe:01 1573049 /lib64/libdevmapper.so.1.02
7f4767547000-7f476754a000 rw-p 00037000 fe:01 1573049 /lib64/libdevmapper.so.1.02
7f476754a000-7f476754b000 rw-p 00000000 00:00 0
7f4767550000-7f4767555000 r-xp 00000000 fe:01 1573047 /lib64/libdevmapper-event.so.1.02
7f4767555000-7f4767754000 ---p 00005000 fe:01 1573047 /lib64/libdevmapper-event.so.1.02
7f4767754000-7f4767755000 r--p 00004000 fe:01 1573047 /lib64/libdevmapper-event.so.1.02
7f4767755000-7f4767756000 rw-p 00005000 fe:01 1573047 /lib64/libdevmapper-event.so.1.02
7f4767758000-7f476775b000 r-xp 00000000 fe:01 1572879 /lib64/libdl-2.19.so
7f476775b000-7f476795a000 ---p 00003000 fe:01 1572879 /lib64/libdl-2.19.so
7f476795a000-7f476795b000 r--p 00002000 fe:01 1572879 /lib64/libdl-2.19.so
7f476795b000-7f476795c000 rw-p 00003000 fe:01 1572879 /lib64/libdl-2.19.so
7f4767960000-7f4767980000 r-xp 00000000 fe:01 1572866 /lib64/ld-2.19.so
7f4767b00000-7f4767b3f000 r--p 00000000 fe:01 919373 /usr/lib/locale/en_US.utf8/LC_CTYPE
7f4767b44000-7f4767b48000 rw-p 00000000 00:00 0
7f4767b48000-7f4767b5c000 r-xp 00000000 fe:01 272184 /usr/lib64/libudev.so.1.4.0
7f4767b5c000-7f4767b5d000 ---p 00014000 fe:01 272184 /usr/lib64/libudev.so.1.4.0
7f4767b5d000-7f4767b5e000 r--p 00014000 fe:01 272184 /usr/lib64/libudev.so.1.4.0
7f4767b5e000-7f4767b5f000 rw-p 00015000 fe:01 272184 /usr/lib64/libudev.so.1.4.0
7f4767b5f000-7f4767b60000 rw-p 00000000 00:00 0
7f4767b77000-7f4767b78000 rw-p 00000000 00:00 0
7f4767b78000-7f4767b7f000 r--s 00000000 fe:01 269185 /usr/lib64/gconv/gconv-modules.cache
7f4767b7f000-7f4767b80000 rw-p 00000000 00:00 0
7f4767b80000-7f4767b81000 r--p 00020000 fe:01 1572866 /lib64/ld-2.19.so
7f4767b81000-7f4767b82000 rw-p 00021000 fe:01 1572866 /lib64/ld-2.19.so
7f4767b82000-7f4767b84000 rw-p 00000000 00:00 0
7f4767b84000-7f4767b85000 rw-p 00000000 00:00 0
7fff5b71a000-7fff5b73b000 rw-p 00000000 00:00 0 [stack]
7fff5b800000-7fff5b802000 r-xp 00000000 00:00 0 [vdso]
7fff5b802000-7fff5b804000 r--p 00000000 00:00 0 [vvar]
ffffffffff600000-ffffffffff601000 r-xp 00000000 00:00 0 [vsyscall]
Aborted
what am I missing do i need to use a different lv command? how does the device or volume group argument need to be in syntax? sdb? sda1?
thanks