lvm herstellen

Pagina: 1
Acties:

  • Sir Isaac
  • Registratie: September 2002
  • Laatst online: 21-05-2025
Situatie: een niet goed beheerde server (fedora core3)
2 harde schijven, software raid 1 met een lvm erop, met daarop diverse bestandssystemen. Een en ander is gemaakt mbv de fedora installer.
Op de een of andere manier is zijn de bestandssystemen corrupt geraakt.

Ik mag nu met 1 van de schijven proberen de data terug te halen.
Omdat het software raid is zou ik aan een schijf genoeg moeten hebben.
Ik heb een vermoeden dat het lvm niet goed meer werkt en dat als ik dat kan herstellen ik ook bij de data kan.
Ik begrijp inmiddels de principes van lvm, maar heb er zelf nog nooit mee gewerkt. Is het mogelijk om een lvm te herstellen of opnieuw te maken zonder dat de filesystems die erin zitten aangetast worden?

Nieuwe info:
Ik heb vgscan gerund met het volgende resultaat:
code:
1
2
3
4
5
6
7
8
9
vgscan -v
    Wiping cache of LVM-capable devices
    Wiping internal cache
  Reading all physical volumes.  This may take a while...
    Finding all volume groups
    Finding volume group "VolGroup00"
  Couldn't find device with uuid 'nIS7N6-h9Oo-6WNC-SSCY-LxA0-pJRG-oWDYIt'.
  Couldn't find all physical volumes for volume group VolGroup00.
  Volume group "VolGroup00" not found


Hij kan de volume dus niet activer omdat er een fysiek volume ontbreekt. Dat kan kloppen want dat fysieke volume was een software raid 1 array. Dat is er niet meer omdat er maar 1 schijf van het array over is. Omdat alle info in principe gewoon op die schijf staat (want raid 1) moet het volgens mij mogelijk zijn een nieuw lvm te maken met de harde schijf als fysiek volume ipv het raid array. Als je dan de info over de logische volumes hebt moet je de hele boel kunnen herstellen. Klopt dit? Zo ja, waar haal je de info over de logische volumes vandaan? Ik heb de initrd image van dit systeem uitgepakt, maar daar heb ik niks in kunnen vinden. Wel de lvm.conf:
code:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
devices {
    dir = "/dev"
    scan = [ "/dev" ]
    filter = [ "r|/dev/cdrom|" ]
    cache = "/etc/lvm/.cache"
    write_cache_state = 1
    sysfs_scan = 1
    md_component_detection = 0
}
log {
    verbose = 0
    syslog = 1
    overwrite = 0
    level = 0
    indent = 1
    command_names = 0
    prefix = "  "
}
backup {
    backup = 1
    backup_dir = "/etc/lvm/backup"
    archive = 1
    archive_dir = "/etc/lvm/archive"
    retain_min = 10
    retain_days = 30
}
shell {
    history_size = 100
}
global {
    umask = 077
    test = 0
    activation = 1
    proc = "/proc"
    locking_type = 1
    locking_dir = "/var/lock/lvm"
}
activation {
    missing_stripe_filler = "/dev/ioerror"
    mirror_region_size = 512
    reserved_stack = 256
    reserved_memory = 8192
    process_priority = -18
}


Waar staat de info over de logische volumes?

[ Voor 59% gewijzigd door Sir Isaac op 16-01-2006 14:39 ]


  • Sir Isaac
  • Registratie: September 2002
  • Laatst online: 21-05-2025
Het onderstaande bericht heb ik naar de lvm lijst gestuurd. Ik hoop dat er hier een lvm expert is die er iets mee kan:

I tried to following to recover the volume group:

vgscan -v
Wiping cache of LVM-capable devices
Wiping internal cache
Reading all physical volumes. This may take a while...
Finding all volume groups
Finding volume group "VolGroup00"
Couldn't find device with uuid 'nIS7N6-h9Oo-6WNC-SSCY-LxA0-pJRG-oWDYIt'.
Couldn't find all physical volumes for volume group VolGroup00.
Volume group "VolGroup00" not found

This basically says. "Hey, one device is missing"
Then I tried to restore the original configurartion. I copied sda2 (the
more or less unaffected disk), to sdb (the bad disk) and tried to adept
the lvm configuration:

save the config to a file
lvm vgcfgbackup -P

creat a new pv with the missing uuid:

pvcreate -u nIS7N6-h9Oo-6WNC-SSCY-LxA0-pJRG-oWDYIt /dev/sdb2

replaced a "device unknown" line in /etc/lvm/backup/VolGroup00
with /dev/sdb2. Then I tried to restore the lvm using the changed config
file, which failed:

lvm vgcfgrestore -v -t -f /etc/lvm/backup/VolGroup00 VolGroup00
Test mode: Metadata will NOT be updated.
Cannot change metadata for partial volume group VolGroup00
Restore failed.
Test mode: Wiping internal

================================================================

Then I did a second attempt:

I made a zero device:

echo '0 16000000 zero' | dmsetup create zeros

Changed lvm.conf in order to make the zero device a fall back option:

# missing_stripe_filler = "/dev/ioerror"
missing_stripe_filler = "/dev/mapper/zeros"

And tried to bring the vg up after I removed the pv that I created above
(sdb2):

lvm pvscan
Couldn't find device with uuid
'nIS7N6-h9Oo-6WNC-SSCY-LxA0-pJRG-oWDYIt'.
PV unknown device VG VolGroup00 lvm2 [74.53 GB / 0 free]
PV /dev/sda2 VG VolGroup00 lvm2 [74.41 GB / 64.00 MB free]
Total: 2 [148.94 GB] / in use: 2 [148.94 GB] / in no VG: 0 [0 ]

Now we have only the unaffected partition als pv.

lvchange -a y -P VolGroup00
Partial mode. Incomplete volume groups will be activated read-only.
Couldn't find device with uuid
'nIS7N6-h9Oo-6WNC-SSCY-LxA0-pJRG-oWDYIt'.
Couldn't find device with uuid
'nIS7N6-h9Oo-6WNC-SSCY-LxA0-pJRG-oWDYIt'.
device-mapper ioctl cmd 9 failed: Invalid argument
Couldn't load device 'VolGroup00-LogVol00'.
Couldn't find device with uuid
'nIS7N6-h9Oo-6WNC-SSCY-LxA0-pJRG-oWDYIt'.

This failed again. As I said, I am no expert and cannot solve this. For
these attempts were suggested by a kind soul in the irc channel. I hope
somebody can give me some more suggestions.
These operations I did from a ubuntu live cd with a 2.6.12 kernel and
lvm2.

De partial backup van de lvm configuratie heb ik online staan.