Reputation: 653
Created an ec2 instance with default Root Volume Type
. That's just 8 GB.
$ df -h
Filesystem Size Used Avail Use% Mounted on
udev 7.9G 0 7.9G 0% /dev
tmpfs 1.6G 25M 1.6G 2% /run
/dev/xvda1 7.7G 7.3G 439M 95% /
tmpfs 7.9G 0 7.9G 0% /dev/shm
tmpfs 5.0M 0 5.0M 0% /run/lock
tmpfs 7.9G 0 7.9G 0% /sys/fs/cgroup
tmpfs 1.6G 0 1.6G 0% /run/user/1000
tmpfs 1.6G 0 1.6G 0% /run/user/113
Now the instace is full used like above. Want to add volume size, created an EBS volume, how to attach it to the instance without deleting the original data?
Upvotes: 0
Views: 285
Reputation: 9411
Option 1. Add another volume.
Go to AWS Console -> EC2 -> Elastic Block Store -> Volumes. Create a volume, attach it to your instance. From that point on you should see the new volume from your instance withlsblk
. Make a file system with mk2fs
or whatever and mount with mount
.
Option 2. Extend your current volume.
Stop the instance, make a volume snapshot, create a new volume of the required size from that snapshot, detach old volume from the instance, attach the new volume. Make sure you're creating volume in the same availability zone that your EC2 instance is in. Start your instance. In most cases that's enough. If you file system was not resized automatically, use resize2fs
to do it manually.
Upvotes: 1
Reputation: 1266
Below aws documentation will answer your questions
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/expand-linux-partition.html
https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/recognize-expanded-volume-linux.html
Upvotes: 1