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
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
/etc/ebsmount.conf ENABLED=True MOUNTDIR=/media/ebs MOUNTOPTIONS=noatime FILESYSTEMS=ext2 ext3 LOGFILE=/var/log/ebsmount.log
Every EBS filesystem is mounted to its own uniquely identifiable mountpoint, based on:
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:
MOUNTPOINT/.ebsmount/10symlink #!/bin/bash -e target=/vol mountp=$(dirname $(dirname $0)) [ ! -h $target ] && ln -s $mountp $target