By default on every reboot, the EBS volumes other than root volume will get unmounted. To enable automount, you need to make an entry in the /etc/fstab file.
Follow the steps given below to automount the EBS volume to ec2 instance.
Step 1: Back up the /etc/fstab file.
sudo cp /etc/fstab /etc/fstab.bak
Step 2: Open /etc/fstab file and make an entry in the following format.
device_name mount_point file_system_type fs_mntops fs_freq fs_passno
For example,
/dev/xvdf /newvolume ext4 defaults,nofail 0 0
Step 3: Execute the following command to check id the fstab file has any error.
sudo mount -a
If the above command shows no error, it means your fstab entry is good.
Now, on every reboot, the extra EBS volumes will get mounted automatically.
I’m a DevOps/SRE/DevSecOps/Cloud Expert passionate about sharing knowledge and experiences. I am working at Cotocus. I blog tech insights at DevOps School, travel stories at Holiday Landmark, stock market tips at Stocks Mantra, health and fitness guidance at My Medic Plus, product reviews at I reviewed , and SEO strategies at Wizbrand.
Please find my social handles as below;
Rajesh Kumar Personal Website
Rajesh Kumar at YOUTUBE
Rajesh Kumar at INSTAGRAM
Rajesh Kumar at X
Rajesh Kumar at FACEBOOK
Rajesh Kumar at LINKEDIN
Rajesh Kumar at PINTEREST
Rajesh Kumar at QUORA
Rajesh Kumar at WIZBRAND