![如何增加精简配置虚拟机的硬盘空间?](https://linux22.com/image/227661/%E5%A6%82%E4%BD%95%E5%A2%9E%E5%8A%A0%E7%B2%BE%E7%AE%80%E9%85%8D%E7%BD%AE%E8%99%9A%E6%8B%9F%E6%9C%BA%E7%9A%84%E7%A1%AC%E7%9B%98%E7%A9%BA%E9%97%B4%EF%BC%9F.png)
创建具有 100 GB 硬盘的精简配置虚拟机 (Suse Linux)。现在由于空间要求,我需要将大小增加到200GB。有人可以告诉我如何增加“/”目录的空间吗?
Below is the output of the df -h command.
Filesystem Size Used Avail Use% Mounted on
devtmpfs 4.0M 0 4.0M 0% /dev
tmpfs 12G 8.0K 12G 1% /dev/shm
tmpfs 4.7G 18M 4.7G 1% /run
tmpfs 4.0M 0 4.0M 0% /sys/fs/cgroup
/dev/sda3 92G 53G 40G 57% /
/dev/sda1 511M 4.9M 507M 1% /boot/efi
tmpfs 2.4G 56K 2.4G 1% /run/user/467
tmpfs 2.4G 40K 2.4G 1% /run/user/465
tmpfs 2.4G 44K 2.4G 1% /run/user/1000
tmpfs 2.4G 40K 2.4G 1% /run/user/0
Below is the output of the fdisk -l command.
GPT PMBR size mismatch (209715199 != 419430399) will be corrected by write.
Disk /dev/sda: 200 GiB, 214748364800 bytes, 419430400 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: gpt
Disk identifier: 055ED88C-4E22-4F03-9C7F-4E4CCADBF54C
Device Start End Sectors Size Type
/dev/sda1 2048 1050623 1048576 512M EFI System
/dev/sda2 193429504 209715166 16285663 7.8G Linux swap
/dev/sda3 1050624 193429503 192378880 91.7G Linux filesystem
Partition table entries are not in disk order.
我尝试使用以下命令修复分区并更正 GPT PMBR 大小不匹配并重新启动。系统重新启动正常。
Enter into the disk partition place:
fdisk /dev/sda
Command (m for help): m
Command action
...
l list known partition types
m print this menu
p print the partition table
q quit without saving changes
w write table to disk and exit
x extra functionality (experts only)
Command (m for help): x
Expert command (m for help): m
Command action
...
f fix partition order
m print this menu
p print the partition table
q quit without saving changes
r return to main menu
v verify the partition table
w write table to disk and exit
Expert command (m for help): f
Done.
Expert command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
Syncing disks.
我关闭SWAP并删除SWAP分区。然后我删除了“/”分区并重新创建了它,其预期大小为190G。
Commands used:
swapoff -a
fdisk /dev/sda
由于“/”仍然显示旧的大小,我运行命令 xfs_growfs -d /。分区的大小按预期增加。现在的问题是我的系统无法在正常模式下启动(仅停留在 4 个点和蜥蜴标志上),而我可以启动到恢复模式。
我错过了什么吗?