Having trouble with lvextend

I've screwed something up somewhere. sda3 shows 0% free but I'm trying to extend sda2 to the free space I created by adding space in vmware.

I was following this https://kb.vmware.com/s/article/1006371 and last time it worked but I think my dog interrupted me and I screwed something up at some point.

The drive in vsphere is set to 200 GB now, only 100 GB is recognized on sda2.

[root@zabbix ~]# lvscan
  ACTIVE            '/dev/centos/swap' [5.00 GiB] inherit
  ACTIVE            '/dev/centos/root' [93.99 GiB] inherit

[root@zabbix ~]# pvscan
  PV /dev/sda2   VG centos          lvm2 [<49.00 GiB / 0    free]
  PV /dev/sda3   VG centos          lvm2 [<50.00 GiB / 0    free]
  Total: 2 [98.99 GiB] / in use: 2 [98.99 GiB] / in no VG: 0 [0   ]

[root@zabbix ~]# vgscan
  Reading volume groups from cache.
  Found volume group "centos" using metadata type lvm2

[root@zabbix ~]# df -h
Filesystem               Size  Used Avail Use% Mounted on
/dev/mapper/centos-root   94G   85G  8.9G  91% /
devtmpfs                  16G     0   16G   0% /dev
tmpfs                     16G     0   16G   0% /dev/shm
tmpfs                     16G  8.9M   16G   1% /run
tmpfs                     16G     0   16G   0% /sys/fs/cgroup
/dev/sda1               1014M  222M  793M  22% /boot
tmpfs                    3.2G     0  3.2G   0% /run/user/0

[root@zabbix ~]# fdisk -l

Disk /dev/sda: 214.7 GB, 214748364800 bytes, 419430400 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: 0x000ba4e5

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048     2099199     1048576   83  Linux
/dev/sda2         2099200   104857599    51379200   8e  Linux LVM
/dev/sda3       104857600   209715199    52428800   8e  Linux LVM

Disk /dev/mapper/centos-root: 100.9 GB, 100923342848 bytes, 197115904 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/centos-swap: 5368 MB, 5368709120 bytes, 10485760 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

Posted Sep 2, 2018, 3:08 PM UTC

18
xxxsirkillalot•

Did you extend the file system after extending the lv?

1
pootbertOP•

I've tried so much I'm not sure.

[root@zabbix ~]# pvresize /dev/sda3
  Physical volume "/dev/sda3" changed
  1 physical volume(s) resized / 0 physical volume(s) not resized
[root@zabbix ~]# lvs
  LV   VG     Attr       LSize  Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
  root centos -wi-ao---- 93.99g
  swap centos -wi-ao----  5.00g
[root@zabbix ~]# pvs
  PV         VG     Fmt  Attr PSize   PFree
  /dev/sda2  centos lvm2 a--  <49.00g    0
  /dev/sda3  centos lvm2 a--  <50.00g    0
[root@zabbix ~]# vgs
  VG     #PV #LV #SN Attr   VSize  VFree
  centos   2   2   0 wz--n- 98.99g    0
1
[deleted]•

[deleted]

1
xxxsirkillalot•

your centos vg is still 100 gig in size. It looks like you added sda3 to the centos vg but didn't extend the VG to add more space vgextend for this. after you do that expand the root lv on the centos vg (lvextend)and finally expand the file system with that space as well .

1
pootbertOP•

I'm getting this when I try even though I don't think it is in use.

[root@zabbix ~]# vgextend centos /dev/sda3
  Can't open /dev/sda3 exclusively.  Mounted filesystem?
[root@zabbix ~]# umount /dev/sda3
  umount: /dev/sda3: not mounted
1
xxxsirkillalot•

please show vgdisplay centos,

Have you tried rebooting?

1
[deleted]•

[deleted]

1
lutusp•

... but I think my dog interrupted me and I screwed something up at some point.

You have two choices:

  1. Don't use LVM.

  2. Exclude your dog from the computer room.

I personally would exercise option (1) rather than option (2), the latter of which which would seem inhumane and impractical.

1