<a id="howto-storage-pools"></a>

# How to manage storage pools

See the following sections for instructions on how to create, configure, view, and resize [Storage pools](https://canonical.com/lxd/docs/latest/explanation/storage/index.html.md#storage-pools).

<a id="howto-storage-pools-view"></a>

## View storage pools

You can display a list of all available storage pools and check their configuration.

CLI

To list all available storage pools, run:

```none
lxc storage list
```

The storage pool created during initialization is usually called `default` or `local`.

To show detailed information about a specific pool, run:

```none
lxc storage show <pool_name>
```

To see usage information for a specific pool, run:

```none
lxc storage info <pool_name>
```

UI

To view storage pools in the UI, select Pools from the Storage section of the main navigation. Select a pool from the list for detailed information.

<a id="howto-storage-pools-create"></a>

## Create a storage pool

LXD creates a storage pool during initialization. You can add more storage pools later, using the same or different driver. See the [Storage drivers](https://canonical.com/lxd/docs/latest/reference/storage_drivers/index.html.md#storage-drivers) documentation to learn about available configuration options for each driver.

By default, LXD sets up loop-based storage with a sensible default size/quota: 20% of the free disk space, with a minimum of 5 GiB and a maximum of 30 GiB.

When using a Ceph storage driver, first see the [Requirements for Ceph-based storage pools](#howto-storage-pools-ceph-requirements) section below.

CLI

To create a storage pool, run:

```none
lxc storage create <pool_name> <driver> [configuration_options...]
```

See the [Storage drivers](https://canonical.com/lxd/docs/latest/reference/storage_drivers/index.html.md#storage-drivers) documentation for a list of available configuration options for each driver.

UI

To create a storage pool, select Pools from the Storage section of the main navigation, then click Create pool. On the resulting screen, the Name and Driver fields are required.

Once you select a driver, the fields below the driver selection dropdown might change. Furthermore, some drivers also offer a secondary settings page, as shown in the example below for the ZFS driver:

![Storage pool options for driver ZFS in LXD-UI](images/storage/storage_pools_create_ZFS_driver.png)

After creating a storage pool, [back up its configuration](#howto-storage-pools-config-backup) for future recovery.

<a id="howto-storage-pools-create-examples"></a>

### Examples

The following CLI syntax examples show how to create a storage pool using different storage drivers.

dir

Create a directory pool named `pool1`:

```none
lxc storage create pool1 dir
```

Use the existing directory `/data/lxd` for `pool2`:

```none
lxc storage create pool2 dir source=/data/lxd
```

btrfs

Create a loop-backed pool named `pool1`:

```none
lxc storage create pool1 btrfs
```

You can specify `source` as either an existing filesystem path or a block device.

Reuse the existing Btrfs filesystem at `/some/path` for `pool2`:

```none
lxc storage create pool2 btrfs source=/some/path
```

Use a block device at `/dev/sdX` to create `pool3`:

```none
lxc storage create pool3 btrfs source=/dev/sdX
```

lvm

Create a loop-backed pool named `pool1` (the LVM volume group will also be called `pool1`):

```none
lxc storage create pool1 lvm
```

Use an existing LVM volume group called `my-pool` for `pool2`:

```none
lxc storage create pool2 lvm source=my-pool
```

Use an existing LVM thin pool called `my-pool` in volume group `my-vg` for `pool3`:

```none
lxc storage create pool3 lvm source=my-vg lvm.thinpool_name=my-pool
```

Create a pool named `pool4` on `/dev/sdX` (the LVM volume group will also be called `pool4`):

```none
lxc storage create pool4 lvm source=/dev/sdX
```

Create a pool named `pool5` on `/dev/sdX` with the LVM volume group name `my-pool`:

```none
lxc storage create pool5 lvm source=/dev/sdX lvm.vg_name=my-pool
```

zfs

Create a loop-backed pool named `pool1` (the ZFS zpool will also be called `pool1`):

```none
lxc storage create pool1 zfs
```

Create a loop-backed pool named `pool2` with the ZFS zpool name `my-tank`:

```none
lxc storage create pool2 zfs zfs.pool_name=my-tank
```

Use the existing ZFS zpool `my-tank` for `pool3`:

```none
lxc storage create pool3 zfs source=my-tank
```

Use the existing ZFS dataset `my-tank/slice` for `pool4`:

```none
lxc storage create pool4 zfs source=my-tank/slice
```

Use the existing ZFS dataset `my-tank/zvol` for `pool5` and configure it to use ZFS block mode:

```none
lxc storage create pool5 zfs source=my-tank/zvol volume.zfs.block_mode=yes
```

Create a pool named `pool6` on `/dev/sdX` (the ZFS zpool will also be called `pool6`):

```none
lxc storage create pool6 zfs source=/dev/sdX
```

Create a pool named `pool7` on `/dev/sdX` with the ZFS zpool name `my-tank`:

```none
lxc storage create pool7 zfs source=/dev/sdX zfs.pool_name=my-tank
```

ceph\*

For Ceph-based storage pools, first see the [Requirements for Ceph-based storage pools](#howto-storage-pools-ceph-requirements).

### Ceph RBD

Create an OSD storage pool named `pool1` in the default Ceph cluster (named `ceph`):

```none
lxc storage create pool1 ceph
```

Create an OSD storage pool named `pool2` in the Ceph cluster `my-cluster`:

```none
lxc storage create pool2 ceph ceph.cluster_name=my-cluster
```

Create an OSD storage pool named `pool3` with the on-disk name `my-osd` in the default Ceph cluster:

```none
lxc storage create pool3 ceph ceph.osd.pool_name=my-osd
```

Use the existing OSD storage pool `my-already-existing-osd` for `pool4`:

```none
lxc storage create pool4 ceph ceph.osd.pool_name=my-already-existing-osd
```

Use the existing OSD erasure-coded pool `ecpool` and the OSD replicated pool `rpl-pool` for `pool5`:

```none
lxc storage create pool5 ceph ceph.osd.pool_name=rpl-pool ceph.osd.data_pool_name=ecpool
```

### Create a CephFS pool

#### NOTE
Each CephFS file system consists of two OSD storage pools, one for the actual data and one for the file metadata.

Use the existing CephFS file system `my-filesystem` for `pool1`:

```none
lxc storage create pool1 cephfs cephfs.path=my-filesystem
```

Use the sub-directory `my-directory` from `my-filesystem` for `pool2`:

```none
lxc storage create pool2 cephfs cephfs.path=my-filesystem/my-directory
```

Create a CephFS file system `my-filesystem` with a data pool called `my-data` and a metadata pool called `my-metadata` for `pool3`:

```none
lxc storage create pool3 cephfs cephfs.path=my-filesystem cephfs.create_missing=true cephfs.data_pool=my-data cephfs.meta_pool=my-metadata
```

### Ceph Object

A RADOS Gateway endpoint is required for a [Ceph Object](https://canonical.com/lxd/docs/latest/reference/storage_cephobject/index.html.md#storage-cephobject) storage pool. See: [Ceph Object and radosgw](#howto-storage-pools-ceph-requirements-radosgw).

For a non-clustered LXD server, create `pool1` by passing in a Ceph Object Gateway endpoint (the endpoint shown below is only an example; you must use your own):

```none
lxc storage create pool1 cephobject cephobject.radosgw.endpoint=http://192.0.2.10:8080
```

If your LXD server is clustered, such as in a [MicroCloud](https://canonical.com/microcloud) deployment, see: [Create a storage pool in a cluster](#howto-storage-pools-create-cluster).

powerflex

Create a storage pool named `pool1` using the PowerFlex pool `sp1` in the protection domain `pd1`:

```none
lxc storage create pool1 powerflex powerflex.pool=sp1 powerflex.domain=pd1 powerflex.gateway=https://powerflex powerflex.user.name=lxd powerflex.user.password=foo
```

Create a storage pool named `pool2` using the ID of PowerFlex pool `sp1`:

```none
lxc storage create pool2 powerflex powerflex.pool=<ID of sp1> powerflex.gateway=https://powerflex powerflex.user.name=lxd powerflex.user.password=foo
```

Create a storage pool named `pool3` that uses PowerFlex volume snapshots (see [Limitations](https://canonical.com/lxd/docs/latest/reference/storage_powerflex/index.html.md#storage-powerflex-limitations)) when creating volume copies:

```none
lxc storage create pool3 powerflex powerflex.snapshot_copy=true powerflex.pool=<id of sp1> powerflex.gateway=https://powerflex powerflex.user.name=lxd powerflex.user.password=foo
```

Create a storage pool named `pool4` that uses a PowerFlex gateway with a certificate that is not trusted:

```none
lxc storage create pool4 powerflex powerflex.gateway.verify=false powerflex.pool=<id of sp1> powerflex.gateway=https://powerflex powerflex.user.name=lxd powerflex.user.password=foo
```

Create a storage pool named `pool5` that explicitly uses the PowerFlex SDC:

```none
lxc storage create pool5 powerflex powerflex.mode=sdc powerflex.pool=<id of sp1> powerflex.gateway=https://powerflex powerflex.user.name=lxd powerflex.user.password=foo
```

powerstore

Create a storage pool named `pool1` that uses NVMe/TCP by default:

```none
lxc storage create pool1 powerstore powerstore.gateway=https://powerstore powerstore.user.name=lxd powerstore.user.password=foo
```

Create a storage pool named `pool2` that uses a PowerStore gateway with a certificate that is not trusted:

```none
lxc storage create pool2 powerstore powerstore.gateway=https://powerstore powerstore.gateway.verify=false powerstore.user.name=lxd powerstore.user.password=foo
```

Create a storage pool named `pool3` that uses iSCSI to connect to PowerStore array:

```none
lxc storage create pool3 powerstore powerstore.mode=iscsi powerstore.gateway=https://powerstore powerstore.user.name=lxd powerstore.user.password=foo
```

Create a storage pool named `pool4` that uses SCSI/FC to connect to PowerStore array:

```none
lxc storage create pool4 powerstore powerstore.mode=scsi/fc powerstore.gateway=https://powerstore powerstore.user.name=lxd powerstore.user.password=foo
```

Create a storage pool named `pool5` that uses NVMe/FC to connect to PowerStore array:

```none
lxc storage create pool5 powerstore powerstore.mode=nvme/fc powerstore.gateway=https://powerstore powerstore.user.name=lxd powerstore.user.password=foo
```

Create a storage pool named `pool6` that uses NVMe/TCP to connect to PowerStore array via specific target addresses:

```none
lxc storage create pool6 powerstore powerstore.mode=nvme/tcp powerstore.gateway=https://powerstore powerstore.user.name=lxd powerstore.user.password=foo powerstore.target=<target_address_1>,<target_address_2>
```

pure

Create a storage pool named `pool1` that uses NVMe/TCP by default:

```none
lxc storage create pool1 pure pure.gateway=https://<pure-storage-address> pure.api.token=<pure-storage-api-token>
```

Create a storage pool named `pool2` that uses a Pure Storage gateway with a certificate that is not trusted:

```none
lxc storage create pool2 pure pure.gateway=https://<pure-storage-address> pure.gateway.verify=false pure.api.token=<pure-storage-api-token>
```

Create a storage pool named `pool3` that uses iSCSI to connect to Pure Storage array:

```none
lxc storage create pool3 pure pure.gateway=https://<pure-storage-address> pure.api.token=<pure-storage-api-token> pure.mode=iscsi
```

Create a storage pool named `pool4` that uses NVMe/TCP to connect to Pure Storage array via specific target addresses:

```none
lxc storage create pool4 pure pure.gateway=https://<pure-storage-address> pure.api.token=<pure-storage-api-token> pure.mode=nvme/tcp pure.target=<target_address_1>,<target_address_2>
```

alletra

Create a storage pool named `pool1` that uses NVMe/TCP by default:

```none
lxc storage create pool1 alletra alletra.wsapi=https://<alletra-storage-address> alletra.user.name=<alletra-storage-username> alletra.user.password=<alletra-storage-password>
```

Create a storage pool named `pool2` that uses a HPE Alletra gateway with a certificate that is not trusted:

```none
lxc storage create pool2 alletra alletra.wsapi=https://<alletra-storage-address> alletra.wsapi.verify=false alletra.user.name=<alletra-storage-username> alletra.user.password=<alletra-storage-password>
```

Create a storage pool named `pool3` that uses NVMe/TCP to connect to HPE Alletra array via specific target addresses:

```none
lxc storage create pool3 alletra alletra.wsapi=https://<alletra-storage-address> alletra.user.name=<alletra-storage-username> alletra.user.password=<alletra-storage-password> alletra.mode=nvme/tcp alletra.target=<target_address_1>,<target_address_2>
```

<a id="howto-storage-pools-create-cluster"></a>

## Create a storage pool in a cluster

If you want to add a storage pool to a LXD cluster, you must create the storage pool for each cluster member separately. This is because the configuration might differ among cluster members (for example, the storage location or the size of the pool).

If any cluster members use disks that already contain a LXD storage pool, or you want to recover an existing remote storage pool, refer to the [Recover a storage pool](#howto-storage-pools-recover) section.

CLI

To create a storage pool via the CLI, start by creating a pending storage pool on each member with the `--target=<cluster_member>` flag and the appropriate configuration for the member.

Make sure to use the same storage pool name for all members. Then create the storage pool *without* specifying the `--target` flag to actually set it up.

For further details, see [How to configure storage for a cluster](https://canonical.com/lxd/docs/latest/howto/cluster_config_storage/index.html.md#howto-cluster-storage).

UI

Follow the same method to [create a storage pool](#howto-storage-pools-create) as for a non-clustered LXD server.

Depending on the selected driver, some settings can be configured per cluster member or applied globally to the cluster, as shown in the example below for the ZFS driver:

![Create a storage pool in a clustered LXD environment](images/storage/storage_pools_create_clustered_pool.png)

After creating a storage pool, [back up its configuration](#howto-storage-pools-config-backup) for future recovery.

<a id="howto-storage-pools-create-cluster-examples"></a>

### Examples

The following CLI syntax examples show how to create a storage pool in a cluster using different storage drivers.

zfs

Create a storage pool named `my-pool` using the ZFS driver at different locations and with different sizes on three cluster members:

`user@host:~$ ``lxc storage create my-pool zfs source=/dev/sdX size=10GiB --target=vm01`
```text
Storage pool my-pool pending on member vm01
```

`user@host:~$ ``lxc storage create my-pool zfs source=/dev/sdX size=15GiB --target=vm02`
```text
Storage pool my-pool pending on member vm02
```

`user@host:~$ ``lxc storage create my-pool zfs source=/dev/sdY size=10GiB --target=vm03`
```text
Storage pool my-pool pending on member vm03
```

`user@host:~$ ``lxc storage create my-pool zfs`
```text
Storage pool my-pool created
```

ceph\*

For Ceph-based storage pools, first see the [Requirements for Ceph-based storage pools](#howto-storage-pools-ceph-requirements).

### Ceph RBD

Create a storage pool named `my-ceph-pool` using the [Ceph RBD driver](https://canonical.com/lxd/docs/latest/reference/storage_ceph/index.html.md#storage-ceph) and the on-disk name `my-osd` on three cluster members.
Because the [`ceph.osd.pool_name`](https://canonical.com/lxd/docs/latest/reference/storage_ceph/index.html.md#storage-ceph-pool-conf:ceph.osd.pool_name) configuration setting isn’t member-specific, it must be set when creating the actual storage pool:

`user@host:~$ ``lxc storage create my-ceph-pool ceph --target=vm01`
```text
Storage pool my-ceph-pool pending on member vm01
```

`user@host:~$ ``lxc storage create my-ceph-pool ceph --target=vm02`
```text
Storage pool my-ceph-pool pending on member vm02
```

`user@host:~$ ``lxc storage create my-ceph-pool ceph --target=vm03`
```text
Storage pool my-ceph-pool pending on member vm03
```

`user@host:~$ ``lxc storage create my-ceph-pool ceph ceph.osd.pool_name=my-osd`
```text
Storage pool my-ceph-pool created
```

### Ceph Object

Create a storage pool named `my-cephobject-pool` using the [Ceph Object driver](https://canonical.com/lxd/docs/latest/reference/storage_cephobject/index.html.md#storage-cephobject) and a preconfigured [RADOS Gateway endpoint](#howto-storage-pools-ceph-requirements-radosgw) (the endpoint shown below is only an example):

`user@host:~$ ``lxc storage create my-cephobject-pool cephobject --target=vm01`
```text
Storage pool my-cephobject-pool pending on member vm01
```

`user@host:~$ ``lxc storage create my-cephobject-pool cephobject --target=vm02`
```text
Storage pool my-cephobject-pool pending on member vm02
```

`user@host:~$ ``lxc storage create my-cephobject-pool cephobject --target=vm03`
```text
Storage pool my-cephobject-pool pending on member vm03
```

`user@host:~$ ``lxc storage create my-cephobject-pool cephobject cephobject.radosgw.endpoint=http://192.0.2.10:8080`
```text
Storage pool my-cephobject-pool created
```

powerflex

Create a storage pool named `my-powerflex-pool` using the [Dell PowerFlex driver](https://canonical.com/lxd/docs/latest/reference/storage_powerflex/index.html.md#storage-powerflex) in SDC mode and the pool `sp1` in protection domain `pd1`:

`user@host:~$ ``lxc storage create my-powerflex-pool powerflex --target=vm01`
```text
Storage pool my-powerflex-pool pending on member vm01
```

`user@host:~$ ``lxc storage create my-powerflex-pool powerflex --target=vm02`
```text
Storage pool my-powerflex-pool pending on member vm02
```

`user@host:~$ ``lxc storage create my-powerflex-pool powerflex --target=vm03`
```text
Storage pool my-powerflex-pool pending on member vm03
```

`user@host:~$ ``lxc storage create my-powerflex-pool powerflex powerflex.mode=sdc powerflex.pool=sp1 powerflex.domain=pd1 powerflex.gateway=https://powerflex powerflex.user.name=lxd powerflex.user.password=foo`
```text
Storage pool my-powerflex-pool created
```

powerstore

Create a storage pool named `my-powerstore-pool` using the [Dell PowerStore driver](https://canonical.com/lxd/docs/latest/reference/storage_powerstore/index.html.md#storage-powerstore):

`user@host:~$ ``lxc storage create my-powerstore-pool powerstore --target=vm01`
```text
Storage pool my-powerstore-pool pending on member vm01
```

`user@host:~$ ``lxc storage create my-powerstore-pool powerstore --target=vm02`
```text
Storage pool my-powerstore-pool pending on member vm02
```

`user@host:~$ ``lxc storage create my-powerstore-pool powerstore --target=vm03`
```text
Storage pool my-powerstore-pool pending on member vm03
```

`user@host:~$ ``lxc storage create my-powerstore-pool powerstore powerstore.mode=scsi/fc powerstore.gateway=https://<powerstore-storage-address> powerstore.user.name=<admin-username> powerstore.user.password=<admin-password>`
```text
Storage pool my-powerstore-pool created
```

pure

Create a storage pool named `my-purestorage-pool` using the [Pure Storage driver](https://canonical.com/lxd/docs/latest/reference/storage_pure/index.html.md#storage-pure):

`user@host:~$ ``lxc storage create my-purestorage-pool pure --target=vm01`
```text
Storage pool my-purestorage-pool pending on member vm01
```

`user@host:~$ ``lxc storage create my-purestorage-pool pure --target=vm02`
```text
Storage pool my-purestorage-pool pending on member vm02
```

`user@host:~$ ``lxc storage create my-purestorage-pool pure --target=vm03`
```text
Storage pool my-purestorage-pool pending on member vm03
```

`user@host:~$ ``lxc storage create my-purestorage-pool pure pure.gateway=https://<pure-storage-address> pure.api.token=<pure-storage-api-token>`
```text
Storage pool my-purestorage-pool created
```

alletra

Create a storage pool named `my-alletrastorage-pool` using the [HPE Alletra driver](https://canonical.com/lxd/docs/latest/reference/storage_alletra/index.html.md#storage-alletra):

`user@host:~$ ``lxc storage create my-alletrastorage-pool alletra --target=vm01`
```text
Storage pool my-alletrastorage-pool pending on member vm01
```

`user@host:~$ ``lxc storage create my-alletrastorage-pool alletra --target=vm02`
```text
Storage pool my-alletrastorage-pool pending on member vm02
```

`user@host:~$ ``lxc storage create my-alletrastorage-pool alletra --target=vm03`
```text
Storage pool my-alletrastorage-pool pending on member vm03
```

`user@host:~$ ``lxc storage create my-alletrastorage-pool alletra alletra.wsapi=https://<alletra-storage-address> alletra.user.name=<alletra-storage-username> alletra.user.password=<alletra-storage-password>`
```text
Storage pool my-alletrastorage-pool created
```

<a id="howto-storage-pools-config-backup"></a>

## Back up storage pool configuration

To assist future [recovery](#howto-storage-pools-recover) in case a storage pool malfunctions, maintain a record of storage pools as a backup. For each pool, record the `driver` type and its `config` options shown by running:

```none
lxc storage show <pool_name>
```

The `config` options vary by driver type. Keep this record in a safe place, and update it if you [update a storage pool’s configuration](#howto-storage-pools-configure).

### For pools in a cluster

For [local storage pools](https://canonical.com/lxd/docs/latest/reference/storage_drivers/index.html.md#storage-drivers-local) in a cluster, the `source` value is member-specific and must be obtained from each cluster member. For [non-local storage pools](https://canonical.com/lxd/docs/latest/reference/storage_drivers/index.html.md#storage-drivers-nonlocal) with the `source` config option, its value is shared across all cluster members.

<a id="howto-storage-pools-recover"></a>

## Recover a storage pool

You might need to recover a storage pool when setting up a new LXD server or cluster with non-pristine storage disks, or when trying to access remote storage that was previously used by another LXD deployment.

Using recovery, you can restore instances, custom volumes, and buckets that are still located on those storage pools.

### Get storage pool configuration

Before recovering a storage pool, you need to know its original configuration: the driver type and any `config` options that differ from the default. Ideally, you have access to a record of the configuration as described in [Back up storage pool configuration](#howto-storage-pools-config-backup).

If you do not have access to this information, try alternate ways to retrieve it. If the pool is still available in the LXD database, you can use [`lxc storage show`](https://canonical.com/lxd/docs/latest/reference/manpages/lxc/storage/show/index.html.md#lxc-storage-show-md):

```none
lxc storage show <pool_name>
```

You can also try this command, which provides hints about missing storage pools and their original configuration, if such information can be discovered:

```none
lxd recover
```

See the [Storage drivers](https://canonical.com/lxd/docs/latest/reference/storage_drivers/index.html.md#storage-drivers) documentation for a list of available configuration options for each driver.

### Recover a pool

To recover a storage pool, use the [`lxc storage create`](https://canonical.com/lxd/docs/latest/reference/manpages/lxc/storage/create/index.html.md#lxc-storage-create-md) command with the `source.recover=true` flag and the pool’s original, non-default configuration options:

```none
lxc storage create <pool_name> <driver> source.recover=true [original_pool_configuration_options...]
```

<a id="howto-storage-pools-recover-examples"></a>

### Examples

The following CLI syntax examples show how to recover different types of storage pools.

dir

Recover a pool named `pool1`:

```none
lxc storage create pool1 dir source.recover=true source=/data/lxd
```

btrfs

Recover a pool named `pool1` on the existing Btrfs filesystem at `/some/path`:

```none
lxc storage create pool1 btrfs source.recover=true source=/some/path
```

Recover a pool named `pool2` on `/dev/sdX`:

```none
lxc storage create pool2 btrfs source.recover=true source=/dev/sdX
```

lvm

Recover a pool named `pool1` using the existing LVM volume group called `my-pool`:

```none
lxc storage create pool1 lvm source.recover=true source=my-pool
```

Recover a pool named `pool2` using the existing LVM thin pool called `my-pool` in volume group `my-vg`:

```none
lxc storage create pool2 lvm source.recover=true source=my-vg lvm.thinpool_name=my-pool
```

Recover a pool named `pool3` on `/dev/sdX`:

```none
lxc storage create pool3 lvm source.recover=true source=/dev/sdX
```

Recover a pool named `pool4` on `/dev/sdX` with the LVM volume group name `my-pool`:

```none
lxc storage create pool4 lvm source.recover=true source=/dev/sdX lvm.vg_name=my-pool
```

zfs

Recover a pool named `pool1` using the existing ZFS pool `my-tank`:

```none
lxc storage create pool1 zfs source.recover=true source=my-tank
```

Recover a pool named `pool2` using the existing ZFS dataset `my-tank/slice`:

```none
lxc storage create pool2 zfs source.recover=true source=my-tank/slice
```

ceph\*

For Ceph-based storage pools, first see the [Requirements for Ceph-based storage pools](#howto-storage-pools-ceph-requirements).

### Ceph RBD

Recover a pool named `pool1` using the existing OSD storage pool `my-osd`:

```none
lxc storage create pool1 ceph source.recover=true ceph.osd.pool_name=my-osd
```

Recover a pool named `pool2` using the existing OSD storage pool `my-osd` in the Ceph cluster `my-cluster`:

```none
lxc storage create pool2 ceph source.recover=true ceph.osd.pool_name=my-osd ceph.cluster_name=my-cluster
```

### CephFS

Recover a pool named `pool1` using the existing CephFS file system `my-filesystem`:

```none
lxc storage create pool1 cephfs source.recover=true cephfs.path=my-filesystem
```

Recover a pool named `pool2` using the existing sub-directory `my-directory` on the Ceph FS file system `my-filesystem`:

```none
lxc storage create pool2 cephfs source.recover=true cephfs.path=my-filesystem/my-directory
```

### Ceph Object

The Ceph Object storage driver doesn’t require providing any additional configuration for recovery.
Use the regular Ceph object pool creation command for recovery.

Ceph Object does not yet support recovery of existing buckets already present on the `radosgw`.

powerflex

You do not need to provide any additional configuration for recovery with the PowerFlex storage driver. Use the regular PowerFlex pool creation command for recovery.

This is because when creating a PowerFlex pool, LXD does not create any entities on the storage array. Instead, it uses an existing pool inside the respective protection domain.

pure

Recover a pool named `pool1` using the existing pod `pool1`:

```none
lxc storage create pool1 pure source.recover=true pure.gateway=https://<pure-storage-address> pure.api.token=<pure-storage-api-token>
```

Recover a pool named `pool2` using the existing pod `pool2` and iSCSI to connect to Pure Storage array:

```none
lxc storage create pool2 pure source.recover=true pure.gateway=https://<pure-storage-address> pure.api.token=<pure-storage-api-token> pure.mode=iscsi
```

Recover a pool named `pool3` using the existing pod `pool3` and NVMe/TCP to connect to Pure Storage array via specific target address:

```none
lxc storage create pool3 pure source.recover=true pure.gateway=https://<pure-storage-address> pure.api.token=<pure-storage-api-token> pure.mode=nvme/tcp pure.target=<target_address_1>,<target_address_2>
```

alletra

Recover a pool named `pool1` using the existing volume set `pool1`:

```none
lxc storage create pool1 alletra source.recover=true alletra.wsapi=https://<alletra-storage-address> alletra.user.name=<alletra-storage-username> alletra.user.password=<alletra-storage-password>
```

Recover a pool named `pool2` using the existing volume set `pool2` and accept a not trusted certificate of the HPE Alletra gateway:

```none
lxc storage create pool2 alletra source.recover=true alletra.wsapi=https://<alletra-storage-address> alletra.wsapi.verify=false alletra.user.name=<alletra-storage-username> alletra.user.password=<alletra-storage-password>
```

Recover a pool named `pool3` using the existing volume set `pool3` and NVMe/TCP to connect to HPE Alletra array via specific target address:

```none
lxc storage create pool3 alletra source.recover=true alletra.wsapi=https://<alletra-storage-address> alletra.user.name=<alletra-storage-username> alletra.user.password=<alletra-storage-password> alletra.mode=nvme/tcp alletra.target=<target_address_1>,<target_address_2>
```

<a id="howto-storage-pools-configure"></a>

## Configure a storage pool

See the [Storage drivers](https://canonical.com/lxd/docs/latest/reference/storage_drivers/index.html.md#storage-drivers) page for the available configuration options for each storage driver.

General keys for a storage pool (like `source`) are top-level. Driver-specific keys are namespaced by the driver name.

CLI

Use the following command to set configuration options for a storage pool:

```none
lxc storage set <pool_name> <key> <value>
```

For example, to turn off compression during storage pool migration for a `dir` storage pool, use the following command:

```none
lxc storage set my-dir-pool rsync.compression false
```

You can also edit the storage pool configuration by using the following command:

```none
lxc storage edit <pool_name>
```

UI

To configure a storage pool, select Pools from the Storage section of the main navigation.

The resulting screen shows a list of existing storage pools. Click a pool’s name to access its details.

Go to the Configuration tab. Here, you can configure settings such as the storage pool description.

After making changes, click the Save changes button. This button also displays the number of changes you have made.

We recommend that you [maintain a backup](#howto-storage-pools-config-backup) of the configuration of your storage pools for future recovery. Make sure to update this backup after your edited configuration.

<a id="howto-storage-pools-resize"></a>

## Resize a storage pool

If you need more storage, you can increase the size (quota) of your storage pool. You can only grow the pool (increase its size), not shrink it.

You can only resize loop-backed storage pools that are managed by LXD, meaning they must use the Btrfs, LVM, or ZFS storage drivers.

CLI

In the CLI, resize a storage pool by changing the `size` configuration key:

```none
lxc storage set <pool_name> size=<new_size>
```

UI

To resize a storage pool in the UI, select Pools from the Storage section of the main navigation.

Click the name of a storage pool to open its details page, then go to its Configuration tab. Edit the Size field.

After making changes, click the Save changes button. This button also displays the number of changes you have made before you save.

In clustered environments, the Size field appears as a per-member selector, allowing you to configure the size for each cluster member.

![Configuring storage pools sizes within a clustered environment.](images/storage/storage_pools_create_clustered_pool_size_config.png)

If you later need to [recover a storage pool](#howto-storage-pools-recover) and the pool has a non-default `size` configuration option, that option must be included for recovery. If needed, update the `size` in your [backup of the storage pool configuration](#howto-storage-pools-config-backup).

<a id="howto-storage-pools-ceph-requirements"></a>

## Requirements for Ceph-based storage pools

For Ceph-based storage pools, the requirements below must be met before you can [Create a storage pool](#howto-storage-pools-create) or [Create a storage pool in a cluster](#howto-storage-pools-create-cluster).

<a id="howto-storage-pools-ceph-requirements-cluster"></a>

### Ceph cluster

Before you can create a storage pool that uses the [Ceph RBD](https://canonical.com/lxd/docs/latest/reference/storage_ceph/index.html.md#storage-ceph), [CephFS](https://canonical.com/lxd/docs/latest/reference/storage_cephfs/index.html.md#storage-cephfs), or [Ceph Object](https://canonical.com/lxd/docs/latest/reference/storage_cephobject/index.html.md#storage-cephobject) driver, you must have access to a [Ceph](https://ceph.io) cluster.

To deploy a Ceph cluster, we recommend using [MicroCloud](https://snapcraft.io/microcloud). If you have completed the default MicroCloud setup, you already have a Ceph cluster deployed through MicroCeph, so this requirement is met. MicroCeph is a lightweight way of deploying and managing a Ceph cluster.

If you do not use MicroCloud, set up a standalone deployment of [MicroCeph](https://snapcraft.io/microceph) before you continue.

<a id="howto-storage-pools-ceph-requirements-radosgw"></a>

### Ceph Object and `radosgw`

Storage pools that use the [Ceph Object driver](https://canonical.com/lxd/docs/latest/reference/storage_cephobject/index.html.md#storage-cephobject) require a Ceph cluster with the RADOS Gateway (also known as RGW or `radosgw`) enabled.

<a id="howto-storage-pools-ceph-requirements-radosgw-check"></a>

#### Check if `radosgw` is already enabled

To check if the RADOS Gateway is already enabled in MicroCeph, run this command from one of its cluster members:

```none
microceph status
```

In the output, look for a cluster member with `rgw` in its `Services` list.

Example:

`root@micro1:~# ``microceph status`
```text
MicroCeph deployment summary:
- micro1 (192.0.2.10)
  Services: mds, mgr, mon, rgw, osd
  Disks: 1
- micro2 (192.0.2.20)
  Services: mds, mgr, mon, osd
  Disks: 1
```

In the output above, notice `rgw` in the list of `Services` for `micro1`. This means that this cluster member is running the RADOS Gateway.

Look for `rgw` in your output. If you do not see it, you must [Enable radosgw](#howto-storage-pools-ceph-requirements-radosgw-enable).

If you do see it, you’ll need the corresponding port number. On the cluster member with the `rgw` service, run:

```none
sudo ss -ltnp | grep radosgw
```

Example:

`root@micro1:~# ``sudo ss -ltnp | grep radosgw`
```text
LISTEN 0      4096         0.0.0.0:8080      0.0.0.0:*    users:(("radosgw",pid=11345,fd=60))
LISTEN 0      4096            [::]:8080         [::]:*    users:(("radosgw",pid=11345,fd=61))
```

The output above shows that the `radosgw` port number is `8080`.

<a id="howto-storage-pools-ceph-requirements-radosgw-enable"></a>

#### Enable `radosgw`

If you did not find `rgw` in the `Services` list for any of your cluster members in the output from `microceph status`, then you must enable the RADOS Gateway. On one of the Ceph cluster members, run:

```none
sudo microceph enable rgw --port 8080
```

We include the `--port 8080` flag because if unspecified, the default port is `80`. This default is a commonly used port number that can often cause conflicts with other services. You are not required to use `8080` — if needed, use a different port number.

<a id="howto-storage-pools-ceph-requirements-radosgw-endpoint"></a>

#### The RADOS Gateway endpoint

The full RADOS Gateway endpoint includes the HTTP protocol, the IP address of the Ceph cluster member where the `rgw` service is enabled, and the port number specified. Example: `http://192.0.2.10:8080`.
