LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   LVM vs Manual Partitioning (https://www.linuxquestions.org/questions/linux-newbie-8/lvm-vs-manual-partitioning-652748/)

manishgarg21 07-01-2008 01:43 AM

LVM vs Manual Partitioning
 
Hi,

I installed Redhat Ent V4 in my machine some time back, at that time i used manual partitioning based upon some recommendations online.
However there was option to use default partitioning done by LVM.

Now i wanted to know advantages of default partitioning (LVM), i googled and found that it readjusts the partitions according to the usage, and enable addition of extra disk space without reinstalling the whole stuff. However i heard there is some disadvantages, in case of crash of the hard disk, it become more difficult to recover the data incase of LVM compare to manual partitioning.

I want to know people experience with LVM, how it is better than manual partitioning. Does it dependent upon the situation. Also, how the swap space is get decided in case of LVM.

Many thanks in advance.

Manish.

jakykong 07-01-2008 02:00 AM

Personall, I've found that in most (usual and/or standard) situations, especially among desktops (not so much for servers or advanced configurations -- but when you get that far, you'll know what you need to do), putting all data on a single partition is just fine. I've rarely had problems resulting from that. Don't take this to mean that separate partitions are never a good idea, just that you might do that for now, until you learn more about the alternatives.


After you install linux a few times (on a few machines, preferably :)), you will get a feel for how much each partition needs to be. LVM or separate partitions for separate directories may make more sense then, depending of course on what you're using the computers for.

I'm not sure about its effect on partition stability, but I usually treat my hard drives as volatile anyway (that is, keep good backups: the hard drive could fail at any instant without warning).

The LVM HOWTO would be a good place to look if you have other questions.

Also,
Linux Complete Backup and Recovery HOWTO - might help you should you decide to experiment, and I wouldn't discourage experimentation in the least, it's the best way to learn (in my opinion).

lazlow 07-01-2008 02:25 AM

LVM is fine until it screws up. When it screws up it is one more layer that you have to fix to recover your data. For personal use I would avoid LVM like the plague. The only time it has any real advantage over manual partitions is that you can seamlessly span multiple drives(contiguous). You can do ALMOST the same thing by mounting the second drive to a subdirectory on the first drive.For instance, my /home partition is really a second drive mounted to the first drive's /home subdirectory. The main advantage to this is that any linux recovery disk can easily recognize all my data quickly and with no issue. If you use an LVM life is considerably more difficult.

Berticus 07-01-2008 08:55 AM

I've been using LVM2 for about a year now and have never run into any problems. What I really like about LVM2 is you can add another hard drive, and then extend a partition, pretty much a software RAID.

One thing to note is you lose the advantages gain through journaling if you use a journaling filesystem such as xfs, jfs, ext3 or reiserfs. But I've had to hard reboot my PC a couple of times where the file system could not be unmounted safely and haven't run into any problems thus far with ext3. My /data partition now uses xfs since I'm dealing with many large files. So I'm just going to see how that works out.

Now it does make sense that if one of the hard drives fails, recovering data from your LVM is going to be pretty difficult. The way I got over this was I thought, "well in any situation, if a hard drive fails, getting data back would be pretty difficult either way." As I said, so far I haven't run into any problems with using LVM.

As for putting swap in LVM, personally I wouldn't suggest it. I never make my swap more than 512 MB, no matter how large my RAM is. I figured if I have a lot of RAM, swap isn't going to be needed or will be used at a minimum. If I need more space, I would upgrade RAM before I upgrade swap simply because swapping is slower than using RAM. So I just keep my swap outside of the LVM.

manishgarg21 07-01-2008 12:05 PM

Thank you all for the responses.

Berticus as you said "So I just keep my swap outside of the LVM", how i can do that during the installation process?

Berticus 07-01-2008 02:08 PM

Well things aren't added to the logical volume right away, you need to partition it so it is so. For example if I'm doing a fresh install, I use cfdisk and partition it as such:

/dev/sda1 /boot 32 MB
/dev/sda2 / 1 GB
/dev/sda3 swap 512 MB
/dev/sda4 LVM 990 GB

I'm current in Windows (at work), so I can't say for certain, but I believe the code for a swap partition is 82 and the code for an LVM partition is 8E. You have to partition it specifically for LVM. When you add another hard drive, you'll have to partition it with LVM

/dev/sdb1 LVM 1001.2 TB

It's suggested you keep / and /boot outside of LVM since you will need a module to work with LVM. You don't absolutely have to do it that way though. It's just slightly more difficult if you put everything (including / and /boot) into LVM. I'm not sure how you would do it in Anaconda (the installer for some Linux distros such as Fedora and probably RedHat).

kenoshi 07-01-2008 05:25 PM

Comparing partitioning with LVMs is like comparing apples with oranges, as they serve different functional layers for a given tier in your overall storage strategy.

Logical volume management (implemented in Linux as Logical Volume Manager, or LVM) is a method of storage virtualization. The question you should ask is NOT whether partitioning or LVM is better, it should be whether or not you need storage virtualization in your environment.

Typical reasons for implementing volume management includes:

- scalability (pooling, concatenation, redirection)
- performance (striping)
- redundancy (mirroring)
- reliability (parity, striped/dual parity, self healing)
- management/abstraction

If you don't have any such needs, there is no point in using volume management, and you should stick to just using good ol' physical partitions.

lazlow 07-01-2008 06:09 PM

Quote:

- performance (striping)
- redundancy (mirroring)
- reliability (parity, striped/dual parity, self healing)
The above can (and are on a daily basis) be done without have to use LVM, it is called Raid.

Berticus 07-01-2008 08:33 PM

With a software RAID 0 or 5, it's essentially the same thing as LVM. The issue I ran into with hardware RAID 5 is my motherboard requires me to use at least 3 hard drives, which I still don't have.

So whether you use software RAID or LVM, you're pretty much getting the same deal. Same advantages and disadvantages. If you can do a hardware RAID, then by all means, go for it. Supposedly it's much more difficult, but I think in the end you'll benefit.

Edit
Also, what would be most optimal is if you could do an LVM on a RAID1. It'll mirror your data and allow you to expand partitions and file systems.

billymayday 07-01-2008 08:48 PM

Quote:

Originally Posted by lazlow (Post 3200762)
The above can (and are on a daily basis) be done without have to use LVM, it is called Raid.

Can you do these with an LVM?

Edit - sorry - it won't quote your quote, but does LVM do the 3 things you list?

lazlow 07-01-2008 09:06 PM

BillyMayDay

Assuming that was pointed at me, I was referring to post #7. Saying that you did not need LVM to do those things.

Berticus

You motherboard has fake raid and not real hardware raid. Real hardware raid is very easy, if you have the hardware for it. If you try to run Raid5 without at least 3 drives you are wasting your time. Raid5 is essentially two drives running Raid0 and the third drive as backup (error correction). If you are looking for this Raid10 is really better, basically Raid0 and Raid1 (Raid1+0).

billymayday 07-01-2008 09:15 PM

Sorry lazlow, but I read it as "can be done without LVM" implying it can be done with LVM (if you follow).

Cheers

kenoshi 07-02-2008 03:01 PM

Quote:

Originally Posted by lazlow (Post 3200762)
The above can (and are on a daily basis) be done without have to use LVM, it is called Raid.

Maybe I should have been a bit clearer about this. But volume management sits on top of physical RAID and physical disk partitions. The striping and mirroring I was referring to, is on a volume level, not physical level. In some ways, you can look at it as nested RAID.

For example, with LVM, you can create a striped LV that:

- spans two or more physical disks that are each its own pv
- spans two or more RAID 5 arrays that are each its own pv

You can create mirrored LVs that

- spans two physical disks
- spans two direct attached RAID 5 LUNs
- spans two SAN LUNs

To confuse matters even more, there are two types of volume management, host (such as LVM, ZFS, vxvm, svm) and hardware based ("partitioning" or "virtual disks" for some array controllers, "Storage Groups" on EMC Clariions, etc). Majority of modern volume management implementations integrate RAID functions so you can directly manage physical RAID for tighter integration. Most shops I've seen use a combination of host and hardware based volume management.

BTW, RAID5 is not RAID0 + parity disk, that would be RAID3/4. RAID 5 doesn't have a disk dedicated for error correction, as parity data is distributed across all member disks.

Also, RAID10 (stripe of mirrors) requires a minimum of 4 disks, and its not necessary better than RAID5. For example, I would use RAID5 for a download server, whereas I would use RAID10 for a high transaction database. For mission critical applications, I would use 51 or even 61.

Quote:

Originally Posted by billymayday
Can you do these with an LVM?

You can stripe a LV across multiple PVs, and mirror entire LVs (well at least with RHEL 4 since update 2).

Quote:

Originally Posted by Berticus
So whether you use software RAID or LVM, you're pretty much getting the same deal. Same advantages and disadvantages. If you can do a hardware RAID, then by all means, go for it. Supposedly it's much more difficult, but I think in the end you'll benefit.

Not true. The general function of RAID is to supply physical storage across multiple disks, be it distributed (striped), or replicated (mirrored), with or without error correction. Volume management sits on top of RAID as a management/abstraction layer, hence a method of storage virtualization.

Some of the things you can do with LVM on top of RAID:

- create volumes that span several RAID5 luns to speed up regeneration should a drive goes down
- take snapshots
- mirror LV on different SAN luns from different arrays/JBODs
- with some implementations, quickly expand or reduce size of the block device and the underlying filesystem, which traditionally is a PITA with direct physical partitions

lazlow 07-02-2008 03:20 PM

Quote:

RAID 5 (striped disks with parity) combines three or more disks in a way that protects data against loss of any one disk; the storage capacity of the array is reduced by one disk.
From:http://en.wikipedia.org/wiki/Redunda...ependent_disks

You can argue if parity is error correction if you wish.

I will stand by my statement that LVM is not necessary for a home system, and is really only useful in very large disk situations (1TB+). For me the added complexity for error recovery on LVM far outways its utility (on a home system).

kenoshi 07-02-2008 04:43 PM

Quote:

Originally Posted by lazlow (Post 3201981)
From:http://en.wikipedia.org/wiki/Redunda...ependent_disks

You can argue if parity is error correction if you wish.

I will stand by my statement that LVM is not necessary for a home system, and is really only useful in very large disk situations (1TB+). For me the added complexity for error recovery on LVM far outways its utility (on a home system).

Agreed. LVM is not necessary for home use in most cases. I assumed he was using this in a server environment since he is using RHEL. If he's considering LVM he must have a good reason.

BTW, parity block is used for error correction...and there is no "third drive as backup (error correction)" in RAID 5 in a 3 drive setup.

http://en.wikipedia.org/wiki/Raid_5#RAID_5


All times are GMT -5. The time now is 08:27 AM.