AWS
要扩容的磁盘先做快照:https://docs.amazonaws.cn/AWSEC2/latest/UserGuide/ebs-creating-snapshot.html
磁盘在线扩容:https://docs.amazonaws.cn/AWSEC2/latest/UserGuide/recognize-expanded-volume-linux.html
选择要操作的磁盘—-》操作—-》Modify Volume
linux系统的磁盘扩容是跟文件系统有关联的,扩容后还要扩文件系统
[root@ip db]# df -hT # 查看磁盘大小及文件系统
Filesystem Type Size Used Avail Use% Mounted on
devtmpfs devtmpfs 31G 0 31G 0% /dev
tmpfs tmpfs 31G 0 31G 0% /dev/shm
tmpfs tmpfs 31G 572K 31G 1% /run
tmpfs tmpfs 31G 0 31G 0% /sys/fs/cgroup
/dev/nvme0n1p1 xfs 300G 249G 52G 83% /
tmpfs tmpfs 6.2G 0 6.2G 0% /run/user/1000
[root@ip db]# lsblk # 扩容前是300G
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
nvme0n1 259:0 0 300G 0 disk
├─nvme0n1p1 259:1 0 300G 0 part /
└─nvme0n1p128 259:2 0 1M 0 part
[root@ip db]# lsblk # 扩容后1000,但此时文件系统还没扩容
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
nvme0n1 259:0 0 1000G 0 disk
├─nvme0n1p1 259:1 0 300G 0 part /
└─nvme0n1p128 259:2 0 1M 0 part
[root@ip db]# growpart /dev/nvme0n1 1
[root@ip db]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
nvme0n1 259:0 0 1000G 0 disk
├─nvme0n1p1 259:1 0 1000G 0 part /
└─nvme0n1p128 259:2 0 1M 0 part
[root@ip db]# xfs_growfs -d / # 扩容文件系统
# 如果是ext4文件系统,则用 resize2fs 命令
[root@ip db]# df -hT
Filesystem Type Size Used Avail Use% Mounted on
devtmpfs devtmpfs 31G 0 31G 0% /dev
tmpfs tmpfs 31G 0 31G 0% /dev/shm
tmpfs tmpfs 31G 540K 31G 1% /run
tmpfs tmpfs 31G 0 31G 0% /sys/fs/cgroup
/dev/nvme0n1p1 xfs 1000G 251G 750G 26% /
tmpfs tmpfs 6.2G 0 6.2G 0% /run/user/1000