[en] How to mount LVM VG and restore data from it when one of its PV drives has failed

Howe­ver gre­at LVM is in Linux, allo­wing one to span sin­gle „par­ti­tion” over seve­ral hard dri­ves, if the under­ly­ing „dri­ves” are real hard dri­ves and not RAID volu­mes, You can get pret­ty fuc­ked when one of tho­se disks fails.

It took me seve­ral hours of googling aro­und and trials to find out how to reco­ver as much data as is possi­ble (meaning: all the data that is on rema­ining disks, the data on failed dri­ve is obvio­usly lost). So let’s try to add a short and wor­king reci­pe to Google.

  1. You do NOT have to pvcre­ate any bogus emp­ty PVs with fake UUIDs to repla­ce the failed dri­ve. LVM2 can be used in „par­tial” mode witho­ut all the drives.
  2. To use par­tial mode, You need to cre­ate /dev/ioerror devi­ce like this (I use Ubun­tu, in other distros it might be different): 
    • nano filename to cre­ate a text file whe­re a sin­gle line „0 9999999999 error” sans quotes sho­uld be placed
    • dmsetup create ioerror filename to cre­ate a devi­ce LVM will read inste­ad of mis­sing PV
    • ln -s /dev/mapper/ioerror /dev/ioerror so it’s just whe­re LVM will look for it
  3. After ioer­ror is cre­ated, just acti­va­te your volu­me gro­up in par­tial mode using vgchange -P -ay VOLNAME
  4. Mount it (it will mount in read only mode) and copy your pre­cio­us data

Che­ers to the­se guys who final­ly writ­ten some­thing I could use inste­ad of pvcre­ate and bogus hard dri­ves discussions.

7 komentarz do “[en] How to mount LVM VG and restore data from it when one of its PV drives has failed

  1. Many thanks for this. Your plan to give some­thing back to google wor­ked, and I’ve reco­ve­red the files I could­n’t access from my LVM (-1 disk), after the bac­kups had also failed. This is a much sim­pler solu­tion than the others I’d found elsewhere.

  2. slam­fu “It’s still hard to belie­ve only 8 Demo­crats and 1 Repu­bli­can voted aga­inst the repeal.”Yea, its votes like that that remind me we have a pro­blem not just with the GOP, but many of the spi­ne­less dems who are also either bought and paid for by the Wall St. donors or are too stu­pid to do the right thing.

  3. polga­ra: a few of them are copy­ri­gh­ted… when i got one like that i just hit “relo­ad” and took the next one!szarek (will): i LIKE it!jenty: yours is very cool!preposterous pon­de­rings: yeah this one did… teehe­ema­li­cio­us intent: i’ll be right there!s.c.g: ‘s awe­so­me when it works out so well! i did a few of them…

  4. إبداع يا محمود، أشكرك!هل من المقرر نشر تلك المذكرات؟ هل توجد مذكرات أخرى يمكن الاستعانة بها للتعرف على ذلك التاريخ؟

Możliwość komentowania została wyłączona.