Skip to contentSkip to conversation

how to recover lvm after OS re-install

linux-lvm lemon lemon 2 participants 3 messages Mar 15, 2008

lore
Share & tools
lore
#0 lore raw

Hello,

I had to re-install my OS from scratch after a software problem (perl).

Now struggling to recover the logical volume I had before the server crash. It is full of files, data etc. OS was not (and is not) on that hard disk. That is a separate data partition (actually a hard raid array). There is no any hard disk failure. And, I didn't formatted this disk during re-install OS. So, I think, the data should be there untouched.

What I did:
#pvcreate /dev/sdc
#vgcreate -s 32M raid_vg0 /dev/sdc (I used the same PE size as before) #lvcreate -l 23839 -n raid_lv0 raid_vg0 (maximum extents from vgdisplay)

Unfortunately, it complains when mounting raid_lv0:
#mount: you must specify the filesystem type

Obviously, if I format it, there will be no problem in mounting, but will lose all the data on it.

Is there a way to mount this lv without losing data? Or, should I forget about all the data on that disk?

Please help!

Best wishes,
Mufit

Some info:
[root@server dev]# pvdisplay
--- Physical volume ---

  PV Name               /dev/sdc
  VG Name               raid_vg0
  PV Size               745.00 GB / not usable 32.00 MB
  Allocatable           yes (but full)
  PE Size (KByte)       32768
  Total PE              23839
  Free PE               0
  Allocated PE          23839
  PV UUID               2Xd3p7-KlaX-SIbW-vCKH-uJ73-Ldeh-QG0P9r

[root@server dev]# vgdisplay
--- Volume group ---
VG Name raid_vg0
System ID

  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  2
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                1
  Open LV               0
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               744.97 GB
  PE Size               32.00 MB
  Total PE              23839
  Alloc PE / Size       23839 / 744.97 GB
  Free  PE / Size       0 / 0
  VG UUID               MUz02m-JWYb-f2gP-8PBc-0y2I-a1y8-sZfrOx

[root@server dev]# lvdisplay
--- Logical volume ---

  LV Name                /dev/raid_vg0/raid_lv0
  VG Name                raid_vg0
  LV UUID                2yoy12-qASz-qdmy-AcB4-iaG3-XGN8-mwv9VS
  LV Write Access        read/write
  LV Status              available
  # open                 0
  LV Size                744.97 GB
  Current LE             23839
  Segments               1
  Allocation             inherit
  Read ahead sectors     0
  Block device           253:0
      ____________________________________________________________________________________

Never miss a thing. Make Yahoo your home page.
http://www.yahoo.com/r/hs

#1 lore raw
Quoted 5 lines · lemon lemon

Now struggling to recover the logical volume I had before the server crash. It is full of files, data etc. OS was not (and is not) on that hard disk. That is a separate data partition (actually a hard raid array). There is no any hard disk failure. And, I didn't formatted this disk during re-install OS. So, I think, the data should be there untouched.

So far so good.

Quoted 4 lines

What I did:
#pvcreate /dev/sdc
#vgcreate -s 32M raid_vg0 /dev/sdc (I used the same PE size as before) #lvcreate -l 23839 -n raid_lv0 raid_vg0 (maximum extents from vgdisplay)

That, however, just wiped out your data. Why did you do that???

Quoted 2 lines

Unfortunately, it complains when mounting raid_lv0:
#mount: you must specify the filesystem type

Yep, you wiped out the filesystem.

Quoted 2 lines

Obviously, if I format it, there will be no problem in mounting, but will lose all the data on it.

You've wiped the super block, so recovery will be complex.

Quoted 2 lines

Is there a way to mount this lv without losing data? Or, should I forget about all the data on that disk?

Didn't the pvcreate warn you about wiping out an existing VG? If it didn't, then you might be confused about which disk your VG was on.

Signature · 4 lines
	      Stuart D. Gathman <[email protected]>
    Business Management Systems Inc.  Phone: 703 591-0911 Fax: 703 591-6154
"Confutatis maledictis, flammis acribus addictis" - background song for
a Microsoft sponsored "Where do you want to go from here?" commercial.
#2 lore raw
Quoted 4 lines · Stuart D. Gathman
Quoted 2 lines

Obviously, if I format it, there will be no problem in mounting, but will lose all the data on it.

You've wiped the super block, so recovery will be complex.

Also, your new LV won't be in the same physical locations as your old. LVs are *not* partitions. Since you have a backup of /etc/lvm, after you verify which hd used to contain your VG, you should be able to restore the metadata (which you wiped out with the pvcreate). Depending on how much of the LV was zeroed out when you created the new one (I think only the superblock), you should be able to fsck the filesystem using a spare superblock (ext3 keeps several).

Quoted 6 lines
Quoted 2 lines

Is there a way to mount this lv without losing data? Or, should I forget about all the data on that disk?

Didn't the pvcreate warn you about wiping out an existing VG? If it didn't, then you might be confused about which disk your VG was on.

Signature · 4 lines
	      Stuart D. Gathman <[email protected]>
    Business Management Systems Inc.  Phone: 703 591-0911 Fax: 703 591-6154
"Confutatis maledictis, flammis acribus addictis" - background song for
a Microsoft sponsored "Where do you want to go from here?" commercial.