Find the answer to your Linux question:
Results 1 to 3 of 3

Thread: LVM questions

Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    LVM questions

    OK, got lots of 'em - trying to understand this thing

    What EXACTLY do "pvcreate", "vgcreate" and "lvcreate" do? ie. what is a Volume Group, and a Logical Volume? Why can't you just use normal disk partitions to do the extending and reducing? Why are there so many categories within this thing?

    OK, then. in the command "mkfs -t ext4 /dev/myvg/newlv", why is it done this way? What exactly does a subdirectory under /dev mean?

    Also, how do you simply ADD a disk partition to an existing one, so that the size of the combined partition is the size of one+ the size of the other? Is this even possible?


  2. #2
    Linux User
    Join Date
    Jun 2012
    SF Bay area
    Two caveats before I say anything useful.

    First, I don't consider myself an "expert" when it comes to Linux LVM's. I can get what I need done, but I have to read the manual pages everytime. I just haven't used the tools enough, since once things are working I tend not to revisit the setup for another year or so. Other people who know the ins and outs of LVM's can probably explain things better. But I can give you some pointers.

    Second, I'd recommend setting up a Linux VM to practice on before doing anything to your main system if you're just learning all this stuff. You can break a filesystem if you enter the wrong command(s). So be careful.

    Having said all that, here some info that might help.

    First, read "man lvm" on your system for an overview of how the system works. It also includes a list of the various commands (with short descriptions) that make up the suite of tools used to administer LVM's in various ways.

    The model used for Linux LVM's is layered, as you noted. And there are tools to manage all three layers, with similar sounding names and functions. The lowest level is concerned with partitions of disks. Most of the time it's partitions of physical disks, but if you have a RAID controller I suppose it could be an abstraction. The bottom line is the "pv*" tools operate on partitions you created with "gparted", "fdisk" or one of the GUI disk management tools. With those tools, like "pvcreate", you can tell the LVM system about raw storage is can use. It's basically defining what parts of the disk you're reserving for LVM to use. Any disk space you intend any logical volume to use will be included in one big pool and subdivided further using different tools.

    Here were an expert needs to chime in... You might be able to skip the "pv" tools altogether if the disk partitioning tool you use, meaning "gparted", "palimpsest", etc... can make the partitions look like LVM reserved space on their own. I don't remember ever having to use them.

    The next level up allows you to assemble LVM reserved partitions into one or more "volume groups." Those are all the "vg*" commands. As far as I can tell, volume groups exist purely for administrative reasons. They let you define separate storage areas, made up of one or more physical partitions, then administer them independently. So, for example, you could make a "BigSlow" volume group out of all the LVM partitions on USB connected disks and one called "BulletProof" with partitions that are on a RAID controller. Then you could create a "/backup" filesystem in the BigSlow volume group and a "/critical-data" filesystem in the BulletProof volume group.

    If you don't need that sort of separation, then just add all the LVM partitions into one volume group and never worry about it again.

    Finally, the "lv*" tools are where you define filesystems that you want to actually use.

  3. #3
    Linux Guru Lakshmipathi's Avatar
    Join Date
    Sep 2006
    3rd rock from sun - Often seen near moon
    First they ignore you,Then they laugh at you,Then they fight with you,Then you win. - M.K.Gandhi
    FOSS India Award winning ext3fs Undelete tool Online Linux Terminal


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts