I’m using the python boto library and wrote a script (which runs on an ec2 instance) to get a list of all volumes attached to that instance.
Now I need to check whether each volume is mounted, and if it’s mounted, what is the mount point. I thought I would be able to search /proc/mounts for the volume device (using volume.attach_data.device), but that does not work because Amazon renames the devices from something like /dev/sdf to something like /dev/xvda. I have not seen any clear documentation on whether this renaming occurs 100% of the time (regardless of your instance type, volume type, etc.) or how to determine the new device name.
Anyone know how to do this?
I recently went through this – renames like this:
sdf -> xvdf, sdg -> xvdg, and so on
It is consistent.
For a longer explanation see this thread:
How to attach new EBS volume to Ubuntu machine on AWS?
So you should be able to use your original idea to check the mount point and just remap the naming.