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: Select all
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: Select all
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: Select all
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: Select all
--- 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.