LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Can someone explain logical volume size to me? (https://www.linuxquestions.org/questions/linux-newbie-8/can-someone-explain-logical-volume-size-to-me-4175412717/)

ohlookpie 06-21-2012 03:01 PM

Can someone explain logical volume size to me?
 
I don't really understand what the logical volume size does. For example, I create a physical volume from /dev/sda1 and /dev/sda2 that equals 25GB, and then I create a volume group from that, and then a 500MB logical volume. What does it mean that the logical volume is only 500MB? Am I not utilizing the entire 25GB of /dev/sda1 and /dev/sda2?

szboardstretcher 06-21-2012 03:10 PM

Logical volumes can span accross physical hdd's.

So, if you have 2 physical drives at 1GB a piece,.. you can add them together and access them as a 2GB Logical Volume.

ohlookpie 06-21-2012 03:18 PM

Quote:

Originally Posted by szboardstretcher (Post 4708799)
Logical volumes can span accross physical hdd's.

So, if you have 2 physical drives at 1GB a piece,.. you can add them together and access them as a 2GB Logical Volume.

Wouldn't that just be a the vgcreate part that is joining 2 physical drives? It seems to me like the lvcreate part is creating something similar to partitions. So, if I do a lvcreate -L 4G volgroup -n blah, and my volgroup is 8GB, that means I have space that can be used to create another logical volume, or extend the first one, and so on. That's my understanding of it anyway, but I am not 100% sure that is correct. Is there any reason not to use the full amount of disk space when creating logical volumes?

syg00 06-21-2012 06:59 PM

Indeed.
The lv is the analogue of a "normal" partition - both appear as block devices and can have a filesystem created on them. At which point you can write files onto them. So "lv == partition" (logically, and ignoring the possibility that pv's can be "real" partitions).
Some like to keep free space in vg's for later growth of (or new) lv's, some just add new pv to the vg as needed. Individual choice.

chrism01 06-21-2012 07:45 PM

As syg00 said. You could have a read here http://tldp.org/HOWTO/LVM-HOWTO/

jefro 06-21-2012 09:27 PM

From chrism01's link.

3.3. logical volume (LV)

The equivalent of a disk partition in a non-LVM system. The LV is visible as a standard block device; as such the LV can contain a file system (eg. /home).

So when you created the 500m it is what is reported. It is as if you created a partition out of a disk. In a common partition you can only see what part of the disk that has been utilized. The rest of the drive might later be used or what not.

I don't think this posts helps any more than others but I can't delete it.

ohlookpie 06-22-2012 01:45 AM

Quote:

Originally Posted by syg00 (Post 4708903)
Indeed.
The lv is the analogue of a "normal" partition - both appear as block devices and can have a filesystem created on them. At which point you can write files onto them. So "lv == partition" (logically, and ignoring the possibility that pv's can be "real" partitions).
Some like to keep free space in vg's for later growth of (or new) lv's, some just add new pv to the vg as needed. Individual choice.

Thank you! I am finally figuring it out. I now see that you may want to keep some free space available for LV snapshots, growing the LV, and so on. Thanks again for the help.


All times are GMT -5. The time now is 12:10 AM.