EBSmount: Automatically mount EBS devices on Amazon EC2 | TurnKey GNU/Linux
You are here
Category: All
EBSmount: Automatically mount EBS devices on Amazon EC2
Blog Tags:
aws
ec2
cloud
EBSmount: Automatically mount EBS devices on Amazon EC2
Alon Swartz
- Thu, 2010/04/15 - 13:27 -
8 comments
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)
Features
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
/etc/ebsmount.conf
ENABLED=True
MOUNTDIR=/media/ebs
MOUNTOPTIONS=noatime
FILESYSTEMS=ext2 ext3
LOGFILE=/var/log/ebsmount.log
Unique mountpoints
Every EBS filesystem is mounted to its own uniquely identifiable mountpoint, based on:
$(MOUNTDIR)/$(basename PHYSDEVPATH)/$(FS_UUID)[:4]
For example:
/media/ebs/vbd-2160/a1b2
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:
MOUNTPOINT/.ebsmount/10symlink
#!/bin/bash -e
target=/vol
mountp=$(dirname $(dirname $0))
[ ! -h $target ] && ln -s $mountp $target
Comments
EBSmount depends on turnkey-pylib
Alon Swartz
- Wed, 2010/06/09 - 18:36
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.
reply
I found the following helpful
David Killingsworth
- Wed, 2011/01/05 - 02:51
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.
reply
This might sound like a
David Killingsworth
- Wed, 2011/01/05 - 11:16
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."
reply
No, it doesn't partition the disk...
Alon Swartz
- Wed, 2011/01/05 - 13:11
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...
reply
Thanks Alon for the quick
David Killingsworth
- Wed, 2011/01/05 - 19:56
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.
reply
Nope, no downside
Alon Swartz
- Thu, 2011/01/06 - 09:59
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.
reply
Use TurnKey!
Liraz Siri
- Tue, 2011/04/12 - 20:46
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.
reply
All interesting... Is there any "documentation" on this?
L. Arnold
- Sat, 2011/04/23 - 17:16
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!
reply
Pages
Add new comment
Apps
Specials
Web development
Framework
Stack
IT Infrastructure
Content management
Blogging
Ecommerce
Education
Wiki
Media
Business management
CRM
ERP
Invoicing
Messaging
Email
Forum
Chat
Issue tracking
Project management
Database
NoSQL
Developer tools
Help
Forums
Support
General
Development
Documentation
Security and News Announcements
Low-traffic newsletter: up to one email a month.
Previous issues
Categories
development
news
appliances
community
debian
release
hub
stable
iso
security
cloud
ec2
aws
proxmox
lxc
ubuntu
tkldev
tips
v16.x
drupal
More tags
Recent posts
Free up disk space
4th Aug, 2024
Python PEP 668 - working with "externally managed environment"
29th Jul, 2024
v18.0 Stable Release #6 - 10 Newly Updated ISOs, Hub Builds & Proxmox/LXC builds
17th Apr, 2024
v18.0 Stable Release #5 - 20 Updated ISOs & Hub Builds - Proxmox/LXC builds
12th Feb, 2024
v18.0 Stable Release #4 - 10 Updated ISOs & Hub Builds - Proxmox/LXC builds
5th Feb, 2024
1 of 63
next ›
Archive
August 2024
(1)
July 2024
(1)
April 2024
(1)
February 2024
(2)
November 2023
(1)
October 2023
(1)
September 2023
(1)
July 2023
(1)
April 2023
(1)
March 2023
(1)
December 2022
(1)
November 2022
(2)
Pages
Recent comments
V19?
TurnKey LXC templates are available via the Proxmox UI
Non-Aws platforms
Thanks for that!
the command for adding the
mtoolshub
Great post