Tuesday Oct 13, 2009

EBS FAQ and how-to's

Previously we posted a blog entry titled “OpenSolaris supports EBS - provides capability to create ZFS” that explains how to use the Amazon's Elastic Block Storage with OpenSolaris EC2 instances. This document combines the EBS with OpenSolaris ZFS technology. While we tried to cover the details needed but there a few questions have been asked several times. In this entry, I will try to explain those details and feel free to ask more questions so we can make it as clear as possible:

  • When an EBS device is attached to OpenSolaris instance, how do I identify these drives from within the instance?
  • Can I use some automated scripts to mount these EBS devices during the instance startup ? is this answered last (below)?
  • Why do I sometimes detach/attach being not successful ?

I will answer these questions in following sections.

When a disk is attached to an OpenSolaris instance it can be viewed in number of ways and the simplest one is to use the format(1M) command. Following is the output of the format command on a default OpenSolaris EC2 instance (without any EBS device being attached) :

root@domU-12-31-39-00-50-A7:~# format

Searching for disks...done


0. c7d0 <DEFAULT cyl 1274 alt 0 hd 255 sec 63>


1. c7d1 <DEFAULT cyl 19464 alt 0 hd 255 sec 63>


Specify disk (enter its number):

What this tells us is there are two default disks wwhere the controller is 7 and disk is 0(c7d0) and 1(c7d1). It is important to note that this is an OpenSolaris 2009.06 AMI and any AMI which is based on this should have the same controller number. For different OpenSolaris versions the controller number may change and the Getting Started Guide or the format command can be referred to get this information. Any further disk attachment through EBS commands (ec2-attach-volume) will have the same controller ID and a new disk id which will change based on the argument we give to this command. So far it can be easily assumed that -d (a unique number greater than 1) will result in an EBS device appearing as below with the format command within the EC2 instance:

c7d<decimal value of <<a unique number greater than 1> treated as hex number>


$ ec2-attach-volume vol-63d6250a -d 3 -i i-cf65b5a7

will result in:

c7d3 <DEFAULT cyl 2048 alt 0 hd 128 sec 32>


And so a command like this will result in the following:

$ ec2-attach-volume vol-63d6250a -d 10 -i i-cf65b5a7

will result in:

c7d16 <DEFAULT cyl 2048 alt 0 hd 128 sec 32>


Now if the disk number is already assigned and you try to do that again, it will result in following error:

$ ec2-detach-volume vol-63d6250a -d 2 -i i-cf65b5a7

Client.InvalidAttachment.NotFound: The volume 'vol-63d6250a' is not attached to instance 'i-cf65b5a7' as device '2'.

So it must be unique and unused number.

Also, for detaching a mounted ZFS or regular UFS? file system, we will have to do few things before we can do a clean detach:

For the EBS volumes that is part of ZFS we have to do the following:

Shutdown all applications that are running on top of the ZFS pool.
Export the ZFS pools with:
$ zpool export pool_name
Detach the EBS volumes from the ECS instance.
Also clean up devices with:
$ devfsadm -C -v

For regular UFS? mounted file systems using the newfs(1M) and mount(1M) commands:

Unmount the mounted volume:

$ umount /ebs-vol

Also clean up devices with:
$ devfsadm -C -v

Friday Apr 24, 2009

Glassfish 2.1 and MySQL 5.1 AMI on OpenSolaris 2008.11

Announcing availability of new GlassFish AMIs based on OpenSolaris 2008.11 AMI.

OpenSolaris + GlassFish + MySQL

32-bit AMI: ami-a87b9cc1 aki-6552b60c ari-6452b60d

This 32bit AMI is based on OpenSolaris 2008.11 AMI and MySQL AMI. It contains Glassfish 2.1 binaries with MySQL Connector/J 5.1.  Glassfish 2.1 is deployed from JAR distribution in Developer profile. By default Glassfish 2.1 administartion required SSL mode, is enables only from CLI and localhost. Users should check /export/home/gf21 README files for post configurations (securing) directions. An existing user 'gf21' is authorized to manage the Glassfish 2.1 server.

Note:  Default Glasfish admin user password can be obtained from /root/ec2sun/README file

You need to reset default admin  password by following procedure in /export/home/gf21 README files

It is highly recommended to secure your Glassfish 2.1 server  by following the guidelines mentioned within Glassfish 2.1 server documentation - :
Sun GlassFish Enterprise Server 2.1 Administration Guide >> Chapter 9 Configuring Security

Administering Glassfish 2.1

Glassfish 2.1 installation is located under /opt/gf21 directory and is managed by gf21 user with home at /export/home/gf21

NOTE: You need to be user gf21 when administering Glassfish

Start Service     svcadm enable glassfish/domain1

Stop Service     svcadm disable glassfish/domain1

Check status    svcs glassfish/domain1

Start MySql

su - mysql;

svcadm enable mysql

For more information and details on this AMI please refer /export/home/gf21/glassfish.README, /export/home/mysql/mysql.README and Rudolf's Blog. As always, please feel free to contact us at ec2-solaris-support [at] sun [dot] com.


Information about Solaris and OpenSolaris on Amazon Web Services (AWS) EC2. Look here for the latest information on the program and any late breaking information on (Open)Solaris on EC2.


« July 2016