0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

AWS EC2インスタンスのボリューム拡張

Last updated at Posted at 2023-03-19

EC2インスタンスのボリューム拡張

最初のボリューム確認

$ df -h
Filesystem      Size  Used Avail Use% Mounted on
overlay         8.0G  6.9G  1.2G  86% /
tmpfs            64M     0   64M   0% /dev
tmpfs           483M     0  483M   0% /sys/fs/cgroup
shm              64M     0   64M   0% /dev/shm
/dev/xvda1      8.0G  6.9G  1.2G  86% /etc/hosts
tmpfs           483M     0  483M   0% /proc/acpi
tmpfs           483M     0  483M   0% /proc/scsi
tmpfs           483M     0  483M   0% /sys/firmware
$ lsblk
NAME    MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
xvda    202:0    0   8G  0 disk 
└─xvda1 202:1    0   8G  0 part /etc/hosts

インスタンス拡張後

# ルートのパーティションのサイズ拡張
$ sudo growpart /dev/xvda 1
# ファイルシステムの拡張
$ sudo xfs_growfs /dev/xvda1
# 確認
$ df -h
Filesystem      Size  Used Avail Use% Mounted on
devtmpfs        474M     0  474M   0% /dev
tmpfs           483M     0  483M   0% /dev/shm
tmpfs           483M  532K  482M   1% /run
tmpfs           483M     0  483M   0% /sys/fs/cgroup
/dev/xvda1       16G  7.0G  9.1G  44% /
tmpfs            97M     0   97M   0% /run/user/1001

$ lsblk
NAME    MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
xvda    202:0    0  16G  0 disk 
└─xvda1 202:1    0  16G  0 part /

全体のボリュームの空き容量を確認

$  df -hT /dev/xvda1
Filesystem     Type  Size  Used Avail Use% Mounted on
/dev/nvme0n1p1 xfs    16G  8.6G  7.5G  54% /

参考

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?