Skip to content
This repository has been archived by the owner on Nov 17, 2022. It is now read-only.

Create and Destroy

hse-project edited this page Apr 21, 2020 · 1 revision

The following examples demonstrate creating, viewing, and destroying mpools.

Capacity Media Class Only

Create an mpool named mp1 with only the required capacity media class using a striped logical volume created in vg_nvmeSSD.

This creates an mpool device file /dev/mpool/<mpool name>. Mpool uses the standard Linux security model whereby each mpool has an owner (UID), group owner (GID), and mode bits controlling access. In this example, jdoe is used for the UID and GID.

$ sudo lvcreate -L 1TB -i 2 -I 64 -n mp1_capacity vg_nvmeSSD
$ sudo mpool create mp1 /dev/vg_nvmeSSD/mp1_capacity uid=jdoe gid=jdoe mode=0600

You can now view information about the mpool using the mpool CLI, and see it in the device file namespace.

$ sudo mpool list
MPOOL    TOTAL    USED   AVAIL  CAPACITY  LABEL    HEALTH
mp1      1.00t   1.16g    972g     0.12%    raw   optimal

$ ls -l /dev/mpool
crw------- 1 jdoe jdoe 238, 1 Mar 26 16:50 mp1

More detailed information about the mpool is available with the verbose and YAML output options.

When creating an mpool, you can specify the media block (mblock) size for a media class. The mblock size is the block object allocation unit, where valid values are powers of two from 1MB to 64MB, with 32MB as the default.

Create a second mpool mp2 with only the required capacity media class, using a striped logical volume created in vg_sataSSD comprising value-oriented SATA QLC SSDs. Specify an mblock size for the capacity media class of 16MB.

$ sudo lvcreate -L 1TB -i 2 -I 64 -n mp2_capacity vg_sataSSD
$ sudo mpool create mp2 /dev/vg_sataSSD/mp2_capacity capsz=16 uid=jdoe gid=jdoe mode=0660

$ sudo mpool list
MPOOL    TOTAL    USED   AVAIL  CAPACITY  LABEL    HEALTH
mp1      1.00t   1.16g    972g     0.12%    raw   optimal
mp2      1.00t    624m    972g     0.06%    raw   optimal

$ ls -l /dev/mpool
total 0
crw------- 1 jdoe jdoe 238, 1 Mar 26 16:50 mp1
crw-rw---- 1 jdoe jdoe 238, 2 Mar 26 16:50 mp2

Capacity and Staging Media Classes

Add a staging media class to the mpool mp2 using a striped logical volume created in vg_nvmeSSD comprising high-end NVMe TLC SSDs. Specify an mblock size for the staging media class of 8MB. The mpool mp2 could also have been created with both a capacity and staging media class.

$ sudo lvcreate -L 200GB -i 2 -I 64 -n mp2_staging vg_nvmeSSD
$ sudo mpool add mp2 stgdev=/dev/vg_nvmeSSD/mp2_staging stgsz=8

$ sudo mpool list
MPOOL    TOTAL    USED   AVAIL  CAPACITY  LABEL    HEALTH
mp1      1.00t   1.16g    972g     0.12%    raw   optimal
mp2      1.20t    632m   1.13t     0.05%    raw   optimal

The additional capacity from adding the staging media class is reflected in the total capacity of the mp2 mpool.

Note that you cannot remove a media class once added.

Destroy

Create and immediately destroy the mpool mp3, and free the logical volume used for its capacity media class.

$ sudo lvcreate -L 100GB -i 2 -I 64 -n mp3_capacity vg_nvmeSSD
$ sudo mpool create mp3 /dev/vg_nvmeSSD/mp3_capacity uid=jdoe gid=jdoe mode=0600

$ sudo mpool list
MPOOL    TOTAL    USED   AVAIL  CAPACITY  LABEL    HEALTH
mp1      1.00t   1.16g    972g     0.12%    raw   optimal
mp2      1.20t    632m   1.13t     0.05%    raw   optimal
mp3       100g   1.16g     94g     1.22%    raw   optimal

$ ls -l /dev/mpool
total 0
crw------- 1 jdoe jdoe 238, 1 Mar 26 16:50 mp1
crw-rw---- 1 jdoe jdoe 238, 2 Mar 26 16:50 mp2
crw------- 1 jdoe jdoe 238, 3 Mar 26 16:56 mp3

$ sudo mpool destroy mp3
$ sudo lvremove /dev/vg_nvmeSSD/mp3_capacity

$ sudo mpool list
MPOOL    TOTAL    USED   AVAIL  CAPACITY  LABEL    HEALTH
mp1      1.00t   1.16g    972g     0.12%    raw   optimal
mp2      1.20t    632m   1.13t     0.05%    raw   optimal


$ ls -l /dev/mpool
total 0
crw------- 1 jdoe jdoe 238, 1 Mar 26 16:50 mp1
crw-rw---- 1 jdoe jdoe 238, 2 Mar 26 16:50 mp2