Linux – missing LV Name and VG Name while expanding a Linux volume

linuxredhatvmware-vsphere

I am trying to expand a second volume, /u01, using a process I've used in the past to expand volumes without rebooting the server. I can not locate the LV Name, and VG Name used to expand the volume.

This could be simply in the past I've only updated "8e Linux LVM" while this was the first attempt to expand a "83 Linux" drive. I haven't found any process to expand this drive type without unmounting the existing drive.

I've added the space in vSphere, and scanned the drives.

ls sd*

sda  sda1  sda2  sdb  sdb1
dev]# ls /sys/class/scsi_device/
0:0:0:0  0:0:1:0  2:0:0:0
[root@lsaa21d dev]# echo 1 > /sys/class/scsi_device/0\:0\:0\:0/device/rescan
[root@lsaa21d dev]# echo 1 > /sys/class/scsi_device/0\:0\:1\:0/device/rescan
[root@lsaa21d dev]# echo 1 > /sys/class/scsi_device/2\:0\:0\:0/device/rescan

Running fdisk I see the new sdb2 disk space

fdisk -l

Disk /dev/sdb: 96.6 GB, 96636764160 bytes, 188743680 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x283108d4

   Device Boot      Start         End      Blocks   Id  System
/dev/sdb1            2048   146800639    73399296   83  Linux    <<< Volume to expand
/dev/sdb2       146800640   188743679    20971520   83  Linux    <<< Drive expansion

Disk /dev/sda: 85.9 GB, 85899345920 bytes, 167772160 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x000e448c

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048     1026047      512000   83  Linux
/dev/sda2         1026048   167772159    83373056   8e  Linux LVM

Disk /dev/mapper/rhel_lor9p-root: 51.6 GB, 51636076544 bytes, 100851712 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk /dev/mapper/rhel_lor9p-swap: 8455 MB, 8455716864 bytes, 16515072 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk /dev/mapper/rhel_lor9p-home: 25.2 GB, 25211961344 bytes, 49242112 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

dev]# pvcreate /dev/sdb2
  Physical volume "/dev/sdb2" successfully created.

vgdisplay

  --- Volume group ---
  VG Name               rhel_lor9p
  System ID
  Format                lvm2
  Metadata Areas        1
  Metadata Sequence No  4
  VG Access             read/write
  VG Status             resizable
  MAX LV                0
  Cur LV                3
  Open LV               3
  Max PV                0
  Cur PV                1
  Act PV                1
  VG Size               79.51 GiB
  PE Size               4.00 MiB
  Total PE              20354
  Alloc PE / Size       20338 / 79.45 GiB
  Free  PE / Size       16 / 64.00 MiB
  VG UUID               2IY7ZG-H4yn-1RrK-eHUI-RxSd-T8Qi-faCBAV

pvdisplay

  --- Physical volume ---
  PV Name               /dev/sda2
  VG Name               rhel_lor9p
  PV Size               79.51 GiB / not usable 3.00 MiB
  Allocatable           yes
  PE Size               4.00 MiB
  Total PE              20354
  Free PE               16
  Allocated PE          20338
  PV UUID               ToJPjk-ICWd-KG2T-Rjl0-88Lj-q4zR-e16HuK

  "/dev/sdb2" is a new physical volume of "20.00 GiB"
  --- NEW Physical volume ---
  PV Name               /dev/sdb2
  VG Name
  PV Size               20.00 GiB
  Allocatable           NO
  PE Size               0
  Total PE              0
  Free PE               0
  Allocated PE          0
  PV UUID               BdzW42-Yi8u-priM-Uuiy-Z8B2-aaLP-1WS4vh

So as a result then I try to extend, or combine, the sdb1 and sdb2 drive space the logical volume isn't found.

dev]# lvextend -L+20G /dev/rhel_lor9p/u01
  Logical volume u01 not found in volume group rhel_lor9p.

EDIT 7/24
Adding lvdisplay

  --- Logical volume ---
  LV Path                /dev/rhel_lor9p/swap
  LV Name                swap
  VG Name                rhel_lor9p
  LV UUID                AWcuVC-5uRN-jrfJ-biQO-gpZf-IDmn-jPqrY8
  LV Write Access        read/write
  LV Creation host, time lor9p.salemstate.edu, 2016-06-02 12:54:31 -0400
  LV Status              available
  # open                 2
  LV Size                7.88 GiB
  Current LE             2016
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     8192
  Block device           253:1

  --- Logical volume ---
  LV Path                /dev/rhel_lor9p/home
  LV Name                home
  VG Name                rhel_lor9p
  LV UUID                FkOe1k-chhq-nfrd-M3ly-OV13-i6Sb-HYwgoo
  LV Write Access        read/write
  LV Creation host, time lor9p.salemstate.edu, 2016-06-02 12:54:31 -0400
  LV Status              available
  # open                 1
  LV Size                23.48 GiB
  Current LE             6011
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     8192
  Block device           253:2

  --- Logical volume ---
  LV Path                /dev/rhel_lor9p/root
  LV Name                root
  VG Name                rhel_lor9p
  LV UUID                iTRJA7-ATOs-nr2v-ryUz-GeLl-FfgM-2ewf9t
  LV Write Access        read/write
  LV Creation host, time lor9p.salemstate.edu, 2016-06-02 12:54:32 -0400
  LV Status              available
  # open                 1
  LV Size                48.09 GiB
  Current LE             12311
  Segments               1
  Allocation             inherit
  Read ahead sectors     auto
  - currently set to     8192
  Block device           253:0

Adding DF -h

Filesystem                                             Size  Used Avail Use% Mounted on
/dev/mapper/rhel_lor9p-root                           49G  5.0G   44G  11% /
tmpfs                                                  3.9G     0  3.9G   0% /sys/fs/cgroup
/dev/sdb1                                               69G   66G  2.7M 100% /u01
/dev/sda1                                              497M  268M  229M  54% /boot
/dev/mapper/rhel_lor9p-home                           24G  5.4G   19G  23% /home

Best Answer

You need to extend the volume group then extend the logical volume. You didn't list what LV you are trying to extend, so I'll assume home. You added the disk to LVM, now extend your volume group.

$ vgextend rhel_lor9p /dev/sdb2

Your current rhel_lor9p VG is 80GB. After you extend it with sdb2, it should be 100GB.

$ vgdisplay rhel_lor9p

Then you can then extend your LV.

$ lvextend /dev/rhel_lor9p/home -L +10G

This will add 10GB to home. If you specify the size without the plus sign then LVM will set the LV to that size. With the plus sign is adds that amount of space to whatever size the LV currently is.

Then you extend your filesystem. I'm assuming you are on Red Hat or CentOS as your VG name has "rhel" in the name. However, I don't know what version of RHEL you're on so I can't say exactly what the command is, but by default RHEL5 and RHEL6 use ext3 and ext4 respectively while RHEL7 switched to xfs.

For ext3 or 4:

$ resize2fs /dev/rhel_lor9p/home

For xfs:

$ xfs_growfs /dev/rhel_lor9p/home

Both of those resize the filesystem to the maximum available size. See the man pages of the respective commands if that is not what you want.

All of these commands can be done online. They do not require the filesystem to be unmounted.

Related Topic