Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

Let's say I have two identical disks, and I set one LVM logical volume on them (no mirroring). Question: What will happen when one of the disks fails?

  1. I will lose all the data from all the disks
  2. I will lose the data from broken disk, but I get data from still working one
  3. something else (what)

?

Thank you in advance for clarification.

From what I've read mentioning RAIDs in LVM articles indicates I will lose everything, on the other hand shrinking LV indicates something opposite.

Update

Good read: http://www.redhat.com/magazine/009jul05/features/lvm2/

According to this article with linear mapping (default, it is my case) and no mirroring, in case of failure you should lose data only from broken disk. I hope it is true, and eventually I find out :-/

share|improve this question
add comment

2 Answers

up vote 5 down vote accepted

The worst and most likely case is that you will lose everything. If you have a single logical volume spanning both drives, and you lose one drive with no mirroring, you've essentially wiped out half the file system.

From this point, it gets mildly better depending on what file system you are running on your volume. Assuming that you are not using stripping, which will kill any chance you have, you may be able to get some of your data back by running recovery software on the second drive. I don't have personal experience with that case, but it should be theoretically possible to get some or most of the files that were exclusively on the still functional drive if you are using one of the more 'robust' file systems (ie. ext?). Your mileage will vary depending on what filesystem you are using on top of LVM and how your files are arranged on the disks though. If they are fragmented across both disks then you will still lose those files too.

share|improve this answer
    
Thank you, but I am looking for definitve answer, not speculative. "Half of the system" differs -- when I cut the disk in half, I get nothing, when I delete half of the files, I still get the rest of them. –  greenoldman Feb 23 '12 at 7:50
    
@macias: The only speculation in my answer is how much you'll lose (from half to all). If you have a striped setup, you will lose all your data. If you don't, you may lose up anything from all or none of your files, but the number will depend on which file system you have (ie, how recoverable files are), and how they are arranged on disk. If your LV is half full, but all the files are located on the disk that fails, then you've lost all your data because there are no files on the recoverable disk. Conversely, you may lose nothing because the inverse situation may apply. –  Matthew Scharley Feb 23 '12 at 8:52
1  
@macias: The difference between shrinking a LV and losing a disk is that shrinking the LV is a controlled environment. It assumes you have the capability to store all your data on one disk, and that you have done so. The first step of shrinking a LV is shrinking the filesystem so that it will fit on one drive. –  Matthew Scharley Feb 23 '12 at 8:58
    
Speculative because I am interested in data from working disk, and "may" is pretty vague ;-) Anyway, I finally found out some doc from RH, which states LVM feature is such reliability in case of failure -- that you can get the rest of the data. That is the answer I was looking for. Since you made me to dig deeper, I am marking your post as THE answer. –  greenoldman Feb 23 '12 at 17:22
add comment

I agree with Matthew Scharley - losing from half to all is most likely case.

While you might be able to recover some of the data when a single disk dies, it's like losing half the blocks on a filesystem using a single hard disk. The filesystem's fsck will certainly have big problems recovering data, and it would take a long time to finish - it's quite possible it won't be able to recover at all.

You can use 'file carving' type software to extract data from such a broken filesystem but its success will depend on how fragmented the files are on disk.

See http://serverfault.com/questions/279571/lvm-dangers-and-caveats for more on the risks of data loss with LVM generally, and some links on LVM recovery tools + experience.

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.