Purchase Linux CDs / DVDs / Flash Drives at OSDisc.com

Welcome to Our Community

While Linux.org has been around for a while, we recently changed management and had to purge most of the content (including users). If you signed up before April 23rd please sign up again. Thanks!

Deciphering the Proper LVM

Discussion in 'General Linux' started by MikeyD, May 14, 2017.

Tags:
  1. MikeyD

    MikeyD New Member

    Joined:
    May 5, 2017
    Messages:
    9
    Likes Received:
    10
    Hey guys,

    My experience with logical volume managers (lvms) is limited. I've often added drives and extended them at work using cloud VMs, but beyond that I've never had to resize, remove or really "manage" them (just delete VM when I'm done with it :p)

    I have a home server running CentOS 6. I set up an LVM when I first built it but as a less-informed Linuxer at the time and just want to see what you guys think of the setup and if it should be changed. I'm looking into it more now as I just bought a 4 TB HDD I want to add.




    Current Disks:
    /dev/sda - 64 GB SSD - assigned to lv_root (supposedly for /, but also has boot sector)
    /dev/sdb - 2 TB HDD - assigned to lv_home (supposedly for /home)

    Adding a 4 TB HDD to extend /home dirs.


    My VG/PV/LV and df -h output is below:
    vgdisplay:
    Code:
    --- Volume group ---
      VG Name               vg_charlie
      System ID
      Format                lvm2
      Metadata Areas        2
      Metadata Sequence No  7
      VG Access             read/write
      VG Status             resizable
      MAX LV                0
      Cur LV                3
      Open LV               3
      Max PV                0
      Cur PV                2
      Act PV                2
      VG Size               1.88 TiB
      PE Size               4.00 MiB
      Total PE              492070
      Alloc PE / Size       491923 / 1.88 TiB
      Free  PE / Size       147 / 588.00 MiB
      VG UUID               89FdWQ-xFkj-oTLQ-r93N-SR5N-oCk1-a04klF
    
    pvdisplay:
    Code:
    [[email protected]: /dev/vg_charlie]# pvdisplay
      --- Physical volume ---
      PV Name               /dev/sda2
      VG Name               vg_charlie
      PV Size               59.14 GiB / not usable 4.00 MiB
      Allocatable           yes (but full)
      PE Size               4.00 MiB
      Total PE              15138
      Free PE               0
      Allocated PE          15138
      PV UUID               XvQPeA-IZCU-Bz4o-Ok1d-JtZn-vjYr-mIDGy6
    
      --- Physical volume ---
      PV Name               /dev/sdb
      VG Name               vg_charlie
      PV Size               1.82 TiB / not usable 1.09 MiB
      Allocatable           yes
      PE Size               4.00 MiB
      Total PE              476932
      Free PE               147
      Allocated PE          476785
      PV UUID               bxJTA5-h0Me-ahUK-EP7H-Hxvk-U0YG-Yc8lDI
    
    lvdisplay:
    Code:
    [[email protected]: /dev/vg_charlie]# lvdisplay
      --- Logical volume ---
      LV Path                /dev/vg_charlie/lv_root
      LV Name                lv_root
      VG Name                vg_charlie
      LV UUID                GizFrC-I1Lw-3hjF-iUMd-bvWc-Ez09-0DYyn6
      LV Write Access        read/write
      LV Creation host, time charlie, 2014-07-29 17:56:22 -0400
      LV Status              available
      # open                 1
      LV Size                48.45 GiB
      Current LE             12402
      Segments               1
      Allocation             inherit
      Read ahead sectors     auto
      - currently set to     256
      Block device           253:0
    
      --- Logical volume ---
      LV Path                /dev/vg_charlie/lv_home
      LV Name                lv_home
      VG Name                vg_charlie
      LV UUID                4dJHsn-dDLn-ya4q-0IFC-1nRK-s2yi-ulUUpc
      LV Write Access        read/write
      LV Creation host, time charlie, 2014-07-29 17:56:43 -0400
      LV Status              available
      # open                 1
      LV Size                1.82 TiB
      Current LE             477995
      Segments               2
      Allocation             inherit
      Read ahead sectors     auto
      - currently set to     256
      Block device           253:2
    
      --- Logical volume ---
      LV Path                /dev/vg_charlie/lv_swap
      LV Name                lv_swap
      VG Name                vg_charlie
      LV UUID                njaAy6-ef9w-t9pi-dFxF-tNH8-Ja4b-Qyhi2e
      LV Write Access        read/write
      LV Creation host, time charlie, 2014-07-29 17:56:46 -0400
      LV Status              available
      # open                 1
      LV Size                5.96 GiB
      Current LE             1526
      Segments               1
      Allocation             inherit
      Read ahead sectors     auto
      - currently set to     256
      Block device           253:1
    
    df -h:
    Code:
    [[email protected]: /dev/vg_charlie]# df -h
    Filesystem            Size  Used Avail Use% Mounted on
    /dev/mapper/vg_charlie-lv_root
                           48G  5.1G   41G  12% /
    tmpfs                 3.8G  164K  3.8G   1% /dev/shm
    /dev/sda1             477M  169M  283M  38% /boot
    /dev/mapper/vg_charlie-lv_home
                          1.8T  1.5T  262G  86% /home
    

    I wanted to check a few things:

    1. I've heard its not a good idea to set up an LVM for disks at different r/w speeds. Is it a better idea not to have SSD and HDDs on the same LVM?

    2. Ideally I want root (/) on the SSD and /home on the HDDs. According to df -h that looks like it is correct, but can I trust df -h with an LVM? Since I wouldn't think they are directly 'mounted'.

    3. I also noticed there is a swap logical volume but can't really tell what disk it was created with. Is there a command to check?

    4. I'm thinking of upgrading the OS to Centos 7 since 6 is quickly reaching EOL, maybe even doing a fresh install so I can use disk encryption. Is there a good way or resource anyone has on the best way to "break up" an LVM? I'd be worried of file corruption on files that extend to multiple physical disks but maybe this isn't a problem since each disk is part of its own logical volume?


    Sorry in advance for the barrage of info and questions :). Really also just looking for general advice on if and how others have set up LVMs, particularly with different disk types.

    Thanks!

    Mike
     
    Rob likes this.
  2. MikeyD

    MikeyD New Member

    Joined:
    May 5, 2017
    Messages:
    9
    Likes Received:
    10
    Looking at this today pretty sure I was overthinking this lol.
     
  3. Rob

    Rob Administrator
    Staff Member

    Joined:
    Oct 27, 2011
    Messages:
    172
    Likes Received:
    469
    Hey there!

    Yeah, if you're thinking of upgrading to CentOS 7 anyway, i'd save your files somewhere, then start from scratch and set up LVM the way you see yourself using it in the future since you can't do a direct 6 --> 7 upgrade anyway.

    I wouldn't mix speeds or hardware types of drives in LVM, though it may just default to the lowest in the end anyway.

    On the other hand, since a full wipe / re-install is in your future at some point, why not experiment w/ the dif speeds and arch of the drives within lvm.. it might end up being interesting. :)

    Let us know what you end up doing!
     
    MikeyD likes this.

Share This Page