Linux - GeneralThis Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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
Click here to see the post LQ members have rated as the most helpful post in this thread.
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.
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?
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.
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.
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.
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.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.