Questo contenuto non è disponibile nella lingua selezionata.
12.3.3. Creating a Directory-based Storage Pool with virsh
Create the storage pool definition
Use thevirsh pool-define-as
command to define a new storage pool. There are two options required for creating directory-based storage pools:- The
name
of the storage pool.This example uses the name guest_images. All furthervirsh
commands used in this example use this name. - The
path
to a file system directory for storing guest image files. If this directory does not exist,virsh
will create it.This example uses the /guest_images directory.
virsh pool-define-as guest_images dir - - - - "/guest_images"
# virsh pool-define-as guest_images dir - - - - "/guest_images" Pool guest_images defined
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Verify the storage pool is listed
Verify the storage pool object is created correctly and the state reports it asinactive
.virsh pool-list --all
# virsh pool-list --all Name State Autostart ----------------------------------------- default active yes guest_images inactive no
Copy to Clipboard Copied! Toggle word wrap Toggle overflow Create the local directory
Use thevirsh pool-build
command to build the directory-based storage pool for the directory guest_images (for example), as shown:Copy to Clipboard Copied! Toggle word wrap Toggle overflow Start the storage pool
Use the virsh commandpool-start
to enable a directory storage pool, thereby allowing allowing volumes of the pool to be used as guest disk images.Copy to Clipboard Copied! Toggle word wrap Toggle overflow Turn on autostart
Turn onautostart
for the storage pool. Autostart configures thelibvirtd
service to start the storage pool when the service starts.Copy to Clipboard Copied! Toggle word wrap Toggle overflow Verify the storage pool configuration
Verify the storage pool was created correctly, the size is reported correctly, and the state is reported asrunning
. If you want the pool to be accessible even if the guest virtual machine is not running, make sure thatPersistent
is reported asyes
. If you want the pool to start automatically when the service starts, make sure thatAutostart
is reported asyes
.Copy to Clipboard Copied! Toggle word wrap Toggle overflow
A directory-based storage pool is now available.