LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Fileserver (at home) strategy with LVM? (https://www.linuxquestions.org/questions/linux-server-73/fileserver-at-home-strategy-with-lvm-837775/)

mr_minning 10-13-2010 06:56 AM

Fileserver (at home) strategy with LVM?
 
Hi,
I need som advice. I have a CentOS machine at home serving mainly as a fileserver. It has a few hard drives for this purpose alone - mounted as /mnt/media0, /mnt/media1, /mnt/media2.

What I'd like is to have all of these drives act as one big "file pile" - but I don't want raid or jbod because I don't want one disk failure to kill the whole "array". I don't have anything on these drives that is very important or hard to replace, therefore I don't want to use any redundancy.

I have been looking at LVM with intent to mount all tree drives as one LV and VG (i.e. /mnt/filepile). But I can't really make out what will happen if one or more of the drives fail (breaks down/won't start). What will happen?
Are all files lost, or just the files on the failing pysical drive?
How do I recover files from the other drives in case of failure? Or do I need to?
Can I just recreate the VG without the broken drive and just see which files were lost and replace them from backups?

Thank you for your input.

prayag_pjs 10-14-2010 03:50 AM

With RAID you try to get redundancy (usually) out of disks. With LVM you allocate disk space flexibly. If you want redundancy, use RAID. If you want flexibility, use LVM. If both, use LVM over RAID. Sometimes RAID capability is part of LVM. In many situations you need flexibility and therefore LVM.


RAID is used to join several drives as a single volume. Different RAID schemes let you increase capacity, speed, reliability, or all. In the end, you get with something that is just like one bigger, faster, better drive.

LVM is a very flexible volume manager. Although it has a couple of RAID modules, if you want RAID's redundancy or speed, put LVM on top of a RAID (or several). The purpose of LVM is joining several volumes (can be drives or RAIDs or a mix) into a 'Volume Group'. Then, you create new 'Logical Volumes' from the group. That gives you a lot of flexibility because you can later reassign capacity between the Logical Volumes, and add or remove Physical Volumes from the Volume Group. It really lets you think in a different way about storage.

For "recover files from the other drives in case of failure"LVM on top of a RAID is the solution.

kaushalpatel1982 10-14-2010 06:50 AM

Why dont you go with LVM over RAID (Hardware RAID).

It will give your flexibility of LVM and Redundancy of RAID.

This is win-win situation. If any of your drive gets corrupted, You can easily replace it without loosing your data.

mr_minning 10-15-2010 12:59 AM

Quote:

Originally Posted by prayag_pjs (Post 4126910)
With RAID you try to get redundancy (usually) out of disks. With LVM you allocate disk space flexibly. If you want redundancy, use RAID. If you want flexibility, use LVM. If both, use LVM over RAID. Sometimes RAID capability is part of LVM. In many situations you need flexibility and therefore LVM.


RAID is used to join several drives as a single volume. Different RAID schemes let you increase capacity, speed, reliability, or all. In the end, you get with something that is just like one bigger, faster, better drive.

LVM is a very flexible volume manager. Although it has a couple of RAID modules, if you want RAID's redundancy or speed, put LVM on top of a RAID (or several). The purpose of LVM is joining several volumes (can be drives or RAIDs or a mix) into a 'Volume Group'. Then, you create new 'Logical Volumes' from the group. That gives you a lot of flexibility because you can later reassign capacity between the Logical Volumes, and add or remove Physical Volumes from the Volume Group. It really lets you think in a different way about storage.

For "recover files from the other drives in case of failure"LVM on top of a RAID is the solution.

I'm familiar with RAID and how it works. But I'm really curious about the workings of LVM. I do not require redundancy (all movies and music from my filepile are backed up). RAID seems a bit unflexible too. If I go out and ge myself another drive, I'll have to rebuild the whole array (right?). It's just a question weather I have to restore 6GB or just 1GB in case of hardware failure.

I wanted to compare LVM to RAID (JBOD or RAID 0) in this case. I know it's really bad if one drive (or the disc controller in hw-raid for that matter) fails if you got a raid system.
But what happens if a drive in a LVM volume fails? Is the whole array lost?
The bottom line beeing: Do I have to restore 6GB or just 1GB?

Cheers!

prayag_pjs 10-15-2010 02:47 AM

Hi,

You can restore as per this link:

LVM is pretty cool and stores backup configs on the first 512 blocks of every LVM partition. These configs tell LVM what is stored where, and you can use them to restore your device. So, the first part of recovery is to find these configs. To do this you'll need to boot off the live cd. If you installed LVM you probably know this but the default cd doesn't have LVM on it.

mr_minning 10-15-2010 04:22 AM

Quote:

Originally Posted by prayag_pjs (Post 4128098)
Hi,

You can restore as per this link:

LVM is pretty cool and stores backup configs on the first 512 blocks of every LVM partition. These configs tell LVM what is stored where, and you can use them to restore your device. So, the first part of recovery is to find these configs. To do this you'll need to boot off the live cd. If you installed LVM you probably know this but the default cd doesn't have LVM on it.

Thanks! Interesting reading. So, if I got this correctly... What one would do in case of disc faliure is to create a new volume group, based on the old one (same names and ids, which you collect with the dd command), but omitting the failing disk. After that you just do a "fsck". And what you see after that, is all the complete files that weren't on the crashed disc?!

Seems simple enough if I got that right. Did I?

Cheers!

prayag_pjs 10-15-2010 04:47 AM

Hi,

You can test what ever mentioned in that link and confirm if its simple. Give it a try.


All times are GMT -5. The time now is 05:17 PM.