# Disk Pools

By default Pritunl Cloud instance storage is done using Qcow2 files stored in `/var/lib/pritunl-cloud/disks` . This offers local high performance storage for instance disks. It is also currently the only mode that allows for creating pod images and instance snapshots. This is the recommended configuration for most use cases.

Alternatively LVM can be used for instance storage. Pritunl Cloud will then create logical volumes on configured LVM volume groups then directly attaches the logical volumes to instances. The primary use case for this is a shared LVM which allows disks in Pritunl Cloud to be shared between multiple hosts.

Once a shared LVM has been configured on multiple hosts in the same zone it can be added to Pritunl Cloud by creating a disk pool in that zone and setting the *Volume Group Name* to LVM name. The nodes in this zone will then scan for this LVM to determine what nodes have the disk pool available. The LVM does not need to be available on all nodes in the zone. **Different LVMs should never have the same, this will prevent both LVMs from being used in Pritunl Cloud.**

### Shared LVM

Shared LVMs allow using several different underlying network storage protocols. Typically in a production datacenter this would be Fibre Channel which will then have a shared LVM configured. It can also be iSCSI which is demonstrated below.

Pritunl Cloud does not depend on LVM locking or utilize exclusive LVM activation. Instead locking is coordinated by Pritunl Cloud in the database. It is still recommended to configure a shared lock as an additional protection for logical volume creation.

Below is an example of a shared LVM over iSCSI.

```sh
sudo yum -y install iscsi-initiator-utils

sudo nano /etc/iscsi/iscsid.conf
node.session.auth.authmethod = CHAP
node.session.auth.username = username
node.session.auth.password = password

sudo iscsiadm -m discovery -t st -p 10.154.0.100
sudo iscsiadm -m node
sudo iscsiadm -m node --targetname "storage.cloud" --portal "10.154.0.100:3260" --login

sudo dnf install lvm2-lockd sanlock

sudo nano /etc/lvm/lvm.conf
use_lvmlockd = 1
system_id_source = "lvmlocal"

sudo nano /etc/lvm/lvmlocal.conf
local {
    system_id = "cloud0"
    host_id = 100
}

sudo nano /etc/lvm/lvmlocal.conf
local {
    system_id = "cloud1"
    host_id = 101
}

sudo systemctl enable lvmlockd wdmd sanlock

sudo reboot

sudo systemctl status lvmlockd wdmd sanlock

sudo vgcreate --shared cloud /dev/disk/by-id/scsi-c18f3d7b-part1
sudo vgchange --lock-start cloud

# Create test LV
sudo lvcreate -an -L1G -n test cloud
sudo lvchange -ay cloud/test
sudo mkfs.xfs /dev/mapper/cloud-test
sudo mkdir /mnt/test
sudo mount /dev/mapper/cloud-test /mnt/test
sudo umount /mnt/test
sudo lvchange -an cloud/test
sudo lvremove cloud/test
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.pritunl.com/kb/cloud/components/pools.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
