大网数据广告活动
服务器运维问答

pvs not showing correct available space

· 52CE 我爱测

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.…

问题原文

原帖链接 · a coder · CC BY-SA 3.0

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

已采纳解答

原帖链接 · Law29 · CC BY-SA 3.0

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.

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2016-07-20)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。