in Linux

AWS attach additional disk

The AWS disk was used up very fast, added additional volumes,

The disk usage as below,
[root@ip-172-31-2-32 ec2-user]# df -l
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/xvda2 10473452 8020612 2452840 77% /
devtmpfs 484472 0 484472 0% /dev
tmpfs 507736 20 507716 1% /dev/shm
tmpfs 507736 57588 450148 12% /run
tmpfs 507736 0 507736 0% /sys/fs/cgroup
tmpfs 101548 0 101548 0% /run/user/1000

First you need to add the volumes, added two additional disk,
Block devices
/dev/sda1
/dev/sdb
/dev/sdc

Then create ext4 file system on the volume,
sudo mkfs -t ext4 /dev/sdb
sudo mkfs -t ext4 /dev/sdb

Create the mount point:
mkdir /home/ec2-user/data
mkdir /home/rongrong/data

mount the device to the point created:
mount /dev/xvdb /home/ec2-user/data
mount /dev/xvdc /home/rongrong/data

update /etc/fstab to make it auto mount, added two lines,
/dev/xvdc /home/rongrong/data ext4 defaults,nofail 0 2
/dev/xvdb /home/ec2-user/data ext4 defaults,nofail 0 2

command mount -a
mount -a

check the disk usage again:
[root@ip-172-31-2-32 ec2-user]# df -l
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/xvda2 10473452 8051316 2422136 77% /
devtmpfs 484472 0 484472 0% /dev
tmpfs 507736 20 507716 1% /dev/shm
tmpfs 507736 57532 450204 12% /run
tmpfs 507736 0 507736 0% /sys/fs/cgroup
tmpfs 101548 0 101548 0% /run/user/1000
/dev/xvdb 10190100 36888 9612540 1% /home/ec2-user/data
/dev/xvdc 999320 17552 929340 2% /home/rongrong/data

Reference link:
http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-using-volumes.html

Write a Comment

Comment

one × two =