~brightbox/cloud-initramfs-tools/cloud-initramfs-tools

Viewing all changes in revision 56.

  • Committer: Scott Moser
  • Date: 2012-07-30 16:09:39 UTC
  • mfrom: (55.1.1 trunk.cfg-disk)
  • Revision ID: smoser@ubuntu.com-20120730160939-9u25zjtkkt9mtphm
support reading 'overlayroot.conf' config from attached disk


Amazon allows you to specify a "block device mapping" [1] when you launch
an instance.  This allows for reading an 'overlayroot.conf' file from a
filesystem that is labelled appropriately (LABEL=OROOTCFG).

The result is that you can create a snapshot of a volume that has a
filesystem on it and a single file '/overlayroot.conf' prepared like this:
 - mkfs.ext3 -L OROOTCFG $DEV
 - mount $DEV /mnt
 - echo 'overlayroot="device:dev=LABEL=OROOTCFG"' |
      sudo tee -a /mnt/overlayroot.conf
 - umount /mnt

Then, create a snapshot of that volume and attach it to new instances like
this:
 SNAP=snap-0df83c7d
 AMI_ID=ami-754be31c
 euca-run-instances --block-device-mapping=/dev/sde=$SNAP::1 \
    --instance-type t1.micro "$AMI_ID"


The instance will boot, find the configuration file, and respect it.  The
given configuration above results in the instance having read-only root
with changes written to the EBS device.

The same path works with crypt: configuration, even with the
attached block device being the dev= parameter. After the overlayroot.conf
file was read, the block device would just be destroyed and formatted for
luks use.  Reboot will not work unless you copy the external config
file to the root device or otherwise set that up.

tested with:
 overlayroot="device:dev=LABEL=OROOTCFG"
 overlayroot="crypt:dev=/dev/xvde"

expected to work with
 overlayroot="crypt:dev=LABEL=OROOTCFG"

--
[1] http://docs.amazonwebservices.com/AWSEC2/latest/UserGuide/block-device-mapping-concepts.html

expand all expand all

Show diffs side-by-side

added added

removed removed

Lines of Context: