Raw data access to VMs

timeJunky

New Member
Dec 21, 2010
23
0
1
Is there a way to access the disks of offline-VMs?

All virtual machines are configured with Debian.

I guess, this could be better way to backup on/offline without producing network traffic on every machine.
 
I assume you are talking about KVM.? which VM disk types do you use (local, LVM, etc.?)

if you use local disks, just see /var/lib/vz/images/..
 
I hope this is the answer you want:

... on of the VMs

Hard disks BusDeviceSize (GB)Volume ID
tarrdown.png
IDEIDE 0:032.00local:107/vm-107-disk-1.raw
 
you will find this raw disk image file on /var/lib/vz/images/107/vm-107-disk-1.raw
 
thx, but how can I access into the directories of that VM even the machine is offline.

is there a command like vzctl... to get the vm's contents of e.g. /var/www/* ?
 
thx, but how can I access into the directories of that VM even the machine is offline.

is there a command like vzctl... to get the vm's contents of e.g. /var/www/* ?
Hi,
the easy way (only with vm shutdown!):
Code:
apt-get install kpartx
cd /var/lib/vz/images/107

kpartx -av vm-107-disk-1.raw
# output like this:
#add map loop0p1 (254:6): 0 18433 linear /dev/loop0 2048
#add map loop0p2 (254:7): 0 20951039 linear /dev/loop0 20481

mount /dev/mapper/loop0p1 /mnt

Udo
 
you can think of mounting the disk image somewhere (readonly), just search the web for 'mounting a disk image linux' or similar.

but back to the beginning: I assume you do not plan to store the backup on your local machine so there is network traffic anyways so what do wanna achieve here?
 
@udo, tom Thx u both for your quick answers!

As I have difficulties (I guess, because of traffic hypervisors <-> vm), I was rejecting to do my backups through raw access.

And yes, I plan to store my backups on the local machine as all VMs are seperated with firewall rules (shorewall). A partition for backups is planned to be (un)mounted by crons. Some of the VMs are even not vissible and accessible from the web.

Anyway, I am open minded for better solutions :)