Setting up Ubuntu 14.04 LTS as an EBS-backed image

Follow

Tested on: v4.1.0 and v4.0.2

The following steps will help you set up an EBS-backed image of Ubuntu 14.04 LTS.

  • download image to CLC:
wget https://cloud-images.ubuntu.com/trusty/current/trusty-server-cloudimg-amd64-disk1.img
  • convert to raw, specifying the .img file as the source, and creating a new filename ending in .raw:
qemu-img convert -O raw trusty-server-cloudimg-amd64-disk1.img trusty-server-cloudimg-amd64-disk1.raw
  • here's a before/after comparison in size:
[root@odc-c-12 ~]# ll trusty*
-rw-r--r-- 1 root root 256639488 Feb 25 16:35 trusty-server-cloudimg-amd64-disk1.img
-rw-r--r-- 1 root root 2361393152 Feb 26 13:17 trusty-server-cloudimg-amd64-disk1.raw
  • before continuing, ensure that imaging worker properties are set appropriately:
euca-describe-properties | grep imaging
  • imaging.imaging_worker_emi (in v4.0.2, or services.imaging.worker.image in v4.1.0) needs to be set appropriately; do not set this manually unless you know what you're doing, this should have been set correctly when you installed the imaging worker
  • imaging.imaging_worker_enabled (in v4.0.2, or services.imaging.worker.configured in v4.1.0) should already be set to true
  • imaging.imaging_worker_instance_type (in v4.0.2, or services.imaging.worker.instance_type in v4.1.0) should be set to m3.xlarge; if it isn't, set it to m3.xlarge now (if there's already an imaging worker running, you'll want to terminate it so that it restarts with the correct image type)
  • imaging.imaging_worker_keyname (in v4.0.2, or services.imaging.worker.keyname in v4.1.0) should be set to a valid key, in case we need to troubleshoot the worker instance; make sure this is set prior to any imaging worker termination/restarts, as may have occurred in the step above
  • imaging.imaging_worker_ntp_server (in v4.0.2, or services.imaging.worker.ntp_server in v4.1.0) needs to be set to a valid NTP server, not unlike the Linux install where Eucalyptus is running; in our case we've set this to pool.ntp.org, but if you have an internal NTP server you'd rather use, that's fine as well
  • from here we follow Option A on this page
  • in the ongoing example we run this command:
euca-import-volume trusty-server-cloudimg-amd64-disk1.raw --format raw --availability-zone default --bucket ubuntu --owner-akid $EC2_ACCESS_KEY --owner-sak $EC2_SECRET_KEY --prefix trusty-server-cloudimg --description TrustyServerEBS
  • for example:
[root@odc-c-12 ~]# euca-import-volume trusty-server-cloudimg-amd64-disk1.raw --format raw --availability-zone cluster01 --bucket ubuntu --owner-akid $EC2_ACCESS_KEY --owner-sak $EC2_SECRET_KEY --prefix trusty-server-cloudimg --description TrustyServerEBS
Uploading image for task import-vol-5ec49ffc
trusty-server-cloudimg-amd64-disk1.raw.part.0 ( 1/226) 100% |=========================================================================| 10.00 MB 41.61 MB/s Time: 0:00:00
trusty-server-cloudimg-amd64-disk1.raw.part.1 ( 2/226) 100% |=========================================================================| 10.00 MB 34.73 MB/s Time: 0:00:00
trusty-server-cloudimg-amd64-disk1.raw.part.2 ( 3/226) 100% |=========================================================================| 10.00 MB 41.69 MB/s Time: 0:00:00

[redacted for brevity]

trusty-server-cloudimg-amd64-disk1.raw.part.223 (224/226) 100% |=========================================================================| 10.00 MB 41.58 MB/s Time: 0:00:00
trusty-server-cloudimg-amd64-disk1.raw.part.224 (225/226) 100% |=========================================================================| 10.00 MB 41.66 MB/s Time: 0:00:00
trusty-server-cloudimg-amd64-disk1.raw.part.225 (226/226) 100% |=========================================================================| 2.00 MB 10.41 MB/s Time: 0:00:00
TaskType IMPORTVOLUME TaskId import-vol-5ec49ffc ExpirationTime Thu Mar 05 14:52:43 PST 2015 Status active
DISKIMAGE DiskImageFormat RAW DiskImageSize 2361393152 VolumeSize 3 AvailabilityZone cluster01 ApproximateBytesConverted 0
  • check the conversion status with euca-describe-conversion-tasks; if ApproximateBytesConverted is 0 and stays 0, there could be an issue with your imaging worker:
[root@odc-c-12 ~]# euca-describe-conversion-tasks
TaskType IMPORTVOLUME TaskId import-vol-5ec49ffc ExpirationTime Thu Mar 05 14:52:43 PST 2015 Status active StatusMessage Creating volumes
DISKIMAGE DiskImageFormat RAW DiskImageSize 2361393152 VolumeId vol-82945f62 VolumeSize 3 AvailabilityZone cluster01 ApproximateBytesConverted 0
  • the above shows that the conversion hasn't yet started (or if it stays at 0, there could be a problem); once conversion has completed, ie, "Status completed", it should look like this:
[root@odc-c-12 ~]# euca-describe-conversion-tasks import-vol-5ec49ffc
TaskType IMPORTVOLUME TaskId import-vol-5ec49ffc ExpirationTime Thu Mar 05 14:52:43 PST 2015 Status completed StatusMessage Import task finished successfully
DISKIMAGE DiskImageFormat RAW DiskImageSize 2361393152 VolumeId vol-82945f62 VolumeSize 3 AvailabilityZone cluster01 ApproximateBytesConverted 2361393152
  • verified here (using the reference from above, "VolumeId vol-82945f62"):
[root@odc-c-12 ~]# euca-describe-volumes vol-82945f62
VOLUME vol-82945f62 3 cluster01 available 2015-02-26T22:55:00.139Z standard
  • create a snapshot using the same volume ID as above:
[root@odc-c-12 ~]# euca-create-snapshot vol-82945f62
SNAPSHOT snap-49ccc9db vol-82945f62 pending 2015-02-27T00:43:28.503Z 166336974984 3
  • check the snapshot status using the snapshot ID from above (example shows just barely started, still at 0%):
[root@odc-c-12 ~]# euca-describe-snapshots snap-49ccc9db
SNAPSHOT snap-49ccc9db vol-82945f62 pending 2015-02-27T00:43:28.503Z 0% 166336974984 3
  • check the snapshot status again (the example below shows that it's only at 14%):
[root@odc-c-12 ~]# euca-describe-snapshots snap-49ccc9db
SNAPSHOT snap-49ccc9db vol-82945f62 pending 2015-02-27T00:43:28.503Z 14% 166336974984 3
  • now it's ready, as it shows 100% now:
[root@odc-c-12 ~]# euca-describe-snapshots snap-49ccc9db
SNAPSHOT snap-49ccc9db vol-82945f62 completed 2015-02-27T00:43:28.503Z 100% 166336974984 3
  • let's register the snapshot as an image, specifying the same snapshot ID from above:
[root@odc-c-12 ~]# euca-register --name TrustyServerEBS --snapshot snap-49ccc9db
IMAGE emi-0bcdc7ab
  • check the image by its ID to verify that it is indeed EBS:
[root@odc-c-12 ~]# euca-describe-images emi-0bcdc7ab
IMAGE emi-0bcdc7ab 166336974984/TrustyServerEBS 166336974984 available private x86_64 machine ebs hvm
BLOCKDEVICEMAPPING EBS /dev/sda snap-49ccc9db 3 true
  • and now a test run instance using the new EBS-backed image:
[root@odc-c-12 ~]# euca-run-instances -k mykey emi-0bcdc7ab
RESERVATION r-fdb56d9f 166336974984 default
INSTANCE i-c8d8e5cd emi-0bcdc7ab pending mykey 0 m1.small 2015-02-27T00:51:35.806Z cluster01 monitoring-disabled 0.0.0.0 0.0.0.0 ebs hvm sg-d0214499 x86_64
  • and now we confirm that the running instance ID is also EBS (looking for 'ebs' in the output):
[root@odc-c-12 ~]# euca-describe-instances i-c8d8e5cd
RESERVATION r-fdb56d9f 166336974984 default
INSTANCE i-c8d8e5cd emi-0bcdc7ab euca-10-104-3-107.eucalyptus.example.com euca-172-27-20-91.eucalyptus.internal running mykey 0 m1.small 2015-02-27T00:51:35.806Z cluster01 monitoring-disabled 10.104.3.107 172.27.20.91 ebs hvm sg-d0214499 x86_64
BLOCKDEVICE /dev/sda vol-1e4080a7 2015-02-27T00:51:35.922Z true
TAG instance i-c8d8e5cd euca:node 10.104.10.24
  • let's login to the new instance to quickly validate that it's working:
[root@odc-c-12 ~]# ssh -i mykey.pem ubuntu@euca-10-104-3-107.eucalyptus.example.com
Warning: Permanently added 'euca-10-104-3-107.eucalyptus.example.com,10.104.3.107' (RSA) to the list of known hosts.
Welcome to Ubuntu 14.04.2 LTS (GNU/Linux 3.13.0-46-generic x86_64)

* Documentation: https://help.ubuntu.com/

System information as of Thu Feb 26 16:52:26 UTC 2015

System load: 0.0 Memory usage: 18% Processes: 51
Usage of /: 56.4% of 1.32GB Swap usage: 0% Users logged in: 0

Graph this data and manage this system at:
https://landscape.canonical.com/

Get cloud support with Ubuntu Advantage Cloud Guest:
http://www.ubuntu.com/business/services/cloud

0 packages can be updated.
0 updates are security updates.



The programs included with the Ubuntu system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Ubuntu comes with ABSOLUTELY NO WARRANTY, to the extent permitted by
applicable law.

ubuntu@euca-172-27-20-91:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 14.04.2 LTS
Release: 14.04
Codename: trusty
ubuntu@euca-172-27-20-91:~$

 

Have more questions? Submit a request

Comments

Powered by Zendesk