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-ascommand to define a new storage pool. There are two options required for creating directory-based storage pools:- The
nameof the storage pool.This example uses the name guest_images. All furthervirshcommands used in this example use this name. - The
pathto a file system directory for storing guest image files. If this directory does not exist,virshwill 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 definedCopy 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 noCopy to Clipboard Copied! Toggle word wrap Toggle overflow Create the local directory
Use thevirsh pool-buildcommand 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-startto 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 onautostartfor the storage pool. Autostart configures thelibvirtdservice 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 thatPersistentis reported asyes. If you want the pool to start automatically when the service starts, make sure thatAutostartis reported asyes.Copy to Clipboard Copied! Toggle word wrap Toggle overflow
A directory-based storage pool is now available.