扫二维码与我们在线沟通
我们在微信上24小时期待你的声音
建站咨询/业务/维护/网店托管/关键词排名
运行yum install
命令安装工具,示例如下。
yum install cloud-utils-growpart
yum install xfsprogs
运行apt install
命令安装工具,示例如下。
apt install cloud-guest-utils
apt install xfsprogs
请使用上游版本(upstream)的growpart或者xfsprogs工具
本节以Alibaba Cloud Linux 2.1903 LTS 64位操作系统为例,说明扩展分区和文件系统的步骤。
fdisk -l
命令查看现有云盘大小。
[root@ecshost ~]# fdisk -l Disk /dev/vda: 107.4 GB, 107374182400 bytes, 209715200 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 label type: dos Disk identifier: 0x000bad2b Device Boot Start End Blocks Id System /dev/vda1 * 2048 83886046 41941999+ 83 Linux
df -Th
命令查看云盘分区大小和文件系统类型。
[root@ecshost ~]# df -Th Filesystem Type Size Used Avail Use% Mounted on devtmpfs devtmpfs 869M 0 869M 0% /dev tmpfs tmpfs 879M 0 879M 0% /dev/shm tmpfs tmpfs 879M 460K 878M 1% /run tmpfs tmpfs 879M 0 879M 0% /sys/fs/cgroup /dev/vda1 ext4 40G 1.8G 36G 5% / tmpfs tmpfs 176M 0 176M 0% /run/user/0
growpart
命令扩容分区。
[root@ecshost ~]# growpart /dev/vda 1 CHANGED: partition=1 start=2048 old: size=83883999 end=83886047 new: size=209713119 end=209715167
LANG=en_US.UTF-8
命令切换ECS实例的字符编码类型。
[root@ecshost ~]# growpart /dev/vda 1 unexpected output in sfdisk --version [sfdisk,来自 util-linux 2.23.2] [root@ecshost ~]# LANG=en_US.UTF-8
运行命令切换字符编码后,建议您使用reboot
命令重启ECS实例。
LANG=en_US.UTF-8
命令后重启实例仍无法解决问题,您可以尝试运行localectl set-locale LANG=en_US.UTF-8
命令修改本地化环境变量,然后重启实例。resize2fs
命令。
[root@ecshost ~]# resize2fs /dev/vda1 resize2fs 1.42.9 (28-Dec-2013) Filesystem at /dev/vda1 is mounted on /; on-line resizing required old_desc_blocks = 3, new_desc_blocks = 7 The filesystem on /dev/vda1 is now 26214139 blocks long.
xfs_growfs
命令。
示例命令表示为扩容系统盘的/dev/vda1分区的文件系统。其中根目录(/)为/dev/vda1的挂载点。
[root@ecshost ~]# xfs_growfs /
meta-data=/dev/vda1 isize=512 agcount=13, agsize=1310656 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=1, sparse=1, rmapbt=0
= reflink=1
data = bsize=4096 blocks=15728379, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0, ftype=1
log =internal log bsize=4096 blocks=2560, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
data blocks changed from 15728379 to 20971259
xfs_growfs --help
查看对应的命令。df -h
命令查看云盘分区大小。
[root@ecshost ~]# df -h Filesystem Size Used Avail Use% Mounted on devtmpfs 869M 0 869M 0% /dev tmpfs 879M 0 879M 0% /dev/shm tmpfs 879M 492K 878M 1% /run tmpfs 879M 0 879M 0% /sys/fs/cgroup /dev/vda1 99G 1.8G 93G 2% / tmpfs 176M 0 176M 0% /run/user/0
本节以CentOS 6操作系统为例,说明扩展分区和文件系统的步骤。
[root@ecshost ~]# yum install -y dracut-modules-growroot
[root@ecshost ~]# dracut -f
fdisk -l
命令查看现有云盘大小。
[root@ecshost ~]# fdisk -l Disk /dev/vda: 107.4 GB, 107374182400 bytes 255 heads, 63 sectors/track, 13054 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x0003a7b4 Device Boot Start End Blocks Id System /dev/vda1 * 1 2611 20970496 83 Linux
df -Th
命令查看云盘分区大小和文件系统类型。
[root@ecshost ~]# df -h Filesystem Type Size Used Avail Use% Mounted on /dev/vda1 ext4 20G 1.1G 18G 6% / tmpfs tmpfs 7.8G 0 7.8G 0% /dev/shm
growpart
命令扩容分区。
[root@ecshost ~]# growpart /dev/vda 1 CHANGED: partition=1 start=2048 old: size=41940992 end=41943040 new: size=209710462,end=209712510
resize2fs
命令。
[root@ecshost ~]# resize2fs /dev/vda1 resize2fs 1.41.12 (17-May-2010) Filesystem at /dev/vda1 is mounted on /; on-line resizing required old desc_blocks = 2, new_desc_blocks = 7 Performing an on-line resize of /dev/vda1 to 26213807 (4k) blocks. The filesystem on /dev/vda1 is now 26213807 blocks long.
xfs_growfs
命令。
示例命令表示为扩容系统盘的/dev/vda1分区的文件系统。其中根目录(/)为/dev/vda1的挂载点。
[root@ecshost ~]# xfs_growfs /
xfs_growfs --help
查看对应的命令。df -h
命令查看云盘分区大小。
[root@ecshost ~]# df -h Filesystem Size Used Avail Use% Mounted on /dev/vda1 99G 1.1G 93G 2% / tmpfs 7.8G 0 7.8G 0% /dev/shm
我们在微信上24小时期待你的声音
建站咨询/业务/维护/网店托管/关键词排名
Copyright © 2011-2022 正规beat365体育官网 浙ICP备11009044号-3
微信二维码
移动版官网