ubuntu20.04扩容

ubuntu20.04对系统盘进行扩容

先去阿里云后台购买扩容,然后在服务器执行扩容

参考官方指导

获取目标云盘信息

fdisk -lu
Disk /dev/vda: 50 GiB, 53687091200 bytes, 104857600 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
Disklabel type: dos
Disk identifier: 0xdb0fcc2c

Device     Boot Start      End  Sectors Size Id Type
/dev/vda1  *     2048 83886046 83883999  40G 83 Linux

云盘的分区类型。

Disk label type值为dos表示MBR分区,值为gpt表示GPT分区

扩容分区

apt-get update
type growpart || apt-get install -y cloud-guest-utils
LC_ALL=en_US.UTF-8 growpart /dev/vda 1
root@iZbp1eni093w4gvdjfjowoZ:/var# LC_ALL=en_US.UTF-8 growpart /dev/vda 1
CHANGED: partition=1 start=2048 old: size=83883999 end=83886047 new: size=104855519 end=104857567

扩容文件系统

resize2fs /dev/vda1

root@iZbp1eni093w4gvdjfjowoZ:/var# resize2fs /dev/vda1
resize2fs 1.45.5 (07-Jan-2020)
Filesystem at /dev/vda1 is mounted on /; on-line resizing required
old_desc_blocks = 3, new_desc_blocks = 4
The filesystem on /dev/vda1 is now 13106939 (4k) blocks long.
root@iZbp1eni093w4gvdjfjowoZ:/var# df -Th
Filesystem     Type      Size  Used Avail Use% Mounted on
udev           devtmpfs  1.9G     0  1.9G   0% /dev
tmpfs          tmpfs     380M  768K  379M   1% /run
/dev/vda1      ext4       50G   37G   11G  77% /
tmpfs          tmpfs     1.9G     0  1.9G   0% /dev/shm
tmpfs          tmpfs     5.0M     0  5.0M   0% /run/lock
tmpfs          tmpfs     1.9G     0  1.9G   0% /sys/fs/cgroup
tmpfs          tmpfs     380M     0  380M   0% /run/user/0

扩容成功

你可能感兴趣的:(架构之路,数据库,linux,运维)