磁盘上的空闲 space 不可用
Free space on disk is not available
我像往常一样使用 parted 来扩展我的磁盘,它似乎成功地显示了新的 140GB 磁盘。
Model: VMware Virtual disk (scsi) Disk /dev/sda: 140GB Sector size (logical/physical): 512B/512B Partition Table: msdos Disk Flags:
Number Start End Size Type File system Flags 1 1049kB 1075MB 1074MB primary xfs boot 2 1075MB 140GB 139GB primary lvm
(parted)
当我 运行 pvresize 它说它是成功的并且 pvdisplay 显示:
# pvdisplay --- Physical volume ---
PV Name /dev/sda2
VG Name rhel
PV Size <129.00 GiB / not usable 2.00 MiB
Allocatable yes (but full)
PE Size 4.00 MiB
Total PE 33023
Free PE 0
Allocated PE 33023
PV UUID Rqtlv3-Hjdi-0DR6-I0Qs-gysl-SBSL-HdoW7s
所以我看到物理卷确实扩展了它的大小。我 运行 lvextend 然后检查它显示的逻辑卷:
--- Logical volume ---
LV Path /dev/rhel/swap
LV Name swap
VG Name rhel
LV UUID HeW74s-F3v8-ca4a-qZlN-12vO-ID2L-tpQCZk
LV Write Access read/write
LV Creation host, time localhost, 2019-04-09 12:07:26 -0400
LV Status available
# open 2
LV Size <3.88 GiB
Current LE 992
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 253:1
--- Logical volume ---
LV Path /dev/rhel/home
LV Name home
VG Name rhel
LV UUID 03H6z4-RMWH-RYRV-5v9T-i8Vl-SVPG-z5CaU7
LV Write Access read/write
LV Creation host, time localhost, 2019-04-09 12:07:27 -0400
LV Status available
# open 1
LV Size <25.12 GiB
Current LE 6430
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 253:2
--- Logical volume ---
LV Path /dev/rhel/root
LV Name root
VG Name rhel
LV UUID QlDfBH-tFRS-sIPk-d169-mTRV-FgXe-LkCdBC
LV Write Access read/write
LV Creation host, time localhost, 2019-04-09 12:07:27 -0400
LV Status available
# open 1
LV Size 100.00 GiB
Current LE 25601
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 253:0
我运行vgdisplay确认:
# vgdisplay
--- Volume group ---
VG Name rhel
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 21
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 <129.00 GiB
PE Size 4.00 MiB
Total PE 33023
Alloc PE / Size 33023 / <129.00 GiB
Free PE / Size 0 / 0
VG UUID XmxEl2-K8LQ-3095-V2Z1-quSv-vDx4-QXonOU
所有大小都显示 129.00GB 为什么当我 运行 df -h 我收到:
# df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 1.9G 0 1.9G 0% /dev
tmpfs 1.9G 0 1.9G 0% /dev/shm
tmpfs 1.9G 8.9M 1.9G 1% /run
tmpfs 1.9G 0 1.9G 0% /sys/fs/cgroup
/dev/mapper/rhel-root 50G 45G 5.5G 90% /
/dev/sda1 1014M 191M 824M 19% /boot
/dev/mapper/rhel-home 26G 7.2G 18G 29% /home
tmpfs 379M 0 379M 0% /run/user/1004
tmpfs 379M 0 379M 0% /run/user/0
我运行 lvextend 扩展rhel/root 它仍然显示50G。我还注意到免费的space中的none其实是可以用的。我所做的与我通常扩展磁盘并增加 lv 上的 space 没有什么不同。我重新尝试了这个,结果相同。我不能把磁盘吹走,因为这里有文件。有什么我想念的吗?
您需要调整 FS 大小。对于分机:
resize2fs /dev/mapper/rhel-root
对于 xfs
xfs_growfs /
或
xfs_growfs /dev/mapper/rhel-root
扩展分区后
我像往常一样使用 parted 来扩展我的磁盘,它似乎成功地显示了新的 140GB 磁盘。
Model: VMware Virtual disk (scsi) Disk /dev/sda: 140GB Sector size (logical/physical): 512B/512B Partition Table: msdos Disk Flags:
Number Start End Size Type File system Flags 1 1049kB 1075MB 1074MB primary xfs boot 2 1075MB 140GB 139GB primary lvm
(parted)
当我 运行 pvresize 它说它是成功的并且 pvdisplay 显示:
# pvdisplay --- Physical volume ---
PV Name /dev/sda2
VG Name rhel
PV Size <129.00 GiB / not usable 2.00 MiB
Allocatable yes (but full)
PE Size 4.00 MiB
Total PE 33023
Free PE 0
Allocated PE 33023
PV UUID Rqtlv3-Hjdi-0DR6-I0Qs-gysl-SBSL-HdoW7s
所以我看到物理卷确实扩展了它的大小。我 运行 lvextend 然后检查它显示的逻辑卷:
--- Logical volume ---
LV Path /dev/rhel/swap
LV Name swap
VG Name rhel
LV UUID HeW74s-F3v8-ca4a-qZlN-12vO-ID2L-tpQCZk
LV Write Access read/write
LV Creation host, time localhost, 2019-04-09 12:07:26 -0400
LV Status available
# open 2
LV Size <3.88 GiB
Current LE 992
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 253:1
--- Logical volume ---
LV Path /dev/rhel/home
LV Name home
VG Name rhel
LV UUID 03H6z4-RMWH-RYRV-5v9T-i8Vl-SVPG-z5CaU7
LV Write Access read/write
LV Creation host, time localhost, 2019-04-09 12:07:27 -0400
LV Status available
# open 1
LV Size <25.12 GiB
Current LE 6430
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 253:2
--- Logical volume ---
LV Path /dev/rhel/root
LV Name root
VG Name rhel
LV UUID QlDfBH-tFRS-sIPk-d169-mTRV-FgXe-LkCdBC
LV Write Access read/write
LV Creation host, time localhost, 2019-04-09 12:07:27 -0400
LV Status available
# open 1
LV Size 100.00 GiB
Current LE 25601
Segments 1
Allocation inherit
Read ahead sectors auto
- currently set to 8192
Block device 253:0
我运行vgdisplay确认:
# vgdisplay
--- Volume group ---
VG Name rhel
System ID
Format lvm2
Metadata Areas 1
Metadata Sequence No 21
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 <129.00 GiB
PE Size 4.00 MiB
Total PE 33023
Alloc PE / Size 33023 / <129.00 GiB
Free PE / Size 0 / 0
VG UUID XmxEl2-K8LQ-3095-V2Z1-quSv-vDx4-QXonOU
所有大小都显示 129.00GB 为什么当我 运行 df -h 我收到:
# df -h
Filesystem Size Used Avail Use% Mounted on
devtmpfs 1.9G 0 1.9G 0% /dev
tmpfs 1.9G 0 1.9G 0% /dev/shm
tmpfs 1.9G 8.9M 1.9G 1% /run
tmpfs 1.9G 0 1.9G 0% /sys/fs/cgroup
/dev/mapper/rhel-root 50G 45G 5.5G 90% /
/dev/sda1 1014M 191M 824M 19% /boot
/dev/mapper/rhel-home 26G 7.2G 18G 29% /home
tmpfs 379M 0 379M 0% /run/user/1004
tmpfs 379M 0 379M 0% /run/user/0
我运行 lvextend 扩展rhel/root 它仍然显示50G。我还注意到免费的space中的none其实是可以用的。我所做的与我通常扩展磁盘并增加 lv 上的 space 没有什么不同。我重新尝试了这个,结果相同。我不能把磁盘吹走,因为这里有文件。有什么我想念的吗?
您需要调整 FS 大小。对于分机:
resize2fs /dev/mapper/rhel-root
对于 xfs
xfs_growfs /
或
xfs_growfs /dev/mapper/rhel-root
扩展分区后