Wrapping your head around LVM.



  • I was thinking about writing a beginners guide to LVM, but it's already been done so often already that I'll spare you all from my literary, lack of, skills. Instead, I'll link to a few places that I use for reference, outside of the man pages.

    HowtoForge Walks you through all the basics, rather long.
    The Geek Diary Has a shorter version with more graphics, but doesn't cover as much.
    How to Geek Includes a handy chart of which options are available for PV, VG, and LV. Also covers snapshots succinctly.

    One thing none of those mention that I've found very handy at times, lvm is it's own command. If you're stuck in a recovery shell, no internet access, and can't remember exactly what command(s) and options you need to use. Fire up lvm, and type 'help'. Once you figure out which command(s) are needed 'help command' should get you going. Frankly, it reminds me of how OpenVMS operated, which I never really liked. Great for when you don't even have man pages available tho.

    That's it for now. I'll try to update this if anyone has more questions.


  • Service Provider

    @travisdh1 I just went through all of this last night in order to expand space on a CentOS 7 VM.

    All of the guides and info seemed really bad. Nothing was consolidated or concise.

    I ended up with this guide working to get what I needed done except for the last step. The guide said to use resize2fs and that does not work. I had to use xfs_growfs as pointed out in an answer to this post.



  • @JaredBusch said in Wrapping your head around LVM.:

    @travisdh1 I just went through all of this last night in order to expand space on a CentOS 7 VM.

    All of the guides and info seemed really bad. Nothing was consolidated or concise.

    I ended up with this guide working to get what I needed done except for the last step. The guide said to use resize2fs and that does not work. I had to use xfs_growfs as pointed out in an answer to this post.

    Yeah. I found out real quick that it's nearly impossible to make a concise guide to working with this stuff. In your case it's more a file system issue. That's a horribly complex headline for that guide as well, and doesn't even touch on the file system in use. Something more along the lines of "Resize ext4 partition using LVM" would've been a lot better. Also a little convoluted. Resizing the partition before resizing the LV? Does not compute, at least in my head without trying to actually do it.

    Just going to point out that XFS won't shrink, ever. How many times does someone actually need to SHRINK a file system tho?



  • @JaredBusch said in Wrapping your head around LVM.:

    @travisdh1 I just went through all of this last night in order to expand space on a CentOS 7 VM.

    All of the guides and info seemed really bad. Nothing was consolidated or concise.

    I ended up with this guide working to get what I needed done except for the last step. The guide said to use resize2fs and that does not work. I had to use xfs_growfs as pointed out in an answer to this post.

    You also cannot shrink an XFS file system like you can with EXT. So while resize2fs will grow or shrink, xfs_frowfs will only grow.



  • @travisdh1 said in Wrapping your head around LVM.:

    @JaredBusch said in Wrapping your head around LVM.:

    @travisdh1 I just went through all of this last night in order to expand space on a CentOS 7 VM.

    All of the guides and info seemed really bad. Nothing was consolidated or concise.

    I ended up with this guide working to get what I needed done except for the last step. The guide said to use resize2fs and that does not work. I had to use xfs_growfs as pointed out in an answer to this post.

    Yeah. I found out real quick that it's nearly impossible to make a concise guide to working with this stuff. In your case it's more a file system issue. That's a horribly complex headline for that guide as well, and doesn't even touch on the file system in use. Something more along the lines of "Resize ext4 partition using LVM" would've been a lot better. Also a little convoluted. Resizing the partition before resizing the LV? Does not compute, at least in my head without trying to actually do it.

    Just going to point out that XFS won't shrink, ever. How many times does someone actually need to SHRINK a file system tho?

    Ha you beat me to it.



  • @JaredBusch Just think, brtfs is going to have all this same complexity built in like ZFS already does!

    I think the general rule is that by the time you really learn and understand a complex technology, that is when the technology will adopt something different. (systemd instead of initd as well for me.)


  • Service Provider

    @travisdh1 said in Wrapping your head around LVM.:

    Just going to point out that XFS won't shrink, ever. How many times does someone actually need to SHRINK a file system tho?

    I have yet to ever have it come up.