Blog Tags: 

EBSmount: Automatically mount EBS devices on Amazon EC2

The 2 most annoying things about Amazon EBS (Elastic Block Storage) I have found, is that there is no support to auto-attach an EBS on instance launch, and the need to manually mount an EBS when it's attached.

If the above annoys you as well, you're in luck! The first annoyance has been solved in the TurnKey Hub (private beta soon to be announced - request an invite here), and the second, well, is solved by EBSmount.

EBSmount is pre-installed on all the latest TurnKey AMI's, but should work without issue on any Ubuntu/Debian based system, or any other distribution that uses udev (with minor tweaks). The source code has been released on github, and the package is available in the TurnKey package archive.

Enough said, lets get to it.

EBSmount has 2 commands

ebsmount-udev       Triggered by udev on EBS attach and detach
ebsmount-manual     Manually mount EBS device (simulates udev add trigger)


  • Automatically mounts EBS devices when they are attached (via udev)
  • Supports formatted devices, as well as partitions
  • Ignores unformatted devices and unsupported filesystems
  • Device/partition uniquely identifiable mountpoints
  • Configurable mount options
  • Hooking scripts execution upon mount
  • Convenience command for a one step format and mount
  • Logging

Quick start

If the EBS device is not formatted, it will not be mounted automatically. For convenience, you can format and mount the device in one step, for example:

ebsmount-manual --format=ext3 /dev/sdf

Default configuration



Unique mountpoints

Every EBS filesystem is mounted to its own uniquely identifiable mountpoint, based on:

$(MOUNTDIR)/$(basename PHYSDEVPATH)/$(FS_UUID)[:4]

For example:


Hooking scripts

Once a filesystem is mounted, EBSmount will execute scripts located in MOUNTPOINT/.ebsmount in alpha-numeric ordering.

This provides a very powerful mechanism. In its simplest form, the user might want to symlink the mountpoint to a more accessible path, for example:


#!/bin/bash -e
mountp=$(dirname $(dirname $0))
[ ! -h $target ] && ln -s $mountp $target


Rob's picture


I'm really keen to use ebsmount on my Centos5 instances, but when I try and run ebsmount-manual, I get the error

ebsmount-manual --format=ext3 /dev/sdh
Traceback (most recent call last):
  File "/usr/local/bin/ebsmount-manual", line 19, in ?
    import ebsmount
  File "/usr/local/lib/ebsmount/", line 6, in ?
    import udevdb
  File "/usr/local/lib/ebsmount/", line 7, in ?
    from executil import ExecError, getoutput
ImportError: cannot import name ExecError

I've had a search on Google and can't find any reference to ExecError. Can you tell me how to resolve this error




Alon Swartz's picture

EBSmount depends on turnkey-pylib, which provides the python module executil (as well as conffile). It is available as a deb package, and you can find the source code here.

Hope the above helps.

Mark P.'s picture

In Fedora AMI to automatically mount EBS volume on a reboot:

After creating EBS volume and attaching to the AMI using the AWS console I just:

(substitute as appropriate)

mkfs -t ext2 /dev/sdf
Created mount point (in my case a backup directory):
mkdir /backups
Mounted it:
mount /dev/sdf /backups
Edited rc.local:
added mount /dev/sdf /backups to the end which mounts the EBS directory on bootup.
Guest's picture


Allan's picture

Nice - thanks a lot.

Lapith's picture

Hey, we are looking for a solution that will allow us to create an AMI that acts as a file server and mount to the file server with multiple AMIs. I just want to make sure that I am reading this correctly and that this would be a possible solution.

The use case here is that we have an AMI with an attached EBS that we would then like to mount from the EBS to another AMI with an attached EBS.

Guest's picture


I just did that with nfs.  The only gotchas I came across was make sure to open the appropriate ports for your security group and specify the right ips in your /etc/exports. 

Best of luck.


David Killingsworth's picture

I found the following helpful tip at this URL:


For easy access to your EBS I would recommend creating a symlink, something like this:

ln -s /media/ebs/vbd-2160/a1b2 /vol

Then, you can simply "cd /vol".

I hope the above helps.

David Killingsworth's picture

This might sound like a stupid question, but I did not partition the EBS volume after I attached it to my turnkey appliance.

I then ran

ebsmount-manual --format=ext3 /dev/sdf

So basically, I formatted without partitioning.

I can see the volume and I have data there.  By chance, does the command partition the drive when it does the formatting?

If I go into Webmin and look at "Partitions on local disks" it says "This disk has no partitions yet."

Alon Swartz's picture

No, it doesn't partition the disk. It just accepts the device you want to format/mount and does it's stuff. So in your case the full volume is being used -which is fine, and generally the way EBS volumes are used.

There isn't much point in partitioning an EBS device anyway, if you want another volume just create it. That is unless if you want to use RAID or LVM, but thats a whole other story...

David Killingsworth's picture

Thanks Alon for the quick reply.

Is there any downside to not partitioning? 

I had inadvertantly left out the partitioning step by the way.  In fact, I didn't know that you could format a drive without partitioning it.

Alon Swartz's picture

Nope, no downside, actually to the contrary, it's simpler and less error prone, so I'd recommend it. All our EBS's are formatted without partitions and are working great. 

DCM's picture

This will probably be seen as a really bad question, but how do I get this installed?  I'm just getting started with learning using one of the suse preinstalled AMI's from AWS.   I'm not a linux guy at all, I am learning as I go.

I have

Downloaded turnkey-pylib -

Downloaded ebsmount -

copied each of those to their own directory on my instance and extracted the archive via ssh putty.

I managed to get the turkey-pylib installed by reading the INSTALL file and running python install

I can't figure out how to install ebsmount after looking through the files & the web

Can you help a brother out?  Thank you!

Liraz Siri's picture

If you launch a TurnKey instance from the Hub it comes with ebsmount preinstalled. Installing on SUSE is probably possible if you know what you're doing but otherwise, it's touch and go.
DCM's picture

I believe I have it working, Am I right in thinking I just need to modify ebsmount.conf and change the MOUNTDIR to where I want the volume to be mounted?

I'll have to try out turnkey soon.

L. Arnold's picture

I could see a real advantage in having "shared" access to one Network Drive between TKL Image installs..  Also, potentially the same for MySQL and/or even Windows systems looking at the same Drives so some databridges could be simplified (FoxPro to MySQL for instance).

Keep it up.   The landscape is changing fast. 

I should ask, what do we do if Alon and/or Liraz need to exit to something "bigger or better paying"?  I would hate to see this all go away.  It is really incredible the systems you have built with the bigger team!

Alec's picture

Seriously? No indication of how old this is on the page, nothing in the URL.

satish's picture


How can I see when my ebs volume has got dettached and attached, where can i get information


Add new comment