Virsh vol-clone: Difference between revisions
Jump to navigation
Jump to search
Line 16: | Line 16: | ||
{{Warn|The virsh man page does not explicitly require it, but it is probably better to make sure the source volume is not in use while cloning.}} | {{Warn|The virsh man page does not explicitly require it, but it is probably better to make sure the source volume is not in use while cloning.}} | ||
= | =Examples= | ||
==Cloning a Raw Format Volume== | |||
virsh vol-clone --pool main-storage-pool test-volume test-volume.raw | |||
virsh vol-list --pool main-storage-pool | |||
==Cloning a qcow2 Format Volume== | |||
virsh vol-clone --pool main-storage-pool test-volume test-volume.raw | virsh vol-clone --pool main-storage-pool test-volume test-volume.raw | ||
virsh vol-list --pool main-storage-pool | virsh vol-list --pool main-storage-pool |
Revision as of 18:52, 2 July 2017
External
- https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/Virtualization_Deployment_and_Administration_Guide/sect-Storage_Volumes-Cloning_volumes.html
- https://access.redhat.com/documentation/en-US/Red_Hat_Enterprise_Linux/7/html/Virtualization_Deployment_and_Administration_Guide/sect-Managing_guest_virtual_machines_with_virsh-Storage_Volume_Commands.html#sect-Creating_storage_volumes-Cloning_a_storage_volume
Internal
Overview
The operation clones the source volume within the same storage pool, It allocates space for the target volume and copies the content across. Various optimizations are applied depending on the source volume format.
virsh vol-clone --pool <storage-pool-name> <source-volume-name> <new-volume-name>
The virsh man page does not explicitly require it, but it is probably better to make sure the source volume is not in use while cloning.
Examples
Cloning a Raw Format Volume
virsh vol-clone --pool main-storage-pool test-volume test-volume.raw virsh vol-list --pool main-storage-pool
Cloning a qcow2 Format Volume
virsh vol-clone --pool main-storage-pool test-volume test-volume.raw virsh vol-list --pool main-storage-pool