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)?

3 Answers 3

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.

6
  • 1
    Don't forget to also run vgextend to add the new PV to the volume group.
    – bodgit
    Jul 20, 2016 at 16:42
  • Could I create another partition (ex, /dev/sdb2) and then merge that with the existing volume group rhel_data? This isn't a live system so I could potentially try extending though I'd like the least risky method to continue using two volume groups listed above. (ninjaedit: found vgmerge)
    – a coder
    Jul 20, 2016 at 16:58
  • 1
    Yes, that's what was proposed. Create a partition (/dev/sdb2), run pvcreate /dev/sdb2, then run vgextend rhel_data /dev/sdb2 which adds the new PV as available space to the rhel_data VG. There's no "merging" as such, you've just added another PV. Just be aware that at some point an LV may well end up straddling both PV's within that VG.
    – bodgit
    Jul 20, 2016 at 17:50
  • ok I went through the steps and lvdisplay now shows 279GB available for the logical volume /dev/rhel_data/www. The problem is df -h still shows just 47GB available for this logical volume.
    – a coder
    Jul 20, 2016 at 18:07
  • resize2fs /dev/rhel_data/www yields resize2fs: Device or resource busy while trying to open /dev/mapper/rhel_nbsdr_data-www. Couldn't find valid filesystem superblock. the volume is not mounted.
    – a coder
    Jul 20, 2016 at 18:18
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

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .