Oracle Blog

Signup for news on OpenSolaris AMIsList of OpenSolaris AMIs Technical Support Team

Tuesday Oct 13, 2009

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

AVAILABLE DISK SELECTIONS:

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

/xpvd/xdf@0

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

/xpvd/xdf@1

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>

eg.

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

will result in:

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

/xpvd/xdf@3

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>

/xpvd/xdf@3

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_nameDetach 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:

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.