我有一个虚拟专用服务器,刚刚升级了硬盘空间,但无法扩展我的驱动器,至少我不知道如何扩展。
root@localhost:~# xfs_growfs /
xfs_growfs: / is not a mounted XFS filesystem
硬件
*-scsi:0
physical id: 87
logical name: scsi2
*-disk
description: SCSI Disk
product: Virtual disk
vendor: VMware
physical id: 0.0.0
bus info: scsi@2:0.0.0
logical name: /dev/sda
version: 2.0
serial: 6000c29d6dd9f71e6d153468cd60d2fb
size: 160GiB (171GB)
capabilities: partitioned partitioned:dos
configuration: ansiversion=6 logicalsectorsize=512 sectorsize=512 signature=520f1760
*-volume:0
description: EXT4 volume
vendor: Linux
physical id: 1
bus info: scsi@2:0.0.0,1
logical name: /dev/sda1
logical name: /boot
version: 1.0
serial: de2cb53e-6086-4fd5-99a9-1c22674a4f91
size: 487MiB
capacity: 487MiB
capabilities: primary bootable journaled extended_attributes large_files huge_files dir_nlink 64bit extents ext4 ext2 initialized
configuration: created=2021-05-20 11:12:55 filesystem=ext4 lastmountpoint=/boot modified=2022-01-05 19:12:46 mount.fstype=ext4 mount.options=rw,relatime mounted=2022-01-05 18:58:01 state=mounted
*-volume:1
description: Linux LVM Physical Volume partition
physical id: 2
bus info: scsi@2:0.0.0,2
logical name: /dev/sda2
serial: R5VWXg-jamB-5dWM-PpwY-7a49-LRz7-Vrvdl2
size: 9751MiB
capacity: 79GiB
capabilities: primary multi lvm2
root@localhost:~# fdisk -l
Disk /dev/sda: 160 GiB, 171798691840 bytes, 335544320 sectors
Disk model: Virtual disk
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x520f1760
Device Boot Start End Sectors Size Id Type
/dev/sda1 * 2048 999423 997376 487M 83 Linux
/dev/sda2 999424 335544286 334544863 159.5G 8e Linux LVM
Disk /dev/mapper/vg00-lv00: 1.93 GiB, 2046820352 bytes, 3997696 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/vg00-lv01: 77.63 GiB, 83336626176 bytes, 162766848 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
令我困惑的是,这里说它确实有 160gb,/dev/sda2 999424 335544286 334544863 159.5G 8e Linux LVM
但是当我检查时却不在那里:
root@localhost:~# df -h
Filesystem Size Used Avail Use% Mounted on
udev 3.9G 0 3.9G 0% /dev
tmpfs 794M 1.2M 793M 1% /run
/dev/mapper/vg00-lv01 77G 31G 43G 43% /
tmpfs 3.9G 16K 3.9G 1% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 3.9G 0 3.9G 0% /sys/fs/cgroup
/dev/sda1 456M 145M 278M 35% /boot
tmpfs 794M 0 794M 0% /run/user/0
我想知道是否需要重新启动服务器?
答案1
分区类型为逻辑卷管理器这意味着您的根分区是逻辑卷 (LV)。逻辑卷属于由一个或多个物理卷 (PV) 组成的卷组 (VG)。尝试以下操作:
vgdisplay -v
# Note the following values:
# PV Name, e. g. '/dev/vda3' (physical volume)
# LV Path, e. g. '/dev/ubuntu-vg/ubuntu-lv' (logical volume)
growpart <DISK> <PARTITION_NUMBER> # e.g. 'growpart /dev/vda 3'
pvresize <PV_NAME> # Resize the physical volume
lvresize <LV_NAME> -l 100%VG # Logical Volume should get the whole space of the Volume Group
resize2fs <LV_NAME> # Resize the file system (e. g. ext4)