We moved this page to our Documentation Portal. You can find the latest updates here. |
Question
How can I mount a Virtual Server's disk to the server directly? I need to recover files or perform other tasks.
Environment
OnApp 2.x and up
Virtual Servers running on KVM and XEN Compute Resources using LVM or Integrated Storage
Answer
Firstly, get the identifier for the VS disk - this can be found by going to Storage->Disks tab in the UI pages for the VS, and then adding /<disk #> to the URL for the disk you are interested in (for example, let's assume the VM page is https://demo.onapp.com/virtual_machines/a1nisp85fqd9zz, then https://demo.onapp.com/virtual_machines/a1nisp85fqd9zz/disks/ to see the disks, and then in this case it is disk #3, so https://demo.onapp.com/virtual_machines/a1nisp85fqd9zz/disks/3 will show the identifier)
Then identify the type of storage - Integrated Storage or LVM (if using SolidFire please contact their support)
The type of storage can be identified by checking settings -> datastores page and either selecting 'edit' on a datastore or noting the identifier - identifiers starting with "onapp-" tend to be LVM datastore.
Now, you need to activate the disk on the server that you want to mount the disk.
For LVM, run the command like:
lvchange -a y /dev/onapp-xxxxxx/yyyyy
Where onapp-xxxx is the datastore identifier and the yyyy is the disk identifier from before.
Device /dev/onapp-xxxxxx/yyyyy is your VS disk now.
For Integrated Storage, run the command like:
onappstore getid
onappstore online uuid=<yyyyyyy> frontend_uuid=<server's uuid from previous command>
Device /dev/xxxxxxxx/yyyyyy is your VM disk now, where xxxxx is the datastore identifier
For KVM Compute Resource, you need to map partitions before mounting:
kpartx -a -v -p X <disk device>
Then, mount the resulting /dev/mapper/......X1 device
To undo these steps, first umount the disk, then unmap partitions if needed:
kpartx -d -v -p X <disk device>
Next, deactivate the disk:
LVM:
lvchange -a n /dev/onapp-xxxxxx/yyyyyy
Integrated Storage:
onappstore offline uuid=yyyyyy