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


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.

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. 

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.
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!


Add new comment