Adding new LVM partition

First, assign a new disk to the system.
In our case, i have create a LVM partition called /dev/sdb1 with LVM type.

Show existing and create new Physical Volume
[root@FPXAPPBGID01 ~]# pvs
  PV         VG              Fmt  Attr PSize   PFree
  /dev/sda3  VolGroup00_ROOT lvm2 a--  133.75g      0

root@ABC ~]# pvcreate /dev/sdb1
  dev_is_mpath: failed to get device for 8:17
  Physical volume "/dev/sdb1" successfully created

You may use “pvs” or “pvdisplay” or “lvmdiskscan” to show the PVs
[root@ABC ~]# pvdisplay
  --- Physical volume ---
  PV Name               /dev/sda3
  VG Name               VolGroup00_ROOT
  PV Size               133.75 GiB / not usable 0
  Allocatable           yes (but full)
  PE Size               4.00 MiB
  Total PE              34241
  Free PE               0
  Allocated PE          34241
  PV UUID               XAf2JX-hFZf-aLGh-sqgt-1bB9-eE1J-WggwUL

  "/dev/sdb1" is a new physical volume of "150.00 GiB"
  --- NEW Physical volume ---
  PV Name               /dev/sdb1
  VG Name
  PV Size               150.00 GiB
  Allocatable           NO
  PE Size               0
  Total PE              0
  Free PE               0
  Allocated PE          0
  PV UUID               g6QVGr-2zlF-Otqc-o24I-UKsS-yYkd-rOe8Ee

Create Volume Group
[root@ABC ~]# vgcreate VolGroup01_APPL /dev/sdb1
  Volume group "VolGroup01_APPL" successfully created

[root@ABC ~]# vgdisplay
  --- Volume group ---
  VG Name               VolGroup01_APPL
  System ID
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  1
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                0
  Open LV               0
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               150.00 GiB
  PE Size               4.00 MiB
  Total PE              38399
  Alloc PE / Size       0 / 0
  Free  PE / Size       38399 / 150.00 GiB
  VG UUID               gWatkt-DrJy-TEKI-aHbv-36sr-gXLx-zWt33i

  --- Volume group ---
  VG Name               VolGroup00_ROOT
  System ID
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  5
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                4
  Open LV               4
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               133.75 GiB
  PE Size               4.00 MiB
  Total PE              34241
  Alloc PE / Size       34241 / 133.75 GiB
  Free  PE / Size       0 / 0
  VG UUID               S7DAGH-P2ei-6Hqt-CeXu-lcqT-x71G-Io5KJQ

[root@ABC ~]# pvs
  PV         VG              Fmt  Attr PSize   PFree
  /dev/sda3  VolGroup00_ROOT lvm2 a--  133.75g      0
  /dev/sdb1  VolGroup01_APPL lvm2 a--  150.00g 150.00g

Scan and create new Logical Volumes
[root@ABC ~]# lvs
  LV            VG              Attr       LSize  Pool Origin Data%  Move Log Cpy%Sync Convert
  LogVol00_HOME VolGroup00_ROOT -wi-ao---- 20.00g
  LogVol00_ROOT VolGroup00_ROOT -wi-ao---- 83.75g
  LogVol00_TMP  VolGroup00_ROOT -wi-ao---- 10.00g
  LogVol00_VAR  VolGroup00_ROOT -wi-ao---- 20.00g

[root@ABC ~]# lvcreate -L150G -n LogVol01_APPL VolGroup01_APPL
  Logical volume " LogVol01_APPL" created

Create file system
[root@ABC ~]# mkfs.ext4 /dev/VolGroup01_APPL/LogVol01_APPL
[root@ABC ~]# mkdir /appl
[root@ABC ~]# mount /dev/VolGroup01_APPL/LogVol01_APPL /appl
[root@ABC ~]# df -h
Filesystem                                 Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup00_ROOT-LogVol00_ROOT   83G  2.7G   76G   4% /
tmpfs                                       12G     0   12G   0% /dev/shm
/dev/sda1                                  243M   35M  195M  16% /boot
/dev/mapper/VolGroup00_ROOT-LogVol00_HOME   20G  172M   19G   1% /home
/dev/mapper/VolGroup00_ROOT-LogVol00_TMP   9.9G  154M  9.2G   2% /tmp
/dev/mapper/VolGroup00_ROOT-LogVol00_VAR    20G  250M   19G   2% /var
/dev/mapper/VolGroup01_APPL-LogVol01_APPL  147G  188M  140G   1% /appl
[root@ABC appl]# lvs
  LV            VG              Attr       LSize   Pool Origin Data%  Move Log Cpy%Sync Convert
  LogVol00_HOME VolGroup00_ROOT -wi-ao----  20.00g
  LogVol00_ROOT VolGroup00_ROOT -wi-ao----  83.75g
  LogVol00_TMP  VolGroup00_ROOT -wi-ao----  10.00g
  LogVol00_VAR  VolGroup00_ROOT -wi-ao----  20.00g
  LogVol01_APPL VolGroup01_APPL -wi-ao---- 149.00g   ß0 means the drive is “open” or in-use


And lastly, make sure you add it to /etc/fstab to make it auto mount across reboots.

No comments: