Skip to content

Latest commit

 

History

History
75 lines (59 loc) · 1.56 KB

devicemapper_environmental_preparation.md

File metadata and controls

75 lines (59 loc) · 1.56 KB

devicemapper environment preparation

  1. Install the lvm logical volume management package:
# apt-get install lvm2
  1. View available block devices on the host:
# lsblk
  1. Use isulad_lvm_conf.sh to configure isulad-thinpool
#sh -x isulad_lvm_conf.sh sda8

The contents of isulad_lvm_conf.sh are as follows:

#!/bin/bash
current_dir=$(cd `dirname $0` && pwd)
disk="/dev/$1"

rm -rf /var/lib/isulad/*
dmsetup remove_all
lvremove -f isulad/thinpool
lvremove -f isulad/thinpoolmeta
vgremove -f isulad
pvremove -f $disk
mount | grep $disk | grep /var/lib/isulad
if [ x"$?" == x"0" ];then
    umount /var/lib/isulad
fi
echo y | mkfs.ext4 $disk

touch /etc/lvm/profile/isulad-thinpool.profile
cat > /etc/lvm/profile/isulad-thinpool.profile <<EOF
activation {
thin_pool_autoextend_threshold=80
thin_pool_autoextend_percent=20
}
EOF
pvcreate -y $disk
vgcreate isulad $disk
echo y | lvcreate --wipesignatures y -n thinpool isulad -l 80%VG
echo y | lvcreate --wipesignatures y -n thinpoolmeta isulad -l 1%VG
lvconvert -y --zero n -c 512K --thinpool isulad/thinpool --poolmetadata isulad/thinpoolmeta
lvchange --metadataprofile isulad-thinpool isulad/thinpool
lvs -o+seg_monitor
exit 0
  1. Configure isulad

    Configure the storage-driver and storage-opts in /etc/isulad/daemon.json:

"storage-driver": "devicemapper",
"storage-opts": [
        "dm.thinpooldev=/dev/mapper/isulad-thinpool",
        "dm.fs=ext4",
        "dm.min_free_space=10%"
 ],
  1. Restart isulad.

    $ sudo systemctl restart isulad