StoragePool document, and Talos creates it in libvirt as a directory on a Talos volume.
This page shows how to create a storage pool, check its status, and change or remove it.
The host needs the libvirtd system extension, whose ext-virtstoraged service manages storage pools. To install it, see Install a hypervisor host.
In the commands on this page, replace <host-ip> with the IP address of the host.
Create a storage pool
A storage pool is stored on a Talos volume. The volume is declared in its own document, using one of these types:- A
UserVolumeConfig, for a directory, partition, or disk on the host. - An
ExistingVolumeConfig, for a volume that already exists on the host. - An
ExternalVolumeConfig, for a volume mounted from outside the host, such as an NFS export. NFS support was added in Talos Linux v1.15.
- It must be writable and have a filesystem.
- It can back only one storage pool. Each storage pool and each content library needs its own volume.
-
Run the following command to create
storage-pool.yaml, which declares a directory volume namedvm-disksand a storage pool namedpool1that uses it:Thevolume.namefield names the volume the pool uses.The pool’snamecan be up to 63 characters long and must start with a letter or digit. It can contain only ASCII letters, digits, hyphens, and underscores. -
Apply the documents to the host:
-
Check that the pool is ready:
Talos reports each pool’s state in a
StoragePoolStatusresource, with the following columns:PHASEisreadyonce the pool is defined and active in libvirt.TARGETis the pool’s directory on the host.ERRORexplains why a pool is not ready.VOLUMEis the backing volume’s ID, which Talos derives from its name. For example, aUserVolumeConfignamedvm-diskshas the IDu-vm-disks.
Change a storage pool’s volume
To point a pool at a different volume, change itsvolume.name and apply the change to the host. Talos then uses a directory on the new volume for the pool.
Disk files in the old directory are not moved. A virtual machine disk in the pool gets a new, empty file on the new volume, and its data stays on the old volume.
The change waits until no running virtual machine uses the pool. Until then, the pool’s PHASE is notReady, and its ERROR says that the pool is held.
The following steps point pool1 at a new directory volume named vm-disks-2.
-
Run the following command to create
storage-pool-new-volume.yaml, which declares the new volume and pointspool1at it: -
Apply the documents to the host:
-
Check that the pool uses the new volume:
The
VOLUMEcolumn showsu-vm-disks-2, andPHASEshowsreadyonce the pool is active on the new volume.
Remove a storage pool
Removing a pool stops it and removes it from libvirt. The pool’s files and its volume are not deleted, so its data stays on the volume. A pool cannot be removed while a virtual machine disk uses it. The patch that removes the pool must also remove those virtual machines, or change their disks to use a different pool. The following steps remove thepool1 storage pool.
-
Run the following command to create
storage-pool-delete.yaml, a patch that deletes thepool1document: -
Apply it to the host:
-
Check that
pool1no longer appears in the output: