在 Google Cloud Compute Engine 上调整 Linux 持久磁盘(MBR 分区)的大小

在 Google Cloud Compute Engine 上调整 Linux 持久磁盘(MBR 分区)的大小

我想扩展我的 Google Cloud 机器的磁盘容量,并一直在遵循位于的教程这里

但是,我相当确定本教程假设用户有 GPT 分区表,但我有 MBR。我只需要 20GB,所以这应该不是问题。

无论如何,我按照教程进行到步骤 4a,一切似乎都执行得很好,包括与命令相关的所有内容sudo parted /dev/sda

但是,当我到达步骤 4b 并提示您运行时sudo sgdisk --move-second-header /dev/sda,我收到以下消息:

Warning: Partition table header claims that the size of partition table

entries is 1119092736 bytes, but this program supports only 128-byte entries.

Adjusting accordingly, but partition table may be garbage.

Warning: Partition table header claims that the size of partition table

entries is 0 bytes, but this program supports only 128-byte entries.

Adjusting accordingly, but partition table may be garbage.


***************************************************************

Found invalid GPT and valid MBR; converting MBR to GPT format

in memory.

***************************************************************



Warning! Secondary partition table overlaps the last partition by

33 blocks!

You will need to delete this partition or resize it in another utility.

Non-GPT disk; not saving changes. Use -g to override.

我不知道下一步该做什么。目前,我有 20GB 可用,但我的 sda1 显示只有 10GB。

如果有帮助的话,这里是输出sudo df -Th

Filesystem     Type      Size  Used Avail Use% Mounted on
udev           devtmpfs  976M     0  976M   0% /dev
tmpfs          tmpfs     199M  716K  198M   1% /run
/dev/sda1      ext4      9.8G  8.6G  720M  93% /
tmpfs          tmpfs     992M     0  992M   0% /dev/shm
tmpfs          tmpfs     5.0M     0  5.0M   0% /run/lock
/dev/loop5     squashfs   62M   62M     0 100% /snap/core20/1611
/dev/loop2     squashfs   45M   45M     0 100% /snap/certbot/2344
/dev/loop6     squashfs   64M   64M     0 100% /snap/core20/1623
/dev/loop4     squashfs  115M  115M     0 100% /snap/core/13741
/dev/loop1     squashfs  115M  115M     0 100% /snap/core/13886
/dev/loop0     squashfs   45M   45M     0 100% /snap/certbot/2414
tmpfs          tmpfs     199M  4.0K  199M   1% /run/user/1000

输出如下sudo lsblk

NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
loop0    7:0    0  44.7M  1 loop /snap/certbot/2414
loop1    7:1    0   115M  1 loop /snap/core/13886
loop2    7:2    0  44.5M  1 loop /snap/certbot/2344
loop4    7:4    0 114.9M  1 loop /snap/core/13741
loop5    7:5    0    62M  1 loop /snap/core20/1611
loop6    7:6    0  63.2M  1 loop /snap/core20/1623
sda      8:0    0    20G  0 disk 
└─sda1   8:1    0    20G  0 part /

答案1

运行该命令sudo resize2fs /dev/sda1并跳过sudo sgdisk --move-second-header /dev/sda,因为剩余空间已被识别lsblk

相关内容