LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 08-27-2008, 01:44 PM   #1
gernonimo
LQ Newbie
 
Registered: Aug 2008
Posts: 7

Rep: Reputation: 0
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
 
Old 08-27-2008, 02:02 PM   #2
mostlyharmless
Senior Member
 
Registered: Jan 2008
Distribution: Slackware -current (multilib) with kernel 3.15.5
Posts: 1,497
Blog Entries: 12

Rep: Reputation: 154Reputation: 154
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
 
Old 09-18-2008, 09:12 AM   #3
djbon2112
LQ Newbie
 
Registered: Sep 2008
Posts: 24

Rep: Reputation: 15
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?

Last edited by djbon2112; 09-18-2008 at 09:16 AM.
 
Old 09-18-2008, 10:03 AM   #4
gernonimo
LQ Newbie
 
Registered: Aug 2008
Posts: 7

Original Poster
Rep: Reputation: 0
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
 
Old 09-18-2008, 12:02 PM   #5
djbon2112
LQ Newbie
 
Registered: Sep 2008
Posts: 24

Rep: Reputation: 15
Quote:
Originally Posted by gernonimo View Post
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)?
 
Old 09-18-2008, 01:23 PM   #6
johnson_steve
Senior Member
 
Registered: Apr 2005
Location: BrewCity, USA (Milwaukee, WI)
Distribution: Xubuntu 9.10, Gentoo 2.6.27 (AMD64), Darwin 9.0.0 (arm)
Posts: 1,152

Rep: Reputation: 46
Quote:
Originally Posted by gernonimo View Post
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.
 
Old 09-18-2008, 03:13 PM   #7
djbon2112
LQ Newbie
 
Registered: Sep 2008
Posts: 24

Rep: Reputation: 15
Quote:
Originally Posted by johnson_steve View Post
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?
 
Old 09-18-2008, 03:48 PM   #8
johnson_steve
Senior Member
 
Registered: Apr 2005
Location: BrewCity, USA (Milwaukee, WI)
Distribution: Xubuntu 9.10, Gentoo 2.6.27 (AMD64), Darwin 9.0.0 (arm)
Posts: 1,152

Rep: Reputation: 46
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?
 
Old 09-18-2008, 03:53 PM   #9
djbon2112
LQ Newbie
 
Registered: Sep 2008
Posts: 24

Rep: Reputation: 15
Quote:
Originally Posted by johnson_steve View Post
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
 
Old 09-18-2008, 04:19 PM   #10
johnson_steve
Senior Member
 
Registered: Apr 2005
Location: BrewCity, USA (Milwaukee, WI)
Distribution: Xubuntu 9.10, Gentoo 2.6.27 (AMD64), Darwin 9.0.0 (arm)
Posts: 1,152

Rep: Reputation: 46
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
 
Old 09-18-2008, 07:44 PM   #11
djbon2112
LQ Newbie
 
Registered: Sep 2008
Posts: 24

Rep: Reputation: 15
Quote:
Originally Posted by johnson_steve View Post
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!
 
  


Reply

Tags
disk, physical, qemu


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
determine the physical size of the hard disk hoffies Linux - Hardware 3 11-15-2007 03:13 AM
Two Physical Hard Drives FC5 combatseabee Linux - Newbie 8 07-27-2006 05:13 PM
Is there any threat from hard disk having physical bad sectors ??? b0nd Linux - Hardware 3 06-23-2006 12:08 AM
Grub problem with two physical hard drives Fredstar Linux - Newbie 2 10-17-2004 02:01 PM
Multiple physical hard drives w/Red Hat 9 masterspud777 Linux - Hardware 7 07-29-2003 04:10 PM


All times are GMT -5. The time now is 07:35 AM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration