The Block Storage Service in Eucalyptus is interface-compatible with Amazon's Elastic Block Store. You can therefore use either EC2 commands or euca2ools commands to control it.
The instructions below rely on the euca2ools command-line tools distributed by the Eucalyptus Team. Please, install them if you haven't done so already.
The following operations are possible,
1. Creating volumes
You may create a volume either from scratch or from an existing snapshot.
euca-create-volume --size <size> --zone <zone>
where <size> is the size in GB and <zone> is the availability zones you wish to create the volume in (use euca-describe-availability-zones to discover zones).
For instance,
euca-create-volume --size 1 --zone myzone
will create a 1GB volume in the availability zone "myzone"
To create a volume from a snapshot,
euca-create-volume --snapshot <snapshot id> --zone <zone>
where <snapshot id> is the unique identifier for a snapshot and <zone> is the availability zone you wish to create the volume in.
For instance,
euca-create-volume --snapshot --zone myzone snap-EF4323
will create a volume from the snapshot "snap-EF4323" in the zone "myzone"
2. Query the status of volumes
euca-describe-volumes
Volumes marked "available" are ready for use.
3. Attaching a volume
You can attach volumes to existing instances (that have been started with euca-run-instances). You may attach a volume to only one instance at a time.
euca-attach-volume -i <instance id> -d <local device name> <volume id>
where <volume id> is the unique identifier for a volume (vol-XXXX), <instance id> is a unique instance identifier and <local device name> is the name of the local device in the guest VM.
For instance,
euca-attach-volume -i i-345678 -d /dev/sdb vol-FG6578
will attach the previously unattached volume "vol-FG6578" to instance "i-345678" with the local device name "/dev/sdb"
4. Detaching a volume
euca-detach-volume <volume id>
where <volume id> is the unique identifier for a previously attached volume (vol-XXXX).
For instance,
euca-detach-volume vol-FG6578
will detach volume "vol-FG6578"
Important! The user of the instance is responsible for making sure that the block device is unmounted before a detach. Detach cannot ensure the consistency of user data if the user detaches a volume that is in use.
5. Deleting a volume
euca-delete-volume <volume id>
where <volume id> is the unique identifier for a volume (vol-XXXX).
6. Creating a snapshot from a volume
You can snapshot a volume so that you can create volumes in the future from the snapshot.
euca-create-snapshot <volume id>
where <volume id> is the unique identifier for a volume (vol-XXXX).
For instance,
euca-create-snapshot vol-GH4342
will snapshot the volume "vol-GH4342"
The volume to be snapshotted needs to be "available" or "in-use." You cannot snapshot a volume that is in the "creating" state.
7. Querying the status of snapshots
euca-describe-snapshots
You may create volumes from snapshots that are marked "completed."
8. Deleting a snapshot
euca-delete-snapshot <snapshot id>
where <snapshot id> is the unique identifier for a snapshot.