Skip to contentSkip to conversation

Help after disk crash

linux-lvm BoD 2 participants 2 messages Dec 13, 2008

lore
Share & tools
lore

BoD

author
#0 lore raw

Hi!
I recently bought a new hard drive and used LVM to add it to my system. Unfortunately the disk just crashed. This is not too bad since I have a backup of the most important files.
But currently my system can't work correctly as the crashed disk belonged to the vg that contains /usr, /home, /opt, /var and /tmp. (It also contains a /docs which I have a backup of, so it doesn't matter if I lose it.) The system still boots though and I can login as root.

The vg is on pv0, pv1 and pv2 - It is pv2 that crashed.
I am kind of a newbie so I don't know how to proceed, but I believe it should be possible to resize the vg to only use the first 2 pvs.

From what I see on my /etc/lvm/backup/vg file (see below), it seems that only the 'docs' lv uses pv2, I think it is a good sign, right?

So far, after googling a bit I tried vgscan -P and vgchange -Pay and tried to mount /dev/vg/usr but it didn't work with the following error: EXT3-fs: INFO: recovery required on readonly filesystem. / write access unavailable, cannot proceed.

Any help is greatly appreciated! Thanks a lot.

BoD

Here is my /etc/lvm/backup/vg:
==================
# Generated by LVM2 version 2.02.36 (2008-04-29): Sat Nov 15 17:19:28 2008

contents = "Text Format Volume Group"
version = 1

description = "Created *after* executing 'lvextend /dev/vg/docs /dev/sda'"

creation_host = "server" # Linux server 2.6.25-gentoo-r7 #3 SMP Mon Nov 10 01:14:23 CET 2008 i686
creation_time = 1226765968 # Sat Nov 15 17:19:28 2008

vg {
id = "PH2tSI-13yC-X0oh-vn11-a0n6-1ho5-6UiCs9"
seqno = 15
status = ["RESIZEABLE", "READ", "WRITE"]
extent_size = 8192 # 4 Megabytes
max_lv = 0
max_pv = 0

   physical_volumes {
       pv0 {
           id = "eGnP16-zOOk-CR6Y-sDib-27kL-T83J-d6oRp9"
           device = "/dev/hda4"    # Hint only

           status = ["ALLOCATABLE"]
           dev_size = 223656930    # 106.648 Gigabytes
           pe_start = 384
           pe_count = 27301    # 106.645 Gigabytes
       }

       pv1 {
           id = "6DnMKc-Rpb2-Rq52-xsXY-3Nrw-ZJoZ-YAwf1C"
           device = "/dev/hdb1"    # Hint only

           status = ["ALLOCATABLE"]
           dev_size = 240107427    # 114.492 Gigabytes
           pe_start = 384
           pe_count = 29309    # 114.488 Gigabytes
       }

       pv2 {
           id = "9RSjlM-bZ8W-8cC0-s122-bYTo-jyci-DZOSpM"
           device = "/dev/sda"    # Hint only

           status = ["ALLOCATABLE"]
           dev_size = 1953525168    # 931.513 Gigabytes
           pe_start = 384
           pe_count = 238467    # 931.512 Gigabytes
       }

}

   logical_volumes {
       usr {
           id = "0CY7Ox-x0UG-LVXl-jhEk-IrJG-ig8l-ELPI3C"
           status = ["READ", "WRITE", "VISIBLE"]
           segment_count = 2

           segment1 {
               start_extent = 0
               extent_count = 2560    # 10 Gigabytes

               type = "striped"
               stripe_count = 1    # linear

               stripes = [
                   "pv1", 0
               ]
           }
           segment2 {
               start_extent = 2560
               extent_count = 1280    # 5 Gigabytes

               type = "striped"
               stripe_count = 1    # linear

               stripes = [
                   "pv1", 4352
               ]
           }
       }

       home {
           id = "C26mF3-f25l-K3ct-NgKQ-A6Mb-OgOn-ZtqlAt"
           status = ["READ", "WRITE", "VISIBLE"]
           segment_count = 1

           segment1 {
               start_extent = 0
               extent_count = 1280    # 5 Gigabytes

               type = "striped"
               stripe_count = 1    # linear

               stripes = [
                   "pv0", 0
               ]
           }
       }

       opt {
           id = "9xQxKJ-KrpD-iDny-6SAh-dFyY-4URm-0qAH6l"
           status = ["READ", "WRITE", "VISIBLE"]
           segment_count = 1

           segment1 {
               start_extent = 0
               extent_count = 1280    # 5 Gigabytes

               type = "striped"
               stripe_count = 1    # linear

               stripes = [
                   "pv1", 2560
               ]
           }
       }

       var {
           id = "1Vt3kw-xlHL-Rh66-cYoQ-f5QP-5D9f-Inan21"
           status = ["READ", "WRITE", "VISIBLE"]
           segment_count = 1

           segment1 {
               start_extent = 0
               extent_count = 2560    # 10 Gigabytes

               type = "striped"
               stripe_count = 1    # linear

               stripes = [
                   "pv0", 1280
               ]
           }
       }

       tmp {
           id = "QcoIcV-tSUP-iJ9J-MjZE-cI0n-8fEG-20Gb08"
           status = ["READ", "WRITE", "VISIBLE"]
           segment_count = 1

           segment1 {
               start_extent = 0
               extent_count = 512    # 2 Gigabytes

               type = "striped"
               stripe_count = 1    # linear

               stripes = [
                   "pv1", 3840
               ]
           }
       }

       docs {
           id = "5xHiv1-uzBg-kd8c-jdJQ-QuOa-eFei-w4hUbl"
           status = ["READ", "WRITE", "VISIBLE"]
           segment_count = 3

           segment1 {
               start_extent = 0
               extent_count = 23677    # 92.4883 Gigabytes

               type = "striped"
               stripe_count = 1    # linear

               stripes = [
                   "pv1", 5632
               ]
           }
           segment2 {
               start_extent = 23677
               extent_count = 23461    # 91.6445 Gigabytes

               type = "striped"
               stripe_count = 1    # linear

               stripes = [
                   "pv0", 3840
               ]
           }
           segment3 {
               start_extent = 47138
               extent_count = 238467    # 931.512 Gigabytes

               type = "striped"
               stripe_count = 1    # linear

               stripes = [
                   "pv2", 0
               ]
           }
       }

}
}

#1 lore raw
Quoted 9 lines · BoD

Hi!
I recently bought a new hard drive and used LVM to add it to my system. Unfortunately the disk just crashed. This is not too bad since I have a backup of the most important files.
But currently my system can't work correctly as the crashed disk belonged to the vg that contains /usr, /home, /opt, /var and /tmp. (It also contains a /docs which I have a backup of, so it doesn't matter if I lose it.) The system still boots though and I can login as root.

Quoted 6 lines

The vg is on pv0, pv1 and pv2 - It is pv2 that crashed.
I am kind of a newbie so I don't know how to proceed, but I believe it should be possible to resize the vg to only use the first 2 pvs.

From what I see on my /etc/lvm/backup/vg file (see below), it seems that only the 'docs' lv uses pv2, I think it is a good sign, right?

yep, and it does look like the docs LV was the only volume using pv2.

Quoted 4 lines

So far, after googling a bit I tried vgscan -P and vgchange -Pay and tried to mount /dev/vg/usr but it didn't work with the following error: EXT3-fs:
INFO: recovery required on readonly filesystem. / write access unavailable, cannot proceed.

That sounds like the volume group has been activated but there are problems with the filesystem (but that does sound strange because usr wasn't using pv2). Are you able to mount the other filesystems OK? If so, then I'd run a fsck on /dev/vg/usr (make sure the filesystem isn't mounted when you run fsck... not that you're able to atm :-) ).

"vgchange -Pay" will allow you to enable the volume group, but its only temporary, ie you'll still have problems whilst booting (the VG needs to be consistent at boot time). If the other volumes (and the filesystems on them) are OK and running a fsck on usr fixes the problem then use "vgreduce --removemissing vg" to permanently remove pv2 from the volume group.

--Dave