我有 25 个以上的 VM 运行 OL7.5。随着它们的增长/重新调整用途,我有时需要为它们添加更多硬盘。
我之前已经多次为 ol-root 和 ol-swap 添加空间,如下[总结]:
fdisk to create partition
partprobe -s
pvcreate /dev/sdb1
vgextend ol /dev/sdb1
pvscan
lvextend /dev/mapper/ol-root /dev/sdb1
Run Code Online (Sandbox Code Playgroud)
但是在某些 VM 上,我无法再将 ol-root 空间添加到文件系统中:
xfs_growfs /dev/mapper/ol-root
Error: xfs_growfs: /dev/mapper/ol-root is not a mounted XFS filesystem
Run Code Online (Sandbox Code Playgroud)
我之前已经做过很多次了,在同一个虚拟机上没有问题。在这个虚拟机上,我从头开始构建并添加了 sda3 和 sda4。
在这个特定的盒子上,我需要将 11g 升级到 18c。我需要 10G ol-swap 和更多硬盘来安装 18c 数据库。
$ lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sr0 11:0 1 1024M 0 rom
sda 8:0 0 55G 0 disk
??sda4 8:4 0 10G 0 part
? ??ol-root 252:0 0 46G 0 lvm /
??sda2 8:2 0 15G 0 part
? ??ol-swap 252:1 0 8G 0 lvm [SWAP]
? ??ol-root 252:0 0 46G 0 lvm /
??sda3 8:3 0 29G 0 part
? ??ol-swap 252:1 0 8G 0 lvm [SWAP]
? ??ol-root 252:0 0 46G 0 lvm /
??sda1 8:1 0 1G 0 part /boot
$ df -Th /dev/mapper/ol-root
Filesystem Type Size Used Avail Use% Mounted on
/dev/mapper/ol-root xfs 46G 45G 1.5G 97% /
Run Code Online (Sandbox Code Playgroud)
请问有什么建议吗?
非常感谢
达伦
ps 我试图扩展的盒子是上面虚拟机的克隆。在多次尝试扩大文件系统后,我杀死了这个盒子。即使我不添加 sdb 分区,源框也与 xfs_growfs 共享相同的问题。当没有空间分配时,xfs_growfs 应该返回一个非常不同的错误。
小智 8
对于 xfs_growfs 命令,您需要针对挂载点而不是 LVM 映射器。这似乎是一个新的“功能”,因为我们曾经能够在映射器上使用 xfs_growfs。
但是手册页专门提到了挂载点:
xfs_growfs(8) 系统管理员手册 xfs_growfs(8)
NAME xfs_growfs, xfs_info - 扩展一个 XFS 文件系统
概要 xfs_growfs [ -dilnrx ] [ -D size ] [ -e rtextsize ] [ -L size ] [ -m maxpct ] [ -t mtab ] [ -R size ]挂载点
好的,这样做 -L 和 xxfs_growfs 已经起作用了。VM 有 ol-root 6GB 可用空间
实际虚拟机的代码,分步:向 vSphere 中的新 HDD 添加 16GB
# fdisk -l
Disk /dev/sda: 59.1 GB, 59055800320 bytes, 115343360 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: 0x000cbfb1
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 2099199 1048576 83 Linux
/dev/sda2 2099200 33554431 15727616 8e Linux LVM
/dev/sda3 33554432 94371839 30408704 8e Linux LVM
/dev/sda4 94371840 115343359 10485760 8e Linux LVM
Disk /dev/sdb: 17.2 GB, 17179869184 bytes, 33554432 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/ol-root: 49.4 GB, 49379540992 bytes, 96444416 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/ol-swap: 8589 MB, 8589934592 bytes, 16777216 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
# ls /sys/class/scsi_device
1:0:0:0 2:0:0:0 2:0:1:0
# echo 1 > /sys/class/scsi_device/1\:0\:0\:0/device/rescan
# echo 1 > /sys/class/scsi_device/2\:0\:0\:0/device/rescan
# echo 1 > /sys/class/scsi_device/2\:0\:1\:0/device/rescan
Run Code Online (Sandbox Code Playgroud)
fdisk /dev/sdb, n, p, 1, t, 1, 8e, w
# fdisk -l
Disk /dev/sda: 59.1 GB, 59055800320 bytes, 115343360 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: 0x000cbfb1
Device Boot Start End Blocks Id System
/dev/sda1 * 2048 2099199 1048576 83 Linux
/dev/sda2 2099200 33554431 15727616 8e Linux LVM
/dev/sda3 33554432 94371839 30408704 8e Linux LVM
/dev/sda4 94371840 115343359 10485760 8e Linux LVM
Disk /dev/sdb: 17.2 GB, 17179869184 bytes, 33554432 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: 0x86979f60
Device Boot Start End Blocks Id System
/dev/sdb1 2048 33554431 16776192 8e Linux LVM
Disk /dev/mapper/ol-root: 49.4 GB, 49379540992 bytes, 96444416 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/ol-swap: 8589 MB, 8589934592 bytes, 16777216 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
Run Code Online (Sandbox Code Playgroud)
部分探针
# partprobe -s
/dev/sda: msdos partitions 1 2 3 4
/dev/sdb: msdos partitions 1
Run Code Online (Sandbox Code Playgroud)
光伏发电
# pvcreate /dev/sdb1
Physical volume "/dev/sdb1" successfully created.
Run Code Online (Sandbox Code Playgroud)
VG扩展
# vgextend ol /dev/sdb1
Volume group "ol" successfully extended
Run Code Online (Sandbox Code Playgroud)
光伏扫描
# pvscan
PV /dev/sda2 VG ol lvm2 [<15.00 GiB / 0 free]
PV /dev/sda3 VG ol lvm2 [<29.00 GiB / 0 free]
PV /dev/sda4 VG ol lvm2 [<10.00 GiB / 0 free]
PV /dev/sdb1 VG ol lvm2 [<16.00 GiB / <16.00 GiB free]
Total: 4 [69.98 GiB] / in use: 4 [69.98 GiB] / in no VG: 0 [0 ]
Run Code Online (Sandbox Code Playgroud)
延伸
# lvextend -L+16380M /dev/mapper/ol-root /dev/sdb1
Size of logical volume ol/root changed from <45.99 GiB (11773 extents) to 61.98 GiB (15868 extents).
Logical volume ol/root successfully resized.
Run Code Online (Sandbox Code Playgroud)
xfs_growfs
# xfs_growfs /
meta-data=/dev/mapper/ol-root isize=256 agcount=14, agsize=877824 blks
= sectsz=512 attr=2, projid32bit=1
= crc=0 finobt=0 spinodes=0 rmapbt=0
= reflink=0
data = bsize=4096 blocks=12055552, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=1
log =internal bsize=4096 blocks=2560, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
data blocks changed from 12055552 to 16248832
# df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 4.8G 0 4.8G 0% /dev
tmpfs 4.8G 0 4.8G 0% /dev/shm
tmpfs 4.8G 9.4M 4.8G 1% /run
tmpfs 4.8G 0 4.8G 0% /sys/fs/cgroup
/dev/mapper/ol-root 62G 42G 21G 68% /
/dev/sda1 1014M 419M 596M 42% /boot
tmpfs 973M 12K 973M 1% /run/user/42
tmpfs 973M 0 973M 0% /run/user/0
Run Code Online (Sandbox Code Playgroud)
我遵循这个: https: //ma.ttias.be/increase-expand-xfs-filesystem-in-red-hat-rhel-7-cento7/
为什么以前可以,但现在不行?
| 归档时间: |
|
| 查看次数: |
31104 次 |
| 最近记录: |