pvresize命令-调整LVM中物理卷的容量大小-Linux命令大全ROED容易得分享

ROED2023-02-01  996

pvresize命令 – 调整LVM中物理卷的容量大小

 

pvresize命令来自于英文词组”Physical Volume resize“的缩写,其功能是用于调整LVM中物理卷的容量大小。pvresize命令可以调整已在卷组中的物理卷容量大小,一般要在物理卷设备扩容或缩小容量前进行此操作,提前告知操作系统和LVM逻辑卷管理器新的物理卷大小,若要缩小物理卷容量,不得低于已使用的容量。

语法格式:pvresize [参数] 物理卷

常用参数:

-d 调试模式
-h 帮助信息
-t 以测试模式运行
-v 制定发送消息的详细等级
-y 无需二次确认
-- reportformat basic|json 重写当前报告的输出格式
-- setphysicalvolumesize<卷大小> 覆盖物理卷自动检测到的尺寸

参考实例

同步物理卷的容量为最新大小:

[root@linuxcool ~]# pvresize /dev/sda2
  Physical volume "/dev/sda2" changed
  1 physical volume(s) resized or updated / 0 physical volume(s) not resized

调整物理卷的容量大小为20GB(需二次确认):

[root@linuxcool ~]# pvresize --setphysicalvolumesize 20G /dev/sda2
  WARNING: /dev/sda2: Overriding real size <19.00 GiB. You could lose data.
/dev/sda2: Requested size 20.00 GiB exceeds real size <19.00 GiB. Proceed?  [y/n]: y
  WARNING: /dev/sda2: Pretending size is 41943040 not 39843840 sectors.
  Physical volume "/dev/sda2" changed
  1 physical volume(s) resized or updated / 0 physical volume(s) not resized

以测试模式运行,同步物理卷容量为最新大小:

[root@linuxcool ~]# pvresize -t /dev/sda2
  TEST MODE: Metadata will NOT be updated and volumes will not be (de)activated.
  WARNING: Device /dev/sda2 has size of 39843840 sectors which is smaller than corresponding PV size of 41940992 sectors. Was device resized?
  One or more devices used as PVs in VG rhel_linuxprobe have changed sizes.
  Physical volume "/dev/sda2" changed
  1 physical volume(s) resized or updated / 0 physical volume(s) not resized

pvresize命令 – 调整LVM中物理卷的容量大小,知识来源于网络运用于网络,仅供学习、交流使用,版权归属原作者所有。【内容仅供参考,请读者自行甄别,以防风险】

申明 1、网站名称:容易得 网址:WWW.ROED.CN
2、网站的内容来源于网络,如有侵权,请联系邮箱:185254287#qq.com 本站会在7个工作日内进行删除处理。
3、转载发布此文目的在于传递分享更多信息,仅代表原作者个人观点,并不代表本站赞同其观点和对其真实性负责。文章内容仅供参考,请读者自行甄别,以防风险。
4、禁止发布和链接任何有关政治、色情、宗教、迷信、低俗、变态、血腥、暴力以及危害国家安全,诋毁政府形象等违法言论和信息。
转载请注明原文地址:https://www.roed.cn/read-1030.html