6

Recently installed RHEL7 on a PowerEdge R320 with the following drives:

2 x 300GB sas 15k
2 x 1TB sas 7.2k

When setting up LVM during installation I purposefully left over several hundred GB free in case I needed to expand later.

I'm now seeing that I need to expand one of the volumes created during install.

The problem is pvs is only showing what I created, and is not showing any usable free space.

[user@box ~] pvdisplay
  --- Physical volume ---
  PV Name               /dev/sda2
  VG Name               rhel_os
  PV Size               165.79 GiB / not usable 0   
  Allocatable           yes (but full)
  PE Size               4.00 MiB
  Total PE              42443
  Free PE               0
  Allocated PE          42443
  PV UUID               sDdEfu-qagM-qq35-OGfF-HpPw-Bizd-LcXazt

  --- Physical volume ---
  PV Name               /dev/sdb1
  VG Name               rhel_data
  PV Size               139.71 GiB / not usable 4.00 MiB
  Allocatable           yes 
  PE Size               4.00 MiB
  Total PE              35766
  Free PE               1
  Allocated PE          35765
  PV UUID               Jgjcad-idBE-wxXc-tGGf-SY8m-qb8T-nBi9ar

parted shows the free space:

[user@box ~]# parted
GNU Parted 3.1
Using /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) print free                                                       
Model: DELL PERC H710 (scsi)
Disk /dev/sda: 299GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags: 

Number  Start   End     Size    Type     File system  Flags
        18.4kB  1049kB  1030kB           Free Space
 1      1049kB  301MB   300MB   primary  xfs          boot
 2      301MB   178GB   178GB   primary               lvm
        178GB   299GB   121GB            Free Space

and /dev/sdb:

[user@box ~]# parted /dev/sdb
(parted) print free
Model: DELL PERC H710 (scsi)
Disk /dev/sdb: 1000GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags: 

Number  Start   End     Size    Type     File system  Flags
        32.3kB  1049kB  1016kB           Free Space
 1      1049kB  150GB   150GB   primary               lvm
        150GB   1000GB  850GB            Free Space

1) What do I need to do to make use of the free 850GB?

2) In the future, how could I have placed all of the Free Space into the physical volume (thus making it easier to use with LVM)?

a coder
  • 819

3 Answers3

6

LVM will only show space that has been formatted for LVM by using pvcreate. Here, it doesn't seem you even have a partition.

1) First you need to create the partition (sda3 I suppose), using your favorite partitioning tool. Assign the LVM tag to the partition. Then, assuming that your 121GB partition is /dev/sda3, you need to run pvcreate /dev/sda3 to get it recognized by LVM. After that you will probably want to run either vgextend rhel_os /dev/sda3 or maybe vgextend rhel_data /dev/sda3 (thanks @bodgit)

2) To avoid this happening you should have assigned all space to LVM, but kept your individual LVs small. Usually /home will be very large, just reduce it, and don't worry that the sum of the LVs is smaller than the total. I forget how you'd do that exactly, since it's been decades since I partitioned a RedHat without an automated deployment tool :)

Another solution would be to extend your sda2 partition and tell LVM about it, but that introduces an additional risk of error that is useless in this case.

Law29
  • 3,617
  • 1
  • 18
  • 30
2

I got the same issue, so I type on my CLI as root pvresize /dev/sdaX. After, pvscan to confirm. Done my physical disk mounted on my linux show me all the space though its not using in the LVM.

1

I had to use growpart /dev/sda 3 (notice the space between /dev/sda and 3!) (extended the disk on Hyper-V (VHDX)).

See this great post: https://superuser.com/a/1748427/560320

strarsis
  • 111