We moved this page to our Documentation Portal. You can find the latest updates here. |
Question
I would like to make a copy of a virtual disk and move it to an external drive. Is this possible?
Environment
OnApp 3.x
Answer
1) Go to the VM disks page.
2) Get the identifier for the VM disk, you can do this in the OnApp UI.
This gives the identifier "wjtgsfuyxapb3k."
3) Go onto the HV or backup server. First, you need to get ID of the server you are on:
[root@ ~]# onappstore getid ipaddr= result=SUCCESS uuid=2868323073 completion_time=0
4) Now online the VM disk using its identifier and the server's ID you are on as the frontend:
onappstore online uuid=wjtgsfuyxapb3k frontend_uuid=2868323073
5) Map partitions of this VM disk, if needed (you will need to know the identifier for the datastore. It is visible on the UI page for the datastores):
kpartx -a -v -p X /dev/iyrdh2t6lwkgcz/wjtgsfuyxapb3k
This should give you a disk like wjtgsfuyxapb3kX1.
Now you have the VM disk at /dev/mapper/wjtgsfuyxapb3kX1 and can perform tasks on it. For example, you can run a fsck on it with:
fsck -fy /dev/mapper/wjtgsfuyxapb3kX1
Or mount it and transfer the files:
mount /dev/mapper/wjtgsfuyxapb3kX1
After you are done with the disk, you need to undo the steps. First, umount the disk if it is mounted, etc.
7) Unmap the disk:
kpartx -d -v -p X /dev/iyrdh2t6lwkgcz/wjtgsfuyxapb3k
8) Offline the disk:
onappstore offline uuid=wjtgsfuyxapb3k
Alternate process:
If the VM is on, you will instead need to create a snapshot and gain access to that. Please review the example below:
[root@ ~]# onappstore snapshot uuid=wjtgsfuyxapb3k result=SUCCESS uuid=b6yj75n1kz3wog completion_time=6 [root@ ~]# onappstore getid ipaddr= result=SUCCESS uuid=2868323073 completion_time=0 [root@ ~]# onappstore online uuid=b6yj75n1kz3wog frontend_uuid=2868323073 result=SUCCESS completion_time=11 [root@ ~]# kpartx -a -v -p X /dev/iyrdh2t6lwkgcz/b6yj75n1kz3wog add map b6yj75n1kz3wogX1 (253:69): 0 41942912 linear /dev/iyrdh2t6lwkgcz/b6yj75n1kz3wog 128
Now you are ready to use the disk:
[root@ ~]# mkdir -p /mnt/snapshot_live_disk [root@ ~]# mount /dev/mapper/b6yj75n1kz3wogX1 /mnt/snapshot_live_disk/ [root@ ~]# ls /mnt/snapshot_live_disk/ bin boot cgroup dev etc home lib lib64 lost+found media mnt opt proc root sbin selinux srv sys tmp usr var
As you are done, you need to clean up mount:
[root@ ~]# umount /mnt/snapshot_live_disk/ [root@ ~]# rmdir /mnt/snapshot_live_disk/
Offline and remove the snapshot:
[root@ ~]# kpartx -d -v -p X /dev/iyrdh2t6lwkgcz/b6yj75n1kz3wog del devmap : b6yj75n1kz3wogX1 [root@ ~]# onappstore offline uuid=b6yj75n1kz3wog result=SUCCESS completion_time=6 [root@ ~]# onappstore delete uuid=b6yj75n1kz3wog result=SUCCESS completion_time=9 [root@ ~]#