Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I am new to the world of Linux and recently came across logical volume management however am unsure if I have understood its function correctly. My understanding is that I have 3 physical devices or 3 partitions which I take it have to be primary partitions. These physical devices or partitions then form the volume group. The size of the volume group is a the sum of the physical devices or partitions.Once the volume group has been created, I can create logical volumes which I can grow dynamically depending on the requirements of the server.

My confusion

  • Is there a minimum requirement to have 3 physical devices or partitions or can I have 2?

  • Do the physical devices or partitions have to be of equal sizing?

  • If I have 1 primary partition, 1 Extended partition and 3 logical partitions, can I still have logical volumes?

  • If I add a new harddrive to the server, can I increase the size of my volume group and thereby increasing the amount of space available for my logical volumes?

share|improve this question

1 Answer 1

up vote 4 down vote accepted

Your basic understanding of LVM is quite correct. LVM essentially creates an abstraction layer between the physical drives and the logical volumes (hence the name) and allows to represent all available storage as one (or more) continuous device(s). LVM is especially useful if at the time of configuring a server you are not quite sure how much disk space will be needed for various areas. You would then create volumes for /, /var, /opt, /home, and so on, which can be resized once the requirements change. Obviously this is a very simple example, and LVM can do whole lot more.

Here are the answers to your questions:

  • The minimum requirement is 1 partition. AFAIK, there is no maximum (there probably is a technical one with quite a high number).
  • No, the partitions participating in LVM can be of any size
  • LVM doesn't care about the partition type. It creates a a complete abstraction layer between the physical volumes and the logical volumes.
  • Yes, you can add physical volumes at any time and then make them available to logical volumes. Whether or not this additional space can be utilised by individual partitions in LVM depends on the partition type. In general, both the partition type and the filesystem on the partition must allow resizing (e.g. ext3/4 can do this, even while mounted). However, even if your existing partitions/filesystems cannot be resized, you can still use LVM to create new partitions and then use them by mounting them.
share|improve this answer
    
@wolfgangsz - Thanks. I have a few more questions regarding your answers. When you say the minimum requirement is 1 partition, I take it this can be either an entire disk partition e.g. 80GB or partition of a disk e.g. 1GB of 80GB. I also take it that the disk or partition of a disk would have to be free space to create the volume group and logical volumes. Having read numerous articles, most of them suggest ext3. I take it ext4 is fairly new. What about reiserfs and other partition types? –  PeanutsMonkey May 18 '11 at 16:52
    
@wolfgangsz - Also what partitions do you generally place in a logical volume and non-logical volumes? For example would I have /, swap and boot as non-logical volumes with usr, tmp, var, home, var/logs, var/www, var/mail as separate logical volumes? –  PeanutsMonkey May 18 '11 at 16:58
1  
The type of HDD underneath does not matter (as long as your OS can access it). You cannot put the boot partition into LVM, and I don't think you can put swap into LVM (but I am not sure about that one). The rest is really your choice. Partitions can span entire disks or parts of them. When you create the partition, you have to set its type as "LVM partition" or similar. –  wolfgangsz May 19 '11 at 8:09
1  
For the partitions inside the LVM: EXT4 is by now widely accepted, and I believe is the default file system in distros like Ubuntu and Fedora. I haven't used other FS very much, so I can't really comment on that. However, from what I know about LVM, it doesn't really care too much about the filesystem on the inside partitions, you must choose what suits your needs best. –  wolfgangsz May 19 '11 at 8:10
1  
LVM is a software abstraction of storage. It can use physical volumes that are made up from the devices that are provided by hardware or software RAID. If you imagine this as layers (with the real hardware at the bottom and the applications at the top) then the RAID would lie underneath the LVM. –  wolfgangsz May 21 '11 at 10:38

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.