* [Qemu-devel] file system sharing
@ 2005-07-31 1:28 Eric S. Johansson
2005-07-31 1:58 ` Mark Williamson
0 siblings, 1 reply; 9+ messages in thread
From: Eric S. Johansson @ 2005-07-31 1:28 UTC (permalink / raw)
To: qemu-devel
can I write a file based file system and read it from the host? I can
guarantee I have stopped writing before I read on the host side. I can
even unmount before reading.
ideally, I would like to "import" my flash memory device into the guest
OS side (USB based) but if I can create a "virtual" flash disk and when
I'm done modifying it, physically copy the file based image to the
physical flash, I would be happy.
---eric
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Qemu-devel] file system sharing
2005-07-31 1:28 [Qemu-devel] file system sharing Eric S. Johansson
@ 2005-07-31 1:58 ` Mark Williamson
2005-07-31 6:48 ` Mike Swanson
` (3 more replies)
0 siblings, 4 replies; 9+ messages in thread
From: Mark Williamson @ 2005-07-31 1:58 UTC (permalink / raw)
To: qemu-devel; +Cc: Eric S. Johansson
> can I write a file based file system and read it from the host? I can
> guarantee I have stopped writing before I read on the host side. I can
> even unmount before reading.
If only one machine (host or guest) has mounted the device then it should
always be safe to do this. You may get away with read only mounting in one
and writing in the other but it's not a reliable solution. Never allow more
than one writer to the filesystem - this does bad things to your filesystem!
If you're using a file-based disk and it's partitioned you'll need to use
lomount http://www.dad-answers.com/qemu/utilities/QEMU-HD-Mounter/lomount/ to
mount the right partition in the host.
> ideally, I would like to "import" my flash memory device into the guest
> OS side (USB based) but if I can create a "virtual" flash disk and when
> I'm done modifying it, physically copy the file based image to the
> physical flash, I would be happy.
I imagine just giving the guest access to the device file would work.
HTH,
Mark
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Qemu-devel] file system sharing
2005-07-31 1:58 ` Mark Williamson
@ 2005-07-31 6:48 ` Mike Swanson
2005-07-31 10:42 ` Johannes Schindelin
` (2 subsequent siblings)
3 siblings, 0 replies; 9+ messages in thread
From: Mike Swanson @ 2005-07-31 6:48 UTC (permalink / raw)
To: qemu-devel
You can probably also set up an ftp or smb (via Samba) server to
transfer files within the guest OS. HTTP should also work with
Apache, but remember the protocol wasn't originally designed for
uploads, and not all clients (eg, web browsers) support it.
--
Mike
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Qemu-devel] file system sharing
2005-07-31 1:58 ` Mark Williamson
2005-07-31 6:48 ` Mike Swanson
@ 2005-07-31 10:42 ` Johannes Schindelin
2005-07-31 14:01 ` [Qemu-devel] " Eric S. Johansson
2005-07-31 17:59 ` [Qemu-devel] lomount : " Eric S. Johansson
3 siblings, 0 replies; 9+ messages in thread
From: Johannes Schindelin @ 2005-07-31 10:42 UTC (permalink / raw)
To: qemu-devel; +Cc: Eric S. Johansson
Hi,
On Sun, 31 Jul 2005, Mark Williamson wrote:
> If only one machine (host or guest) has mounted the device then it should
> always be safe to do this. You may get away with read only mounting in one
> and writing in the other but it's not a reliable solution.
You almost certainly get not away with that if you are using Linux as
the read only part. Linux does quite a good job of caching filesystems,
but it thereby assumes to have exclusive control over the device (this
evidently only holds for non-networked FSes). Therefore, if you change
something behind the scenes, but Linux did not issue a write, it still
assumes the old data.
Ciao,
Dscho
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Qemu-devel] Re: file system sharing
2005-07-31 1:58 ` Mark Williamson
2005-07-31 6:48 ` Mike Swanson
2005-07-31 10:42 ` Johannes Schindelin
@ 2005-07-31 14:01 ` Eric S. Johansson
2005-07-31 14:49 ` Paul Brook
2005-07-31 18:21 ` Mark Williamson
2005-07-31 17:59 ` [Qemu-devel] lomount : " Eric S. Johansson
3 siblings, 2 replies; 9+ messages in thread
From: Eric S. Johansson @ 2005-07-31 14:01 UTC (permalink / raw)
To: qemu-devel
Mark Williamson wrote:
> If only one machine (host or guest) has mounted the device then it should
> always be safe to do this. You may get away with read only mounting in one
> and writing in the other but it's not a reliable solution. Never allow more
> than one writer to the filesystem - this does bad things to your filesystem!
I am well aware of these issues having worked on filesystems in the
1980s and having designed and built one of the first RPC based networked
filesystems in the late 80s for a CAD/CAM company. To this day the nova
architecture gives me the willies.
I suspect based on a comment that someone else made about caching that I
would need some sort of event to trigger a flush either by an explicit
flush call or a close. Would unmounting the disk image create such an
event?
>
> If you're using a file-based disk and it's partitioned you'll need to use
> lomount http://www.dad-answers.com/qemu/utilities/QEMU-HD-Mounter/lomount/ to
> mount the right partition in the host.
so what I can do is create the partition image on the host, start up
qemu with that multi-partition disk image, do what I need to in qemu,
shut down qemu and then I have a modified disk image. if I need to
modify it from the host, then I can use lomount to make it accessible as
the local filesystem.
Very cool.
one more question on this theme. How do I know when the guest OS has
finished booting? The reason I ask is I am planning on using ssh to
perform various operations on the guest OS once it's up.
>>ideally, I would like to "import" my flash memory device into the guest
>>OS side (USB based) but if I can create a "virtual" flash disk and when
>>I'm done modifying it, physically copy the file based image to the
>>physical flash, I would be happy.
>
>
> I imagine just giving the guest access to the device file would work.
I'm not entirely sure how to do that. would I just do something like:
-hdc /dev/sda1
as part of the command line?
>
> HTH,
> Mark
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Qemu-devel] Re: file system sharing
2005-07-31 14:01 ` [Qemu-devel] " Eric S. Johansson
@ 2005-07-31 14:49 ` Paul Brook
2005-07-31 18:21 ` Mark Williamson
1 sibling, 0 replies; 9+ messages in thread
From: Paul Brook @ 2005-07-31 14:49 UTC (permalink / raw)
To: qemu-devel
> one more question on this theme. How do I know when the guest OS has
> finished booting? The reason I ask is I am planning on using ssh to
> perform various operations on the guest OS once it's up.
Just like a real machine, you don't. You need to configure the guest to tell
the host when it's ready, or just keep trying until it succeeds.
Paul
^ permalink raw reply [flat|nested] 9+ messages in thread
* [Qemu-devel] lomount : Re: file system sharing
2005-07-31 1:58 ` Mark Williamson
` (2 preceding siblings ...)
2005-07-31 14:01 ` [Qemu-devel] " Eric S. Johansson
@ 2005-07-31 17:59 ` Eric S. Johansson
3 siblings, 0 replies; 9+ messages in thread
From: Eric S. Johansson @ 2005-07-31 17:59 UTC (permalink / raw)
To: qemu-devel
Mark Williamson wrote:
> If you're using a file-based disk and it's partitioned you'll need to use
> lomount http://www.dad-answers.com/qemu/utilities/QEMU-HD-Mounter/lomount/ to
> mount the right partition in the host.
this works great for some of the partitions but not the last one. For
some reason the file based image of a disk thinks the cylinder number is
* and if I try to set it to the right value, fdisk gives me error 25 and
something about wrong ioctk. I reboot to flush the cache in the
kerneland it's still not set to the right number of cylinders.
The disk image was formatted inside of qemu as part of the IPCop
installation process. It boots up just fine, I can create files change
files etc. no problem.
It's just one I have stopped qemu and are trying to modify files within
the disk image, I can't mount the partition I need to change.
---eric
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Qemu-devel] Re: file system sharing
2005-07-31 14:01 ` [Qemu-devel] " Eric S. Johansson
2005-07-31 14:49 ` Paul Brook
@ 2005-07-31 18:21 ` Mark Williamson
2005-08-01 2:05 ` Brad Watson
1 sibling, 1 reply; 9+ messages in thread
From: Mark Williamson @ 2005-07-31 18:21 UTC (permalink / raw)
To: qemu-devel; +Cc: Eric S. Johansson
> Mark Williamson wrote:
> > If only one machine (host or guest) has mounted the device then it should
> > always be safe to do this. You may get away with read only mounting in
> > one and writing in the other but it's not a reliable solution. Never
> > allow more than one writer to the filesystem - this does bad things to
> > your filesystem!
>
> I am well aware of these issues having worked on filesystems in the
> 1980s and having designed and built one of the first RPC based networked
> filesystems in the late 80s for a CAD/CAM company. To this day the nova
> architecture gives me the willies.
Ah yes. Somehow whenever I work on a substantial project, I'm left with a new
phobia ;-) Just thought I'd mention it - I've hosed my own filesystems in
similar ways (admittedly I should have thought what I was doing).
> I suspect based on a comment that someone else made about caching that I
> would need some sort of event to trigger a flush either by an explicit
> flush call or a close. Would unmounting the disk image create such an
> event?
As far as QEmu's block layer is concerned? Good question - I don't know
enough about its internals to comment. Can anyone verify if QEmu does
internal caching for block IOs? (or anything else that'd cause coherency
problems here, e.g. async IOs seem a likely candidate).
> > If you're using a file-based disk and it's partitioned you'll need to use
> > lomount
> > http://www.dad-answers.com/qemu/utilities/QEMU-HD-Mounter/lomount/ to
> > mount the right partition in the host.
>
> so what I can do is create the partition image on the host, start up
> qemu with that multi-partition disk image, do what I need to in qemu,
> shut down qemu and then I have a modified disk image. if I need to
> modify it from the host, then I can use lomount to make it accessible as
> the local filesystem.
Yep. You *could* take a disk file and format it all with one filesystem,
which would make it directly mountable under the guest Linux. However, the
Linux loop driver doesn't like /partitioned/ "file disks" - lomount sorts
this out in userspace by just mounting one partition at a time. My thought
was that if you were using (say) an image of a USB key, it'd probably have a
partition table on it.
> > I imagine just giving the guest access to the device file would work.
>
> I'm not entirely sure how to do that. would I just do something like:
>
> -hdc /dev/sda1
>
> as part of the command line?
That might work. Alternatively, exporting the whole device -hdc /dev/sda
might be worth a try. Can't say I've ever tried it (so far!)
The alternative would be to use some network-based solution. I'm sure you've
thought of that but I seem to remember a user-friendly way of letting a QEmu
guest access an SMB share, which would make it rather more convenient to set
up.
Cheers,
Mark
^ permalink raw reply [flat|nested] 9+ messages in thread
* Re: [Qemu-devel] Re: file system sharing
2005-07-31 18:21 ` Mark Williamson
@ 2005-08-01 2:05 ` Brad Watson
0 siblings, 0 replies; 9+ messages in thread
From: Brad Watson @ 2005-08-01 2:05 UTC (permalink / raw)
To: qemu-devel; +Cc: Eric S. Johansson
I've used both -hda /dev/sda and -hdc /dev/sda for
booting from and just accessing a flashdrive
respectively on linux. Probably -hdc \\.\E: would
work for accessing the flashdrive from qemu running on
MS....
Regards,
Brad Watson
____________________________________________________
Start your day with Yahoo! - make it your home page
http://www.yahoo.com/r/hs
^ permalink raw reply [flat|nested] 9+ messages in thread
end of thread, other threads:[~2005-08-01 2:33 UTC | newest]
Thread overview: 9+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-07-31 1:28 [Qemu-devel] file system sharing Eric S. Johansson
2005-07-31 1:58 ` Mark Williamson
2005-07-31 6:48 ` Mike Swanson
2005-07-31 10:42 ` Johannes Schindelin
2005-07-31 14:01 ` [Qemu-devel] " Eric S. Johansson
2005-07-31 14:49 ` Paul Brook
2005-07-31 18:21 ` Mark Williamson
2005-08-01 2:05 ` Brad Watson
2005-07-31 17:59 ` [Qemu-devel] lomount : " Eric S. Johansson
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).