[ubuntu-cloud] Cloud-config and mount points

Scott Moser smoser at ubuntu.com
Wed Jul 11 17:38:07 UTC 2012


On Tue, 10 Jul 2012, Bo Shi wrote:

> Hi,
>
> On an AWS EC2 instance, I'd like to switch /var/log from the root disk
> to an ephemeral disk.  I can successfully change the mount point using
> cloud-config:
>
>    mounts:
>      - [ ephemeral0, /var/log, auto, "defaults,noexec" ]
>
>
> One problem with this approach is that the actual mounts appear to be
> occurring *after* rsyslog is started which blows away any existing
> logs.  Does anyone know of a workaround?


At times I've considered trying to make the mounts try to copy data
across, but it seemed complex.  Ie, in the case given above, the code
would have to know that rsyslog has to be restarted because it has handles
to /var/log.

That said, I think you might be able to accomplish what you want by
running the 'mounts' cloud-config module as a 'cloud_init_modules' rather
than 'cloud_config_modules'.

basically, through user-data or image modification of
/etc/cloud/cloud.cfg you should be able to do this:
 | mounts:
 |  - [ ephemeral0, /var/log, auto, "defaults,noexec" ]
 | cloud_init_modules:
 |  - bootcmd
 |  - resizefs
 |  - set_hostname
 |  - update_hostname
 |  - update_etc_hosts
 |  - ca-certs
 |  - rsyslog
 |  - ssh
 | cloud_config_modules:
 |  - mounts
 |  - ssh-import-id
 |  - locale
 |  - set-passwords
 |  - grub-dpkg
 |  - apt-pipelining
 |  - apt-update-upgrade
 |  - landscape
 |  - timezone
 |  - puppet
 |  - chef
 |  - salt-minion
 |  - mcollective
 |  - disable-ec2-metadata
 |  - runcmd
 |  - byobu

Above, I basically copied content from /etc/cloud/cloud.cfg the data
provided by user-data will override those stored in the image.

I think that when run as a cloud-init module, cloud-init will actually
block the running of rsyslog until it has finished.  So, at that point
rsyslog should not have populated it.

However, cloud-inti *will* have written some stuff to
/var/log/cloud-init.log. so... thats one example of why this doesn't
really work as well as you'd like.

I'm open to ideas and code on how to make it magically work



More information about the Ubuntu-cloud mailing list