...
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
Note the UUID of the new "vol_01".
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
Note the UUID of the new "vol_02".
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
You may continue repeating these steps, but be aware that Volume Affinity is limited to only two "different_host" options.
...
Create an instance.
Create four 100 GB cinder volumes. You may use Volume Affinity to create the volumes (see the Volume Affinity section), though this is optional.
Attach the volumes to the instance.
At this time, find out what device names each volume was given by the operating system:
$ lsblk
...
Code Block $ lsblk
(the volumes will most likely be given sequential names e.g.
/dev/sdc
,/dev/sdd
, etc)
...
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.
...
Code Block $ sudo sed -i "s/\/dev\/sdb/$(blkid | grep sdb | awk '{print $2}')/g" /etc/fstab
...
- Partition and create a filesystem on each attached volume (devices
/dev/sdc
through/dev/sdf
)
...
Create the array
...
:
Code Block $ sudo mdadm --create /dev/md0 --level=6 --raid-devices=4 /dev/sdc1 /dev/sdd1 /dev/sde1 /dev/sdf1
...
Create a mdadm.conf file with the array UUID for recovery (see below for more).
...
Code Block $ sudo mdadm
...
--detail --scan | sudo tee -a /etc/mdadm/mdadm.conf
Assembling a previously created array
...
This example is a continuation of the above example.
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.Check the status of the array:
...
Code Block $ cat /proc/mdstat
...
This should show something like this:
...
Personalities :
...
Code Block Personalities : md127 : inactive
...
sdf1[3](S) sde1[2](S) sdd1[1](S) sdc1[0](S)
...
314373120 blocks super 1.2 unused devices: <none>
Start the array:
Code Block $ sudo mdadm --manage /dev/md127
314373120 blocks super 1.2
unused devices: <none>
3. Start the array:
...
-R