Hyper Open Edge Cloud

Supporting mutliple attached storage with SlapOS

This document details support of multiple attached storage with SlapOS
  • Last Update:2017-12-21
  • Version:001
  • Language:en

Supporting multiple attached storage with SlapOS

The goal of this document is to explain how to mount additional storage disks and use them directly from your slapos partitions.

Table of Contents

Introduction

Even if it is easier today to have a powerfull server with a large disk in most of cloud server, it is common to need an additional storage which can help for example for backup of some  important data or in Big Data projets, to store some extra data like logs files which some time can consume a very large space on disk. Another case is to attach multi storage to reduce I/O load. If we run a virtual machine on SlapOS server which require more than one virtual disk (one system disk, and many data disks for a Cloudera data node), attaching storage to SlapOS will allow to create one virtual disk per physical disk storage. The more we will have virtual disks on a single physical disk, the more we will increase the I/O load on the server.

SlapOS now offer the capacity to attach one or more disk storage to the server and make them accessible to services running inside the partitions.

In the next step, we consider that SlapOS Node package is already installed on our server. To learn more about how to install SlapOS please follow this link: Installing SlapoS Node from Package

Mount and configure disks

Once you have we have our disk plugged to the server, we need to mount and prepare it for SlapOS. For this example, we suppose we have two disk, /dev/sdb1 and /dev/sdc1 and we want to use them in to extend our partition. The disk will be formatted exactly like a normal SlapOS partition is formatted then, all deployed instances will to access storage disks directly from their partition folder. Here are the steps to configure the disks:

Create the base storage folder called /data where all disks will be mounted. It's possible to use any other path.

mkdir /data

Create dataX folder for each of storage to mount into our storage folder.  Base storage folder should contains folders with name dataX where X is an integer. So we will create data1 and data2 for our two disks.

mkdir /data/data1 /data/data2

We mount the disks

mount -t ext2 /dev/sdb1 /data/data1
mount -t ext2 /dev/sbc1 /data/data2

In case of server reboot, we want to auto remount storage.

# vim /etc/fstab
UUID=STORAGE_SDB1_UUID              /data/data1                ext2    default    0 2
UUID=STORAGE_SDC1_UUID              /data/data2                ext2    default    0 2

Value STORAGE_SDB1_UUID and STORAGE_SDC1_UUID can be found by executing the command blkid.

Enable support for attached storage

After the disk is correctly mounted, we now need to tell to SlapOS where to search attached storage disk. We will do this by editing configuration in /etc/opt/slapos/slapos.cfg, then we set instance_storage_home option in the section slapos to the base storage folder.

# vim /etc/opt/slapos/slapos.cfg
[slapos]
...
instance_storage_home = /data

Format storage partition using slapos format command

Now we will run slapos format to configure attached storage.

slapos node format --now -v

Storage /data/dataX now contain new folders created and managed by slapos, each folder will be linked to slapos partitions when instances will be deployed. The recipe can access all those folder and use them to store files or any others datas.

# ls /data/data2/
total 120
drwxr-x--- 2 slapuser0  slapuser0  4096 Mar 23  2015 slappart0
drwxr-x--- 2 slapuser1  slapuser1  4096 Mar 23  2015 slappart1
drwxr-x--- 2 slapuser10 slapuser10 4096 Nov  7 02:29 slappart10
drwxr-x--- 2 slapuser11 slapuser11 4096 Nov  7 02:29 slappart11
... 

Each partition will have one additional a new folder called DATA which contains all mounted disk (data1 and data2), instances can use them as part of their partition file system

# ls -l /srv/slapgrid/slappart19/
total 96
drwxr-x--- 2 slapuser19 slapuser19  4096 Jun 15 14:10 bin
-rw-r----- 1 root       slapuser19  9376 Nov  8 12:24 buildout.cfg
-rw-r----- 1 slapuser19 slapuser19  8282 Nov  8 12:24 buildout-switch-softwaretype.cfg
drwx------ 2 slapuser19 slapuser19  4096 Jun 15 14:10 DATA
...

The folder DATA also contains all mounted data folders:

# ls -l /srv/slapgrid/slappart19/DATA/*/
/srv/slapgrid/slappart19/DATA/data1/:
total 0
/srv/slapgrid/slappart19/DATA/data2/:
total 0

Note: If the instance is destroyed, all attached storage contend will be removed when slapos will clean up the partition.

Related Articles