Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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

EDIT:
separated solution from Question

share|improve this question
    
cool man...you got super lucky with the faulty drive not being horribly corrupt or unreadable –  hbdgaf 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
add comment

3 Answers 3

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

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

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.

share|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
add comment
up vote 0 down vote accepted

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!

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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