0

I started off with a 25GB hard drive, and wanted to extend it to 150GB. I used fdisk to extend the /dev/sda2 partition from 26GB to 149GB. lsblk shows the following information:

NAME          MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda             8:0    0  150G  0 disk
├─sda1          8:1    0    1G  0 part /boot
└─sda2          8:2    0  149G  0 part
  ├─rhel-root 253:0    0   76G  0 lvm  /
  └─rhel-swap 253:1    0    3G  0 lvm  [SWAP]
sdb             8:16   0   50G  0 disk
└─rhel-root   253:0    0   76G  0 lvm  /
sr0            11:0    1 1024M  0 rom

fdisk -l shows the following output:

Disk /dev/sdb: 53.7 GB, 53687091200 bytes, 104857600 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/sda: 161.1 GB, 161061273600 bytes, 314572800 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: 0x000b0bb3

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048     2099199     1048576   83  Linux
/dev/sda2         2099200   314572799   156236800   83  Linux

Disk /dev/mapper/rhel-root: 81.6 GB, 81595990016 bytes, 159367168 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-swap: 3221 MB, 3221225472 bytes, 6291456 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

I put in a second 50GB disk and was able to use vgextend and xfs_growfs to add it to the volume group. Now, the rhel volume group is 76GB. However, I don't understand why the volume group isn't 200GB, since sda2 is 149GB. The results of pvscan are below:

  PV /dev/sda2   VG rhel            lvm2 [<29.00 GiB / 0    free]
  PV /dev/sdb    VG rhel            lvm2 [<50.00 GiB / 0    free]
  Total: 2 [78.99 GiB] / in use: 2 [78.99 GiB] / in no VG: 0 [0   ]

It shows /dev/sda2 as <29.00GB, which is surprising to me. I would have expected it to be 149G as shown in lsblk. I tried doing vgextend rhel /dev/sda2, and it says that the physical volume /dev/sda2 is already in the volume group rhel, which makes sense. I'm just struggling to understand why df -h only shows 76GB when I would think it would be 200GB. Here is the output of df -h:

Filesystem             Size  Used Avail Use% Mounted on
/dev/mapper/rhel-root   76G   11G   66G  14% /
devtmpfs               3.9G     0  3.9G   0% /dev
tmpfs                  3.9G     0  3.9G   0% /dev/shm
tmpfs                  3.9G  9.0M  3.9G   1% /run
tmpfs                  3.9G     0  3.9G   0% /sys/fs/cgroup
/dev/sda1             1014M  217M  798M  22% /boot
tmpfs                  783M     0  783M   0% /run/user/1000
tmpfs                  783M     0  783M   0% /run/user/0

Please let me know what steps I can take to make /dev/mapper/rhel-root the full 200GB it should be.

3

Try using pvresize. Eventually the partition was resized, but not the physical volume in lvm.

https://linux.die.net/man/8/pvresize

| improve this answer | |
  • This was exactly it! I used pvresize on /dev/sda2, then was able to use lvextend and xfs_growfs to fix the issue. Thank you so much! – AndreasKralj Jun 18 '19 at 20:01
  • Good to see that it worked out. Your welcome. – hargut Jun 19 '19 at 8:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.