Configuring storage in Openstack

Configuring storage in Openstack:

An OpenStack object storage is a multi-tenant object storage system. As OpenStack Object Storage is designed to be highly extensible (manages large amounts of unstructured data very economically) and redundant and is usually installed across multiple nodes. Our test environment will have only one node, but OpenStack Object Storage still expects multiple destinations on our storage to replicate its data so we need to configure this appropriately for our test setup.

We will end up with four directories on our OpenStack Object Storage server specified as /srv/1-4, which points to directories on our new disk. The result is an OpenStack Object Storage setup that looks like it has four other Open Stack Object Storage nodes to replicate data to.

Getting started

Assure that you are logged in to your swift virtual machine. To accomplish this, run:

vagrant ssh swift

How to achieve it…

To configure our OpenStack Object Storage host, carry out the following steps:


If you are using VMware Fusion, you will need to power the virtual machine down and add a second disk by hand.

1.We first create a new partition on our extra disk. This extra       disk is seen as /dev/sdb, under Linux installation.

          sudo fdisk /dev/sdb
  1. Once in fdisk, use the following key presses to create a new partition:
          n p 1
          enter enter w

Once it is finished with the above key processes , it must look like this :

vagrant@swift:~$ sudo fdisk /dev/sdb
Command (m for help): p
Disk /dev/sdb: 2147.5 GB, 2147483648000 bytes 4194304000
89 heads, 61 sectors/track, 772573 cylinders, total
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x1948d96f End Blocks Id System
Device Boot Start
/dev/sdb1 2048  4194303999 2097150976 83 Linux
  1. To get Linux to see this new partition without rebooting, run partprobe to reread the disk layout.
             sudo partprobe
  1. Once completed, we can create our filesystem. For this, we shall use the XFS filesystem, as follows:
             sudo mkfs.xfs -i size=1024 /dev/sdb1
  1. We can now create the required mount point and set up fstab to allow us to mount this new area, as shown:
              sudo mkdir /mnt/sdb1
  1. Then, edit /etc/fstab to add in the following contents:
              /dev/sdb1 /mnt/sdb1 xfs   noatime,nodiratime,nobarrier,logbufs=8 0 0
  1. We can now mount this area, as follows:
             sudo mount /dev/sdb1
  1. Once done, we can create the required file structure, as follows:
sudo mkdir
sudo chown
swift:swift /mnt/sdb1/*
ln -s
/mnt/sdb1/{1..4} /srv
-p /etc/swift/{object-server,container-server,account-
for S in {1..4}; do sudo mkdir -p /srv/${S}/node/sdb${S}; done sudo mkdir -p /var/run/swift
sudo chown -R swift:swift /etc/swift /srv/{1..4}/
  1. To ensure OpenStack Storage to always start on boot, add the following commands to /etc/rc.local, before the line exit 0:
            mkdir -p /var/run/swiftchown swift:swift /var/run/swift

How it works…

We first created a new partition on our extra disk and formatted this with the XFS filesystem. XFS is very good at handling large objects and has the necessary extended attributes (xattr) required for the objects in this filesystem.

Once created, we mount this area, and then begin to create the directory structure. The commands to create the directories and required symbolic links includes a lot of bash shorthand, such as {1..4}. This shorthand essentially prints out 1 2 3 4 when expanded, but repeats the preceding attached text when it does so. Take for example the following piece of code:

mkdir /mnt/sdb1/{1..4}

It is the equivalent of:

mkdir /mnt/sdb1/1 /mnt/sdb1/2 /mnt/sdb1/3 /mnt/sdb1/4

The effect of that short piece of code is the following directory structure:

/etc/swift /object-server /container-server /account-server

/mnt/sdb1 /srv/1
/2 /srv/2
/3 /srv/3
/4 /srv/4






What we have done is set up a filesystem that will configure to replicate data into different device directories to mimic the actions and features an OpenStack Object Storage requires. In production, these device directories would actually be physical servers and physical devices on the servers and won’t necessarily have this directory structure, rather what we have built simulates this to demonstrate a working swift environment.


  Enroll for Instructor Led Live OpenStack Training

0 Responses on Configuring storage in Openstack"

Leave a Message

Your email address will not be published. Required fields are marked *

Copy Rights Reserved © Mindmajix.com All rights reserved. Disclaimer.