LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   LVM question (https://www.linuxquestions.org/questions/linux-general-1/lvm-question-861240/)

rolandpish 02-07-2011 03:01 PM

LVM question
 
Hi there.

I plan to install a server using LVM. I thought a partition schema where /boot would be in an ext4 partition while / /usr /var /home and /opt would be in the LVM.
My question is: if I'm putting / into the LVM, is it neccesary to divide /usr /var /home and /opt into different logical volumes?
If I divide them, would it become harder to maintain when new disk space has to be added to the volume group?

Thanks in advance.

Regards

valen_tino 02-07-2011 04:11 PM

If you put only / in LVM, you can only manipulate the / with LVM commands, not /var or /home etc. It really depends on the requirements of the server.

LVM essentially partitions your drive and mounts it as a separate mount point. Having separate mount point in LVM helps when a certain directory is filling up rapidly. For example, if /usr/local is filling up with Apache logs, it would help if it were on a separate LVM partition. That way you could extend the space after adding new drives. If it were not a separate LVM partition it would fill up / and potentially hang your server. In essence LVM provides the granularity and the protection from drives filling up.

Contrary to your statement, in my opinion, if divided it would be easier to maintain the LVs when new disk space has to be added to the volume group.

HTH

rolandpish 02-07-2011 04:36 PM

Thanks a lot Valentino.

I really appreciate your suggestion. As a matter of fact, I was looking for recommendations as this will be my first server using LVM. For other servers I used the traditional partitioning paradigm and started to have lots of problems related to "running-out-of-space" exactly as you point out in your post.

Do you think is a good choice to divide the LV as: / /usr /home /var /opt and swap?

Thanks again!

Cheers

gilead 02-07-2011 05:41 PM

It will depend on your usage patterns. If you have increasing data in your mail spools, logs, package cache, etc. then /var would be a good candidate for its own partition - the same goes for any other directory hierarchies with growing usage that could potentially use up a lot of space when you're not looking. Static directories won't be a risk to overflowing your root partition and can be grouped with /.

Putting /home on its own partition is a good idea for the above reason but also because you can easily preserve data when re-installing. I don't know about swap (although I have mine on its own partition) because I have enough RAM not to need it so I haven't compared swap performance in a partition to a file.

rolandpish 02-07-2011 08:38 PM

Thanks a lot Steve.

Definitely you guys have helped me a lot to decide the partitioning scheme I'll use for the server. I'll research about putting swap in its own partition vs lvm; but I really have a better picture of what I should do.

Thanks again for your recommendations and any other suggestion is very welcome as well.

Cheers.

gilead 02-07-2011 09:47 PM

I'm glad it was helpful. I used the LVM HOWTO here for most of the info I needed (as well as the README_CRYPT.TXT that comes with Slackware). The recipes chapter in the HOWTO is very good.

tommylovell 02-07-2011 11:48 PM

Good advice from gilead and valen_tino and I concur.

In work we do a 100MB /boot and the rest goes to an LVM volume group. Within LVM we do 'root', 'home', 'var' and 'opt' logical volumes all in the same volume group. It isolates those filesystems from one another. They're easy to resize (upwards, at least) when you need to. (Resizing downwards requires unmounted file systems...)

At home I use the same scheme. It makes replacing an old drive with a new larger one real easy too. Just 'pvmove' from the old to the new; 'vgreduce' the old one away; then 'pvremove' it. 'dd' (or 'tar', or 'rsync') the /boot partition to the new drive. Then do some grub magic, and you're done. (I actually buy pairs of drives. Partition them identically. Make the "large" non /boot partition RAID1. Then 'PVCREATE' that /dev/md0 device.)

When you have your new system up, do a 'pvdisplay --maps' and a 'lvdisplay --maps', and you can see how your LV's were placed across the physical volume(s) within the volume group. Interesting.

rolandpish 02-08-2011 07:38 AM

Thank you Tommy.

I'll absolutely write down your advice. I was about to google about that subject specifically :)

Again, a very valuable help from you guys. I really appreciate your suggestions.

Regards.


All times are GMT -5. The time now is 06:23 AM.