CSS Corp Open Source Services

[OpenStack Beginner’s Guide for Ubuntu 11.04] Storage Management

with 2 comments

Nova-volume

Nova-volume provides persistent block storage compatible with Amazon’s Elastic Block Store. The storage on the instances is non persistent in nature and hence any data that you generate and store on the file system on the first disk of the instance gets lost when the instance is terminated. You will need to use persistent volumes provided by nova-volume if you want any data generated during the life of the instance to persist after the instance is terminated.

Commands from euca2ools package can be used to manage these volumes.

Here are a few examples:

Interacting with Storage Controller

Make sure that you have sourced novarc before running any of the following commands. The following commands refer to a zone called ‘nova’, which we created in the chapter on “Installation and Configuration”. The project is ‘proj’ as referred to in the other chapters.

Create a 10 GB volume


euca-create-volume -s 10 -z nova

You should see an output like:


VOLUME    vol-00000002    1    creating (proj, None, None, None)    2011-04-21T07:19:52Z

List the volumes

euca-describe-volumes

You should see an output like this:


VOLUME    vol-00000001     1        nova    available (proj, server1, None, None)    2011-04-21T05:11:22Z
VOLUME    vol-00000002     1        nova    available (proj, server1, None, None)    2011-04-21T07:19:52Z

Attach a volume to a running instance


euca-attach-volume -i i-00000009 -d /dev/vdb vol-00000002

A volume can only be attached to one instance at a time. When euca-describe-volumes shows the status of a volume as ‘available’, it means it is not attached to any instance and ready to be used. If you run euca-describe-volumes, you can see that the status changes from “available” to “in-use” if it is attached to an  instance successfully.

When a volume is attached to an instance, it shows up as an additional SCSI disk on the instance. You can login to the instance and mount the disk, format it and use it.

Detach a volume from an instance.


euca-detach-volume vol-00000002

The data on the volume persists even after the volume is detached from an instance. You can see the data on reattaching the volume to another instance.

Even though you have indicated /dev/vdb as the device on the instance, the actual device name created by the OS running inside the instance may differ. You can find the name of the device by looking at the device nodes in /dev or by watching the syslog when the volume is being attached.

Advertisements

2 Responses

Subscribe to comments with RSS.

  1. The fact that it doesn’t actually use the /dev/vdb (or whatever you specify) and just makes one up willy nilly breaks all scripts and tools that think that the device you specify is the device you got.

    At least there should be a mechanism in the API to tell that its not giving you the device name you specified and return the real one. How are you supposed to automate the remaining steps of a deployment like mkfs and mounts?

    This was the main reason I gave up on Eucalyptus….

    Robert J. Berger

    May 6, 2011 at 2:46 am

  2. I also was unable to find the volume in /dev. In fact even though df showed / mounted on /dev/vda, even /dev/vda did not exist. I was able to mount the volume on the vm instance as shown below. This should be scriptable.

    # cat /proc/partitions
    major minor #blocks name

    252 0 24576 vda
    252 16 2097152 vdb

    # mknod /dev/vdb b 252 16
    # fdisk -l

    Disk /dev/vdb: 2147 MB, 2147483648 bytes
    16 heads, 63 sectors/track, 4161 cylinders
    Units = cylinders of 1008 * 512 = 516096 bytes

    Device Boot Start End Blocks Id System

    # fdisk /dev/vdb

    The number of cylinders for this disk is set to 4161.
    There is nothing wrong with that, but this is larger than 1024,
    and could in certain setups cause problems with:
    1) software that runs at boot time (e.g., old versions of LILO)
    2) booting and partitioning software from other OSs
    (e.g., DOS FDISK, OS/2 FDISK)

    Command (m for help): n
    Command action
    e extended
    p primary partition (1-4)
    p
    Partition number (1-4): 1
    First cylinder (1-4161, default 1):
    Using default value 1
    Last cylinder or +size or +sizeM or +sizeK (1-4161, default 4161):
    Using default value 4161

    Command (m for help): w
    The partition table has been altered!

    Calling ioctl() to re-read partition table
    # fdisk -l

    Disk /dev/vdb: 2147 MB, 2147483648 bytes
    16 heads, 63 sectors/track, 4161 cylinders
    Units = cylinders of 1008 * 512 = 516096 bytes

    Device Boot Start End Blocks Id System
    /dev/vdb1 1 4161 2097112+ 83 Linux

    # cat /proc/partitions
    major minor #blocks name

    252 0 24576 vda
    252 16 2097152 vdb
    252 17 2097112 vdb1
    # mknod /dev/vdb1 b 252 17
    # mkfs.ext3 /dev/vdb1
    mke2fs 1.41.12 (17-May-2010)
    Filesystem label=
    OS type: Linux
    Block size=4096 (log=2)
    Fragment size=4096 (log=2)
    Stride=0 blocks, Stripe width=0 blocks
    131072 inodes, 524278 blocks
    26213 blocks (5.00%) reserved for the super user
    First data block=0
    Maximum filesystem blocks=536870912
    16 block groups
    32768 blocks per group, 32768 fragments per group
    8192 inodes per group
    Superblock backups stored on blocks:
    32768, 98304, 163840, 229376, 294912

    Writing inode tables: done
    Creating journal (8192 blocks): done
    Writing superblocks and filesystem accounting information: done

    This filesystem will be automatically checked every 27 mounts or
    180 days, whichever comes first. Use tune2fs -c or -i to override.

    # mkdir /junk
    # mount /dev/vdb1 /junk
    # df -h
    Filesystem Size Used Available Use% Mounted on
    /dev/vda 23.2M 16.9M 5.1M 77% /
    tmpfs 24.0K 0 24.0K 0% /dev/shm
    /dev/vdb1 2.0G 35.0M 1.8G 2% /junk

    DonMcL

    October 7, 2011 at 7:41 pm


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: