Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Create the first volume. This example creates a 2GB volume called "vol_01": 

    Code Block
    $ cinder --os-volume-api-version 2 create --display-name vol_01 2
  2. Note the UUID of the new "vol_01".

  3. Create the second volume. This uses a scheduling "hint" that will place the volume on any storage server other than "vol_01": 

    Code Block
    $ cinder --os-volume-api-version 2 create --hint different_host=51824076-ff7e-469e-b373-b4b199fe32e9 --display-name vol_02 2


  4. Note the UUID of the new "vol_02".

  5. Create a third volume that will be placed on any storage server other than where "vol_01" and "vol_02" reside: 

    Code Block
    $ cinder --os-volume-api-version 2 create --hint different_host=51824076-ff7e-469e-b373-b4b199fe32e9 --hint different_host=b4a96d9d-b2c1-476f-a0cb-0c2f83cdb887 --display-name vol_03 2


  6. You may continue repeating these steps, but be aware that Volume Affinity is limited to only two "different_host" options.

...

  1. Create an instance.

  2. Create four 100 GB cinder volumes. You may use Volume Affinity to create the volumes (see the Volume Affinity section), though this is optional.

  3. Attach the volumes to the instance.

    1. At this time, find out what device names each volume was given by the operating system:

        $ lsblk

...

    1.  

      Code Block
      $ lsblk
    1. (the volumes will most likely be given sequential names e.g. /dev/sdc, /dev/sdd, etc)

...

  1. Edit /etc/fstab on the instance to define the swap volume by UUID instead of device name. The following one-line script will replace /dev/sdb with the UUID of the volume.

...

  1.  

    Code Block
    $ sudo sed -i "s/\/dev\/sdb/$(blkid | grep sdb | awk '{print $2}')/g" /etc/fstab

...

  1. Partition and create a filesystem on each attached volume (devices /dev/sdc through /dev/sdf)

...

  1. Create the array

...

  1. Code Block
    $ sudo mdadm --create /dev/md0 --level=6 --raid-devices=4 /dev/sdc1 /dev/sdd1 /dev/sde1 /dev/sdf1

...

  1. Create a mdadm.conf file with the array UUID for recovery (see below for more).

...

  1.  

    Code Block
    $ sudo mdadm 

...

  1. --detail --scan | sudo tee -a /etc/mdadm/mdadm.conf

Assembling a previously created array

...

This example is a continuation of the above example.

  1. Attach the volumes to the array. If this is a new instance make sure you edit /etc/fstab as step 4 in Creating the array.

  2. Check the status of the array:

...

  1.  

    Code Block
    $ cat /proc/mdstat

...

  1. This should show something like this:

...

         Personalities :

...

  1.  

    Code Block
    Personalities :
             md127 : inactive 

...

  1. sdf1[3](S) sde1[2](S) sdd1[1](S) sdc1[0](S)

...

  1. 
                               314373120 blocks super 1.2
             unused devices: <none>
  2. Start the array: 

    Code Block
    $ sudo mdadm --manage /dev/md127 

                           314373120 blocks super 1.2

         unused devices: <none>

       3. Start the array:

...

  1. -R