4

Mount as EBS volume inside a EC2 instance

 2 years ago
source link: https://www.kevinhooke.com/2021/10/08/mount-as-ebs-volume-inside-a-ec2-instance/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Mount as EBS volume inside a EC2 instance

By default, if you provision and attach additional EBS volumes for an EC2 instance, they don’t get mounted by default.

The boot EBS is usually /dev/xvda1. Each additional EBS volume should be /dev/xvdb and so on.

First format the new volume:

sudo mkfs -t ext4 /dev/xvdb

Make a mount mount directory like /data, then mount it with:

sudo mount /dev/xvdb /data

Now you should see the new volume available:

$ df -h
Filesystem      Size  Used Avail Use% Mounted on
devtmpfs        3.9G     0  3.9G   0% /dev
tmpfs           3.9G     0  3.9G   0% /dev/shm
tmpfs           3.9G  432K  3.9G   1% /run
tmpfs           3.9G     0  3.9G   0% /sys/fs/cgroup
/dev/xvda1       20G  8.8G   12G  44% /
tmpfs           798M     0  798M   0% /run/user/1000
/dev/xvdb       7.8G   36M  7.3G   1% /data

Add a line to /etc/fstab to mount on startup:

/dev/xvdb /data ext4 defaults,nofail 0 2

These steps are from multiple places, mainly answers to this question.

CategoriesTech NotesTagsaws, cloud, EBS, ec2

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Comment

Name *

Email *

Website

Save my name, email, and website in this browser for the next time I comment.

Notify me of follow-up comments by email.

Notify me of new posts by email.

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Post navigation


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK