LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   qemu: use physical hard disk (host drives) - dangerous? (https://www.linuxquestions.org/questions/linux-software-2/qemu-use-physical-hard-disk-host-drives-dangerous-665843/)

gernonimo 08-27-2008 01:44 PM

qemu: use physical hard disk (host drives) - dangerous?
 
The qemu documentations tells that it's possible to use a physical hard disk (host drives) directly, but that it's only save if used READ-ONLY:

Quote:

Hard disks can be used. Normally you must specify the whole disk (`/dev/hdb' instead of `/dev/hdb1') so that the guest OS can see it as a partitioned disk. WARNING: unless you know what you do, it is better to only make READ-ONLY accesses to the hard disk otherwise you may corrupt your host data (use the `-snapshot' command line option or modify the device permissions accordingly).
Why is it dangerous to use a host drive not read-only? Is the problem the simultanous write access from host and guest to the same filesystem?

Can i use a host drive safely in read/write mode if this drive is not mounted at the host and used by the guest exclusively?

thanks,
gernonimo

mostlyharmless 08-27-2008 02:02 PM

Quote:

Is the problem the simultanous write access from host and guest to the same filesystem?
You betcha
Quote:

Can i use a host drive safely in read/write mode if this drive is not mounted at the host and used by the guest exclusively?
I'd certainly think so

djbon2112 09-18-2008 09:12 AM

I'm curious as to how you'd do this. The documentation isn't particularly clear in this area, and I don't want to mess up my data! I'm using ProxMox for virtualization on a server, and I have a physical hardware RAID volume (with partitions already created and data on them) that I'd like one of my guests (and only the one guest, not the host nor the other guests) to have access to. It's /dev/sda (the partition sda1) on my host system. How would I go about adding this to the virtual machine?

gernonimo 09-18-2008 10:03 AM

i think it's only possible to add the whole disk to the guest - see section "Using Host Drives" of the qemu documentation:
http://qemu-forum.ipi.fi/viewtopic.php?f=3&t=4599
So you can add hda and not hdaX

But what should work:
- If you are using LVM you can add a logical volume
- If you are using Raid you should be able to add a logical raid device

djbon2112 09-18-2008 12:02 PM

Quote:

Originally Posted by gernonimo (Post 3284626)
i think it's only possible to add the whole disk to the guest - see section "Using Host Drives" of the qemu documentation:
http://qemu-forum.ipi.fi/viewtopic.php?f=3&t=4599
So you can add hda and not hdaX

But what should work:
- If you are using LVM you can add a logical volume
- If you are using Raid you should be able to add a logical raid device

I understand... but I don't know how to add a device. What commands would I use at the Qemu monitor to add the device /dev/sda on the host, without damaging it, and then how would I add it to a VM (either at the monitor or using ProxMox)?

johnson_steve 09-18-2008 01:23 PM

Quote:

Originally Posted by gernonimo (Post 3261753)
The qemu documentations tells that it's possible to use a physical hard disk (host drives) directly, but that it's only save if used READ-ONLY:



Why is it dangerous to use a host drive not read-only? Is the problem the simultanous write access from host and guest to the same filesystem?

Can i use a host drive safely in read/write mode if this drive is not mounted at the host and used by the guest exclusively?

thanks,
gernonimo

Wow, thats news to me. I've been doing this for years without trouble. I just give the device file (/dev/sda1) instead of an image file.

djbon2112 09-18-2008 03:13 PM

Quote:

Originally Posted by johnson_steve (Post 3284822)
Wow, thats news to me. I've been doing this for years without trouble. I just give the device file (/dev/sda1) instead of an image file.

This is where I'm confused... where do I issue the command (Qemu monitor, terminal on host, terminal on guest?), and what command is it?

johnson_steve 09-18-2008 03:48 PM

well I was starting quemu from the command line in a terminal. I don't have it setup in front of me right now. How do you start quemu?

djbon2112 09-18-2008 03:53 PM

Quote:

Originally Posted by johnson_steve (Post 3284908)
well I was starting quemu from the command line in a terminal. I don't have it setup in front of me right now. How do you start quemu?

The "Qemu Monitor" is embedded in my ProxMox Virtual Environment webpage. I'm not even 100% sure they're compatible, but it's worth a try. Here's a screenshot so I can know if we're talking about the right thing:

http://img139.imageshack.us/img139/5...vironmewe2.png

johnson_steve 09-18-2008 04:19 PM

Hmm, I've never seen that before. Is there a way to change the command line options that quemu is launched with? do you know what image file quemu is looking for?

I am assuming: (please correct me.)

1) This is all running on a linux box you have physical access to.
2) Proxmox is some kind of web application allowing you to work through your browser.
3) You are trying to run linux inside quemu with some kind of dedicated server set up on the VM

djbon2112 09-18-2008 07:44 PM

Quote:

Originally Posted by johnson_steve (Post 3284932)
Hmm, I've never seen that before. Is there a way to change the command line options that quemu is launched with? do you know what image file quemu is looking for?

I am assuming: (please correct me.)

1) This is all running on a linux box you have physical access to.
2) Proxmox is some kind of web application allowing you to work through your browser.
3) You are trying to run linux inside quemu with some kind of dedicated server set up on the VM

Yes but it's much more complex than that... if that screen isn't the usual Qemu screen I'm not going to mess around with it. Oh well, thanks!


All times are GMT -5. The time now is 11:39 AM.