Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
2006.1 live cd installer kills partitiontable on all hardriv
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Installing Gentoo
View previous topic :: View next topic  
Author Message
amiga23
n00b
n00b


Joined: 01 Sep 2006
Posts: 5

PostPosted: Fri Sep 01, 2006 11:28 am    Post subject: 2006.1 live cd installer kills partitiontable on all hardriv Reply with quote

Hi,

I have 2 harddrives.

/dev/hda 40GB which I want to use as my gentoo installation drive
and
/dev/hdb which contains a logical volumegroup with 2 logical volumes.

In the installer I did only select /dev/hda and did delete all partitions and let the installer create recomended partitions.
After pressing the "install" button, /dev/hda was reconfigured as wanted, but it did also delete the partitiontable on /dev/hdb :-( :evil:

How can I get the data back on /dev/hdb?????

Please help me and add a BIG WARNING to your homepage to prevent all the other users out there from destroying their data.

Thanks
AMIGA23
Back to top
View user's profile Send private message
SinoTech
Advocate
Advocate


Joined: 20 Mar 2004
Posts: 2579
Location: Neunkirchen / Saarland / Germany

PostPosted: Fri Sep 01, 2006 4:08 pm    Post subject: Reply with quote

Maybe testdisk can help.

Cheers,

Sino
_________________
Help to answer the unanswered
Back to top
View user's profile Send private message
amiga23
n00b
n00b


Joined: 01 Sep 2006
Posts: 5

PostPosted: Tue Sep 05, 2006 12:34 pm    Post subject: Reply with quote

Hi SinoTech,

thank you for the hint with testdisk. It is a great program, but it can only recover phisical volumes in partitions. On my HDD it does not find anything. I have talked to one the developers of testdisk and he said, that it is not able to detect VGs and LVs, but only PVs.

Does someone know, which blocks the installer does overwrite? Are that only the first few? It is possible to just run
pvcreate /dev/hdb
again and the VG and LV information is kept?

How does LVM detect that hdb is a physical volume? maybe only some few bits at teh beginning of the HDD are overwriten?

As it was SuSE 8 with kernel 2.4 it was LVM1.

Best regrads
Thomas
Back to top
View user's profile Send private message
syg00
l33t
l33t


Joined: 23 Aug 2004
Posts: 907
Location: Brisbane, AUS

PostPosted: Tue Sep 05, 2006 1:12 pm    Post subject: Reply with quote

amiga23 wrote:
Does someone know, which blocks the installer does overwrite? Are that only the first few? It is possible to just run
pvcreate /dev/hdb again and the VG and LV information is kept?
I would think only the partition tale itself (i.e. no data) got mangled.
If testdisk found nothing, that would probably indicate the whole volume was a single PV.
Have a look at this thread on something similar. Seems there might be hope for you, although it wasn't specifically the new Gentoo installer (which I refuse to use BTW).
_________________
Got a good backup ??? - any advice offered presumes you have.
Back to top
View user's profile Send private message
amiga23
n00b
n00b


Joined: 01 Sep 2006
Posts: 5

PostPosted: Thu Sep 07, 2006 7:21 pm    Post subject: Reply with quote

:D
It works again
*PARTY*

LVM2 does store the metadata after the partition table, starting from 200h if the whole HDD is used as PV. So it should be enough to set all blocks from 4h - 1FFh to zero. 0h - 3h must be "48 4D 01".
Code:

000001b0  48 4D 01 00 00 00 00 00  00 00 00 00 00 00 00 00


LVM1 does use the partition table to store it's metadata if the whole HDD is used as PV.
On my system the installer did destroy the following bytes:

Code:

000001b0  01 00 00 00 01 00 00 00  02 00 00 00 70 59 00 00
000001c0  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00


1BCh - 1BFh should be the size of the PV (in sectors), but it is not really important.
1C0h - 1CFh descibes the amount of PEs used for the first volume group and should look like the following:

Code:

000001c0  02 00 00 00 00 20 00 00  E1 E8 00 00 E1 E8 00 00


The amount of PEs used does the command "pvdata" deliver:
Code:

--- NEW Physical volume ---
PV Name               /dev/hdb
VG Name               vg_250GB
PV Size               11.18 MB [22896 secs]
PV#                   1
PV Status             available
Allocatable           NO
Cur LV                0
PE Size (KByte)       0
Total PE              0
Free PE               0
Allocated PE          0
PV UUID               UGtx1T-zuMy-Ubw5-50ao-Dr3x-7RTV-jfayFB

--- Volume group ---
VG Name
VG Access             read/write
VG Status             NOT available/resizable
VG #                  1
MAX LV                256
Cur LV                2
Open LV               0
MAX LV Size           255.99 GB
Max PV                256
Cur PV                1
Act PV                1
VG Size               232.88 GB
PE Size               4 MB
Total PE              59617
Alloc PE / Size       59617 / 232.88 GB
Free  PE / Size       0 / 0
VG UUID               iSo4NJ-En7j-eTvq-UTD9-Wvtr-RsQj-xtxhfu


"Alloc PE" is the number we need. But we need to convert it to hexadecimal so 59617d = E8E1h, but as high and low byte are swaped E1E8 is the data to enter.

The partition table ends at 1FFh. 55 AA marks the end of the partition table. For lvm 1FEh and 1FFh must be zero.

That was all I had to change and now pvdata does still show a wrong "PV Size" (11.18 MB [22896 secs]), but I can access my logical volumes anyway.

I hope this helps anybody else having a similar problem.

Thanks to everybody who gave me hints.
Back to top
View user's profile Send private message
syg00
l33t
l33t


Joined: 23 Aug 2004
Posts: 907
Location: Brisbane, AUS

PostPosted: Thu Sep 07, 2006 10:26 pm    Post subject: Reply with quote

Well done ... 8) 8)
Where did you get all this info ??? - I only ask out of curiousity. I am "interested" (to put it mildly) how things might be arranged where a valid boot loader and partition table are needed. Say a PV on a boot disk containing a small boot partition.
Loaders (especially lilo) use more than the first sector on a boot disk.

Better go find some spare disks and a test system I can play on - I like the concept of LVM but don't understand it enough to have used it yet.
_________________
Got a good backup ??? - any advice offered presumes you have.
Back to top
View user's profile Send private message
loki99
Advocate
Advocate


Joined: 10 Oct 2003
Posts: 2056
Location: Vienna, €urope

PostPosted: Thu Sep 07, 2006 10:48 pm    Post subject: Re: 2006.1 live cd installer kills partitiontable on all har Reply with quote

amiga23 wrote:
Please help me and add a BIG WARNING to your homepage to prevent all the other users out there from destroying their data.

Hi amiga23!

I'm sorry to hear that you had so much troubles and I'm glad to hear that you got your data back. :wink:
But could you please file a bug about this on https://bugs.gentoo.org/ so the developers are aware of this problem?

TIA,
loki99
Back to top
View user's profile Send private message
Sgeorg
Apprentice
Apprentice


Joined: 01 Apr 2003
Posts: 152

PostPosted: Sun Oct 29, 2006 2:19 pm    Post subject: Reply with quote

Hi!

How do you solve this problem if the lvm2 PV is on the 4th partition?

https://www.redhat.com/archives/linux-lvm/2006-October/msg00121.html

Georg
Back to top
View user's profile Send private message
syg00
l33t
l33t


Joined: 23 Aug 2004
Posts: 907
Location: Brisbane, AUS

PostPosted: Sun Oct 29, 2006 9:33 pm    Post subject: Reply with quote

Testdisk as mentioned above should do the job.
_________________
Got a good backup ??? - any advice offered presumes you have.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Installing Gentoo All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum