14.12. Storage Volume Commands This section covers all commands for creating, deleting, and managing storage volumes. It is best to do this once you have created a storage pool as the storage pool name or UUID will be required. For information on storage pools refer to Chapter 12, Storage Pools . For information on storage volumes refer to, Chapter 13, Volumes . 14.12.1. Creating Storage Volumes The vol-create-from pool-or-uuid file --inputpool pool-or-uuid vol-name-or-key-or-path command creates a storage volume, using another storage volume as a template for its contents. This command requires a pool-or-uuid which is the name or UUID of the storage pool to create the volume in. The file argument specifies the XML file and path containing the volume definition. The --inputpool pool-or-uuid option specifies the name or uuid of the storage pool the source volume is in. The vol-name-or-key-or-path argument specifies the name or key or path of the source volume. For some examples, refer to Section 13.1, "Creating Volumes" . The vol-create-as command creates a volume from a set of arguments. The pool-or-uuid argument contains the name or UUID of the storage pool to create the volume in. name is the name of the new volume. capacity is the size of the volume to be created, as a scaled integer, defaulting to bytes if there is no suffix. --allocation <size> is the initial size to be allocated in the volume, also as a scaled integer defaulting to bytes. --format <string> is used in file based storage pools to specify the volume file format which is a string of acceptable formats separated by a comma. Acceptable formats include raw , bochs , qcow , qcow2 , vmdk , --backing-vol vol-name-or-key-or-path is the source backing volume to be used if taking a snapshot of an existing volume. --backing-vol-format string is the format of the snapshot backing volume which is a string of formats separated by a comma. Accepted values include: raw , bochs , qcow , qcow2 , , vmdk , and host_device . These are, however, only meant for file based storage pools. 14.12.1.1. Creating a storage volume from an XML file The vol-create pool-or-uuid file creates a storage volume from a saved XML file. This command also requires the pool-or-uuid , which is the name or UUID of the storage pool in which the volume will be created. The file argument contains the path with the volume definition's XML file. An easy way to create the XML file is to use the vol-dumpxml command to obtain the definition of a pre-existing volume, modify it and then save it and then run the vol-create . Other options available include: The --inactive option lists the inactive guest virtual machines (that is, guest virtual machines that have been defined but are not currently active). The --all option lists all guest virtual machines. 14.12.1.2. Cloning a storage volume The vol-clone --pool pool-or-uuid vol-name-or-key-or-path name command clones an existing storage volume. Although the vol-create-from may also be used, it is not the recommended way to clone a storage volume. The --pool pool-or-uuid option is the name or UUID of the storage pool to create the volume in. The vol-name-or-key-or-path argument is the name or key or path of the source volume. Using a name argument refers to the name of the new volume.

Commands:
vol-create-as pool-or-uuid name capacity --allocation <size> --format <string> --backing-vol <vol-name-or-key-or-path> --backing-vol-format <string>
virsh vol-dumpxml --pool storagepool1 appvolume1 > newvolume.xml virsh edit newvolume.xml virsh vol-create differentstoragepool newvolume.xml