我正在尝试将 Google Cloud 上的磁盘大小从 1TB 调整为 2TB。我按照指示调整了谷歌控制台中的磁盘空间大小:
df -h
Filesystem Size Used Avail Use% Mounted on
overlay 95G 7.1G 88G 8% /
tmpfs 16G 0 16G 0% /dev
tmpfs 16G 0 16G 0% /sys/fs/cgroup
/dev/sda1 95G 7.1G 88G 8% /etc/hosts
shm 64M 0 64M 0% /dev/shm
/dev/sdg 984G 381G 554G 41% /var/lib/data
tmpfs 16G 12K 16G 1% /run/secrets/kubernetes.io/serviceaccount
tmpfs 16G 0 16G 0% /sys/firmware
和:
lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 100G 0 disk
|-sda1 8:1 0 95.9G 0 part /etc/hosts
|-sda2 8:2 0 16M 0 part
|-sda3 8:3 0 2G 0 part
|-sda4 8:4 0 16M 0 part
|-sda5 8:5 0 2G 0 part
|-sda6 8:6 0 512B 0 part
|-sda7 8:7 0 512B 0 part
|-sda8 8:8 0 16M 0 part
|-sda9 8:9 0 512B 0 part
|-sda10 8:10 0 512B 0 part
|-sda11 8:11 0 8M 0 part
`-sda12 8:12 0 32M 0 part
sdb 8:16 0 2G 0 disk
sdc 8:32 0 8G 0 disk
sdd 8:48 0 10G 0 disk
sde 8:64 0 1000G 0 disk
sdf 8:80 0 10G 0 disk
sdg 8:96 0 2T 0 disk /var/lib/data
现在我尝试使用 resize2fs 来调整大小并得到:
resize2fs /dev/sdg
resize2fs 1.42.12 (29-Aug-2014)
open: No such file or directory while opening /dev/sdg
答案1
如果您尝试从容器内部执行此操作,您将收到相同的错误,并且目录/dev/
将不会显示虚拟设备。
在这种情况下,登录主机节点 [ec2/compute/??] 并执行resize2fs