LVM Management

http://serverfault.com/questions/28989/fdisk-l-like-list-of-partitions-and-their-types-for-lvm-logical-volumes

http://www.howtogeek.com/howto/40702/how-to-manage-and-use-lvm-logical-volume-management-in-ubuntu/

The fdisk shows a 256GB Drive. 50GB on root and the question is how to resize up to the 256GB drive for more space.

]# fdsik -l
-bash: fdsik: command not found
root@cpanel [~]# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root
                       50G   27G   21G  56% /
tmpfs                 3.9G     0  3.9G   0% /dev/shm
/dev/sda1             485M   96M  364M  21% /boot
/dev/mapper/VolGroup-lv_home
                      1.1T   43G  996G   5% /home
/dev/sdc1             917G  200M  871G   1% /backup
root@cpanel [~]# fdisk -l

Disk /dev/sdb: 1000.2 GB, 1000204886016 bytes
255 heads, 63 sectors/track, 121601 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x0004bb0e

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1               1      121602   976760832   8e  Linux LVM

Disk /dev/sda: 256.1 GB, 256060514304 bytes
255 heads, 63 sectors/track, 31130 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00062f67

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          64      512000   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2              64       31131   249545728   8e  Linux LVM

Disk /dev/sdc: 1000.2 GB, 1000204886016 bytes
81 heads, 63 sectors/track, 382818 cylinders
Units = cylinders of 5103 * 512 = 2612736 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xa9b15e21

   Device Boot      Start         End      Blocks   Id  System
/dev/sdc1               1      382818   976760095+  83  Linux

Disk /dev/mapper/VolGroup-lv_root: 53.7 GB, 53687091200 bytes
255 heads, 63 sectors/track, 6527 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000


Disk /dev/mapper/VolGroup-lv_swap: 8355 MB, 8355053568 bytes
255 heads, 63 sectors/track, 1015 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000


Disk /dev/mapper/VolGroup-lv_home: 1193.7 GB, 1193690529792 bytes
255 heads, 63 sectors/track, 145124 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000000


# df -h
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup-lv_root
                       50G   27G   21G  56% /
tmpfs                 3.9G     0  3.9G   0% /dev/shm
/dev/sda1             485M   96M  364M  21% /boot
/dev/mapper/VolGroup-lv_home
                      1.1T   43G  996G   5% /home
/dev/sdc1             917G  200M  871G   1% /backup

You can learn information about the volume group itself with ‘lvdisplay’, ‘vgscan’, ‘lvs’ and ‘vgdisplay’.

root@cpanel [~]# lvdisplay --maps
  --- Logical volume ---
  LV Path                /dev/VolGroup/lv_root
  LV Name                lv_root
  VG Name                VolGroup
  LV UUID                TYNmVB-vtiC-Gce6-FAsk-VXxi-CJDA-K4Pg8g
  LV Write Access        read/write
  LV Creation host, time localhost.localdomain, 2014-08-29 13:01:37 -0400
  LV Status              available
  # open                 1
  LV Size                50.00 GiB
  Current LE             12800
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:0

  --- Segments ---
  Logical extents 0 to 12799:
    Type                linear
    Physical volume     /dev/sda2
    Physical extents    0 to 12799


  --- Logical volume ---
  LV Path                /dev/VolGroup/lv_home
  LV Name                lv_home
  VG Name                VolGroup
  LV UUID                PojYKo-WnwD-ywxH-6C0V-Ta7U-3sfE-x4szaI
  LV Write Access        read/write
  LV Creation host, time localhost.localdomain, 2014-08-29 13:01:39 -0400
  LV Status              available
  # open                 1
  LV Size                1.09 TiB
  Current LE             284598
  Segments               2
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:3

  --- Segments ---
  Logical extents 0 to 238465:
    Type                linear
    Physical volume     /dev/sdb1
    Physical extents    0 to 238465

  Logical extents 238466 to 284597:
    Type                linear
    Physical volume     /dev/sda2
    Physical extents    12800 to 58931


  --- Logical volume ---
  LV Path                /dev/VolGroup/lv_swap
  LV Name                lv_swap
  VG Name                VolGroup
  LV UUID                g2sdlK-rUv3-visr-NlMW-G3As-SOE2-07RDB1
  LV Write Access        read/write
  LV Creation host, time localhost.localdomain, 2014-08-29 13:04:05 -0400
  LV Status              available
  # open                 1
  LV Size                7.78 GiB
  Current LE             1992
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     256
  Block device           253:1

  --- Segments ---
  Logical extents 0 to 1991:
    Type                linear
    Physical volume     /dev/sda2
    Physical extents    58932 to 60923

LVS

lvs
  LV      VG       Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  lv_home VolGroup -wi-ao---- 931.71g
  lv_root VolGroup -wi-ao---- 230.00g
  lv_swap VolGroup -wi-ao----   7.78g

Both drives are in an LVM configuration. This allows you to create logical partitions that include either or both drives.

/dev/mapper/VolGroup-lv_root exists on the SDA drive (Physical volume /dev/sda2) and
/dev/mapper/VolGroup-lv_home exists on both the SDA and SDB drive. To remove the LVM configuration, re-installation would be necessary, but we can re-configure the LVM configuration so that /dev/mapper/VolGroup-lv_root is larger.

Leave a Comment