Alibaba Cloud

Alibaba Cloud ECSのディスクを追加してみよう

はじめに

Alibab CloudのみならずIaaSのディスクを増やす機会はあります。

ECSコンソールでのディスクのサイズ変更 - Elastic Compute Service - Alibaba Cloud ドキュメントセンター
ECSコンソールでのディスクのサイズ変更 - Elastic Compute Service - Alibaba Cloud ドキュメントセンター

ECSコンソールでのディスクのサイズ変更,Elastic Compute Service:システムディスクまたはデータディスクに十分な容量がない場合、Elastic Compute Service ( ...

www.alibabacloud.com

少々ドキュメントが古いので新しいコマンドを確認しながら見ていきたいと思います。

ディスクの追加

aliyun linux ECSではディスクをオンラインで追加することができます。つまりサービスの停止なしに追加することができます。

ディスクリストからディスクの追加を行います。

作成時にアタッチするように設定します。

アタッチするECSを選択しています。サイズを指定し、IOPSを必要としない場合は、パフォーマンスレベルをPL0で設定します。

利用規約にもチェックを入れます。

任意で名前を指定してリソースグループを設定します。

作成します。

以上で作成されたことを確認します。右側でも確認できます。

fdiskでも確認できます。

ディスクの設定をしていきます。

[root@iZ6we0hg3on73w1vvdsj32Z ~]# fdisk /dev/vdb

Welcome to fdisk (util-linux 2.32.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Device does not contain a recognized partition table.
Created a new DOS disklabel with disk identifier 0x632de0d9.

Command (m for help): n
Partition type
   p   primary (0 primary, 0 extended, 4 free)
   e   extended (container for logical partitions)
Select (default p): p
Partition number (1-4, default 1): 1
First sector (2048-83886079, default 2048): 2048
Last sector, +sectors or +size{K,M,G,T,P} (2048-83886079, default 83886079): 83886079

Created a new partition 1 of type 'Linux' and of size 40 GiB.

Command (m for help): wq
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.

 

ディスクをext4でフォーマットしていきます。ドキュメントではext3になっていますが古いですね。

[root@iZ6we0hg3on73w1vvdsj32Z ~]# mkfs.ext4 /dev/vdb1
mke2fs 1.45.6 (20-Mar-2020)
Creating filesystem with 10485504 4k blocks and 2621440 inodes
Filesystem UUID: 70cc63df-4603-4b2b-a692-d3ec404656f0
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
        4096000, 7962624

Allocating group tables: done
Writing inode tables: done
Creating journal (65536 blocks): done
Writing superblocks and filesystem accounting information: done
[root@iZ6we0hg3on73w1vvdsj32Z ~]# mkdir /disk2
[root@iZ6we0hg3on73w1vvdsj32Z ~]# mount /dev/vdb1 /disk2/

マウントされていますね。

[root@iZ6we0hg3on73w1vvdsj32Z ~]# df
Filesystem     1K-blocks    Used Available Use% Mounted on
devtmpfs         3877104       0   3877104   0% /dev
tmpfs            3895448       0   3895448   0% /dev/shm
tmpfs            3895448     440   3895008   1% /run
tmpfs            3895448       0   3895448   0% /sys/fs/cgroup
/dev/vda1       41103804 3057044  36143052   8% /
tmpfs             779088       0    779088   0% /run/user/0
/dev/vdb1       40972512      24  38859004   1% /disk2

fstabにも設定しておきます。

#
# /etc/fstab
# Created by anaconda on Wed Sep  7 02:53:10 2022
#
# Accessible filesystems, by reference, are maintained under '/dev/disk/'.
# See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info.
#
# After editing this file, run 'systemctl daemon-reload' to update systemd
# units generated from this file.
#
UUID=94a557cd-441e-4dee-b12b-f9274230a1f5 /                       ext4    defaults        1 1
UUID=70cc63df-4603-4b2b-a692-d3ec404656f0 /disk2                  ext4    defaults        1 1

 

まとめ

ディスクの拡張はオンラインで出来ます。基本的にLinux で共通のディスク拡張方法です。

-Alibaba Cloud
-