I'm new to ec2 and don't know much about /etc/fstab.

In addition to the root volume on my ec2 instances, I have a volume mounted to /data and a third volume for swap.

I'm having trouble figuring out the correct entries for my fstab file and I'm wondering what others have.

Mine looks like this:

UUID=711e1ec2-2a36-4405-bf46-44b43cfee42e / ext4 defaults 1 1
UUID=40bb7487-db4e-4bee-bda2-8732155ae962  /data  ext4  defaults,nofail  0  2
UUID=2f67cabb-94b8-4074-b3bb-344ebc171299 swap swap defaults 0 0 

I put the UUIDs in there because it seemed to me that sometimes the ec2 instance, when rebooted, might switch around the device names. What I mean by that is that the volume with /data starts out as /dev/nvme1n2 and then after a reboot it might be /dev/nvme1n1. I find it hard to believe this happens so maybe I'm wrong on this.

So at any rate, I use the UUIDs in /etc/fstab just to be sure.

I'd like to know if anyone else is using device names instead of UUIDs? I'd prefer to use device names because that's less of a maintenance headache.


  • 2
    Nobody uses raw partition names if they want their systems to be bootable. Jan 26, 2021 at 23:41

2 Answers 2


The approach you described is the same as in the official AWS documentation: https://docs.aws.amazon.com/AWSEC2/latest/UserGuide/ebs-using-volumes.html

Therefore I guess you can say it's "the proper way".


If you want your volumes to be mounted even after reboot use UUID and no one using partition names due to this in aws.

AWS reference

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.