Skip to content

Automatically mount EC2 EBS (Elastic Block Storage) devices

License

Notifications You must be signed in to change notification settings

turnkeylinux/ebsmount

Folders and files

NameName
Last commit message
Last commit date
Mar 29, 2022
Mar 29, 2022
Feb 4, 2022
Mar 30, 2022
Jun 14, 2010
Mar 25, 2022
Jul 24, 2017
Jun 16, 2010
Mar 30, 2022
Mar 30, 2022
Sep 6, 2023

Repository files navigation

EBSmount: Automatically mount EC2/OpenStack EBS devices
========================================================

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:

    - Supports Amazon EC2 and OpenStack EBS devices
    - 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 (optionally)
    - 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, the user can format and mount the
      device in one step, for example:

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

Default configuration (/etc/ebsmount.conf):

    ENABLED=True
    RUNHOOKS=False
    MOUNTDIR=/media/ebs
    MOUNTOPTIONS=noatime
    FILESYSTEMS=ext2 ext3 ext4
    LOGFILE=/var/log/ebsmount.log

    DEVPATHS=/devices/xen/vbd- /devices/virtio-pci/virtio

Unique mountpoints:

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

        $(MOUNTDIR)/$(FS_UUID)[:6]

    - For example:
    
        /media/ebs/a1b2c3

Hooking scripts:

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

    - Hooking scripts execution is disabled by default. To enable execution,
      RUNHOOKS must be set to True in /etc/ebsmount.conf Additionally, hook
      scripts will only be executed if they are owned by root.

    - The mountpoint of the device will be set in the environment for
      convenience, as MOUNTPOINT

    - 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=$MOUNTPOINT
        [ -e $target ] || ln -s $mountp $target