我正在尝试使用我过去使用过的一种无需重新启动服务器即可扩展卷的流程来扩展第二个卷 /u01。我找不到用于扩展卷的 LV 名称和 VG 名称。
这可能只是因为我过去只更新过“8e Linux LVM”,而这是第一次尝试扩展“83 Linux”驱动器。我还没有找到任何在不卸载现有驱动器的情况下扩展此驱动器类型的方法。
我已经在 vSphere 中添加了空间,并扫描了驱动器。
ls sd*
sda sda1 sda2 sdb sdb1
dev]# ls /sys/class/scsi_device/
0:0:0:0 0:0:1:0 2:0:0:0
[root@lsaa21d dev]# echo 1 > /sys/class/scsi_device/0\:0\:0\:0/device/rescan
[root@lsaa21d dev]# echo 1 > /sys/class/scsi_device/0\:0\:1\:0/device/rescan
[root@lsaa21d dev]# echo 1 > /sys/class/scsi_device/2\:0\:0\:0/device/rescan
运行 fdisk 我看到新的 sdb2 磁盘空间
fdisk -l
Disk /dev/sdb: 96.6 GB, 96636764160 bytes, 188743680 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: 0x283108d4
Device Boot Start End Blocks Id System
/dev/sdb1 2048 146800639 73399296 83 Linux <<< Volume to expand
/dev/sdb2 146800640 188743679 20971520 83 Linux <<< Drive expansion
Disk /dev/sda: 85.9 GB, 85899345920 bytes, 167772160 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: 0x000e448c
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 1026047 512000 83 Linux
/dev/sda2 1026048 167772159 83373056 8e Linux LVM
Disk /dev/mapper/rhel_lor9p-root: 51.6 GB, 51636076544 bytes, 100851712 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_lor9p-swap: 8455 MB, 8455716864 bytes, 16515072 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_lor9p-home: 25.2 GB, 25211961344 bytes, 49242112 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
dev]# pvcreate /dev/sdb2
Physical volume "/dev/sdb2" successfully created.
显示
--- Volume group ---
VG Name rhel_lor9p
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 4
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 3
Open LV 3
Max PV 0
Cur PV 1
Act PV 1
VG Size 79.51 GiB
PE Size 4.00 MiB
Total PE 20354
Alloc PE / Size 20338 / 79.45 GiB
Free PE / Size 16 / 64.00 MiB
VG UUID 2IY7ZG-H4yn-1RrK-eHUI-RxSd-T8Qi-faCBAV
光伏显示器
--- Physical volume ---
PV Name /dev/sda2
VG Name rhel_lor9p
PV Size 79.51 GiB / not usable 3.00 MiB
Allocatable yes
PE Size 4.00 MiB
Total PE 20354
Free PE 16
Allocated PE 20338
PV UUID ToJPjk-ICWd-KG2T-Rjl0-88Lj-q4zR-e16HuK
"/dev/sdb2" is a new physical volume of "20.00 GiB"
--- NEW Physical volume ---
PV Name /dev/sdb2
VG Name
PV Size 20.00 GiB
Allocatable NO
PE Size 0
Total PE 0
Free PE 0
Allocated PE 0
PV UUID BdzW42-Yi8u-priM-Uuiy-Z8B2-aaLP-1WS4vh
因此,当我尝试扩展或合并 sdb1 和 sdb2 驱动器空间时,找不到逻辑卷。
dev]# lvextend -L+20G /dev/rhel_lor9p/u01
Logical volume u01 not found in volume group rhel_lor9p.
编辑 7/24 添加 lvdisplay
--- Logical volume ---
LV Path /dev/rhel_lor9p/swap
LV Name swap
VG Name rhel_lor9p
LV UUID AWcuVC-5uRN-jrfJ-biQO-gpZf-IDmn-jPqrY8
LV Write Access read/write
LV Creation host, time lor9p.salemstate.edu, 2016-06-02 12:54:31 -0400
LV Status available
# open 2
LV Size 7.88 GiB
Current LE 2016
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 253:1
--- Logical volume ---
LV Path /dev/rhel_lor9p/home
LV Name home
VG Name rhel_lor9p
LV UUID FkOe1k-chhq-nfrd-M3ly-OV13-i6Sb-HYwgoo
LV Write Access read/write
LV Creation host, time lor9p.salemstate.edu, 2016-06-02 12:54:31 -0400
LV Status available
# open 1
LV Size 23.48 GiB
Current LE 6011
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 253:2
--- Logical volume ---
LV Path /dev/rhel_lor9p/root
LV Name root
VG Name rhel_lor9p
LV UUID iTRJA7-ATOs-nr2v-ryUz-GeLl-FfgM-2ewf9t
LV Write Access read/write
LV Creation host, time lor9p.salemstate.edu, 2016-06-02 12:54:32 -0400
LV Status available
# open 1
LV Size 48.09 GiB
Current LE 12311
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 253:0
添加 DF -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/rhel_lor9p-root 49G 5.0G 44G 11% /
tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup
/dev/sdb1 69G 66G 2.7M 100% /u01
/dev/sda1 497M 268M 229M 54% /boot
/dev/mapper/rhel_lor9p-home 24G 5.4G 19G 23% /home
答案1
您需要扩展卷组,然后扩展逻辑卷。您没有列出要扩展的 LV,因此我假设是 home。您已将磁盘添加到 LVM,现在扩展您的卷组。
$ vgextend rhel_lor9p /dev/sdb2
您当前的 rhel_lor9p VG 为 80GB。使用 sdb2 扩展后,它应该为 100GB。
$ vgdisplay rhel_lor9p
然后您就可以扩展您的 LV。
$ lvextend /dev/rhel_lor9p/home -L +10G
这将向 home 添加 10GB。如果您指定不带加号的大小,则 LVM 会将 LV 设置为该大小。如果使用加号,则会将该空间量添加到 LV 当前的大小。
然后扩展文件系统。我假设您使用的是 Red Hat 或 CentOS,因为您的 VG 名称中包含“rhel”。但是,我不知道您使用的是哪个版本的 RHEL,所以我无法确切地说出命令是什么,但默认情况下 RHEL5 和 RHEL6 分别使用 ext3 和 ext4,而 RHEL7 则切换到 xfs。
对于 ext3 或 4:
$ resize2fs /dev/rhel_lor9p/home
对于 xfs:
$ xfs_growfs /dev/rhel_lor9p/home
这两个命令都会将文件系统的大小调整为最大可用大小。如果这不是您想要的,请参阅相应命令的手册页。
所有这些命令都可以在线执行。它们不需要卸载文件系统。
答案2
不幸的是,没有逻辑卷,我发现的唯一过程需要卸载驱动器。我还发现,如果不删除现有信息,就无法将现有驱动器转换为逻辑卷。目前,我将按照以下说明操作红帽获得卸载驱动器的窗口后。
我还将更新配置过程,以便我也将逻辑卷用于附加驱动器。在实时服务器上扩展驱动器的好处太重要了,不能不使用它。