Yesterday, one hdd of my LVM crashed (smart-error)

The Machine has the following setup:
- 4 hdds
- 1 Partition Raid10 (System, 4*50GB)
- 1 Partition normal (/boot, 200MB, sda)
- 1 Partition LVM2 (Data, 4*~850GB)
- Ubuntu 10.04 Server (headless)

Now my lvm won't mount anymore, Ubuntu asks me to skip or manually recover on bootup. When I press S the system starts, but without my lvm getting mounted.

Now my system partition does not seam to be affected (/proc/mdstat looks as usual) an /boot works fine, too.

What I will try now is to
- buy a new hdd
- Integrate the hdd in my lvm
- Try to remove the sda-part of the lvm (copy it over to the new sde, or whatever lvm wants)
- Do the raid stuff (I think I'll find out how to do that, otherwise I'll ask a separate question)

Now my problems:
- How can I remove sda from the lvm (remove meaning copy contents and mark partition as not in use so I can unplug the drive)?
- If I am not able to remove the partition normally, are there any tools to recover the files on this partition, so I could manually copy them to the "new" lvm?

Thank you for your help

separated solution from Question

  • cool man...you got super lucky with the faulty drive not being horribly corrupt or unreadable – RobotHumans Nov 21 '10 at 0:32
  • can you separate your solution (answer) from your question? – Lekensteyn Apr 16 '11 at 21:12
  • Separated solution from question – sBlatt Apr 17 '11 at 9:45

thinking pvmove is the command-line you are looking for...details here: http://tldp.org/HOWTO/LVM-HOWTO/removeadisk.html

| improve this answer | |
  • for complete solution see edit in question – sBlatt Nov 20 '10 at 20:05

It's not too clear to me whether your LVM is on top of RAID or not? If not then you're flat out of luck getting any data off of the LVM.

| improve this answer | |
  • so if one disk crashes the whole lvm is dead? – sBlatt Nov 19 '10 at 23:59
  • Yup, unless you do LVM on top of some kind of RAID. – popey Nov 20 '10 at 8:33

Computer works now. Here my detailed steps:
My sda (faulty drive) partitions looked like this:
sda1: /boot
sda2: raid10 member (system)
sda3: lvm member

  • Attach new replacement hdd
  • dd if=/dev/sda of=/dev/sde (copy the cotents of the faulty hdd to the new one, actually I did ctrl+c after a minute as I only needed the partition table)
  • dd if=/dev/sda1 of=/dev/sde1 (copy /boot partition to the new disk)
  • vgextend my_volume_group /dev/sde3 (add the lvm partition of the new disk to my lvm)
  • pvmove /dev/sda3 (move the data of the faulty drive to another drive)
  • Remove sda2 from my raid10
  • changed fstab to get /boot from sda1 not by uuid (as this changes when replacing hdd)
  • grub-install /dev/sde (as it's an upgraded version from 8.04, newer versions would need grub2-install)

now my sde partitions lokked the follow:
sde1: /boot
sde2: raid partition (not initialized)
sde3: lvm partition (initialized, lvm worked again)

I shutdown the computer, replaced the harddisk (so sde would be sda, removed old sda) and reboot
EVERYTHING worked! I did not even have to use a live cd to fix bootloader/other stuff, miraculously sda2 was recognised as raid10 member and was automatically initialized!

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.