Digging into an efficient backup solution for my VM end me up to read OCFS2 File system used by Oracle VM and I discover one of it powerful capability : snapshot-ting with REFLINK.
This feature allows a regular user to create multiple, write-able snapshots of regular files. The snapshot created is a point-in-time image of the file that includes both the file data and all its attributes (including extended attributes). The file system creates a new inode with the same extent pointers as the original inode. Multiple inodes are thus able to share data extents. Because of this, creating a REFLINK snapshot requires very little space initially. It grows only when a snapshot is modified, using a copy-on-write mechanism. REFLINK works across the cluster.
How can I missed this wonderfull option since years ?
Probably because I was *just* using the OVM Web Interface only and from there I was unable to select the Virtual Disk, created by reflink (or another other cp or rsync command). From GUI, Snapshot is permitted only for OVM Templates. As I get more hands-on experienced with Oracle VM, i start hacking it for my testing purpose only 🙂
Here is the solution I found, and provided as is. I’m not responsible if you crash your Oracle VM:
- Seach the configuration ID for your VM, for example 0004fb00000600008ead2941a7d5a2ff
- SSH into OVM Server and search for the ID: find /OVS -name 0004fb00000600008ead2941a7d5a2ff
- Then edit the OVM config file: /OVS/Repositories/0004fb00000300009f2f33fcef2d77ca/VirtualMachines/0004fb00000600008ead2941a7d5a2ff/vm.cfg
- Replace the line disk with your reflink image
TO reflink a disk just issue
reflink 0004fb000012000093f8db8216ffd797.img fusion1117_idmhost_v0.img
For example, my vm.cfg contains:
[root@ovmserver326 VirtualDisks]# cat /OVS/Repositories/0004fb00000300009f2f33fcef2d77ca/VirtualMachines/0004fb00000600008ead2941a7d5a2ff/vm.cfg vif = ['mac=00:21:f6:00:00:0a,bridge=c0a80200'] OVM_simple_name = 'idmhost-chenda-test' vnclisten = '127.0.0.1' serial = 'pty' disk = ['file:/OVS/Repositories/0004fb00000300009f2f33fcef2d77ca/VirtualDisks/fusion1117_idmhost_v0.img,xvda,w'] vncunused = 1 uuid = '0004fb00-0006-0000-8ead-2941a7d5a2ff' on_reboot = 'restart' boot = 'c' cpu_weight = 27500 memory = 65536 cpu_cap = 0 maxvcpus = 8 OVM_high_availability = False vnc = 1 OVM_description = '' on_poweroff = 'destroy' on_crash = 'restart' guest_os_type = 'linux' name = '0004fb00000600008ead2941a7d5a2ff' builder = 'hvm' vcpus = 8 keymap = 'fr' OVM_os_type = 'Oracle Linux 5' OVM_cpu_compat_group = '' OVM_domain_type = 'xen_hvm'