qemu-discuss
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-discuss] How to load a host file in the client while not yet i


From: Jakob Bohm
Subject: Re: [Qemu-discuss] How to load a host file in the client while not yet installed ?
Date: Sun, 07 Apr 2013 21:34:04 +0200
User-agent: Mozilla/5.0 (Windows NT 5.2; WOW64; rv:17.0) Gecko/20130307 Thunderbird/17.0.4

On 4/7/2013 12:10 PM, Laurent Alebarde wrote:
Thanks both of you. Yes, the problem is trivial when both machine have the same FS.

If I have not mistaken myself, it seems to me that Jakob defines the 1st machine as the one with the desired files (let's call it MWDF) and the 2nd one the one to install that needs these files (let's call it MTI) - and reverse for Tony.

Actually, I think you misunderstood my methods.

Here is a different explanation of my 1 VM method:

1. Boot the virtual machine from a standard live CD iso of
  FreeBSD, this does not require it to be already installed.

2. Use the live CD to copy files from somewhere outside the
  VM to the hard drive of the not-fully-installed virtual
  machine.  For easiest automation, use a live CD that
  automatically starts an SSH server with a known password
  (use the Linux firewall of the host machine to restrict
  access to qemu's virtual network interface for this VM,
  so noone can SSH in from the Internet).

3. Shut down and proceed normally.

Here is a different explanation of my 2 VM method:


My method effectively involves 3 machines:

No 0 ("Host"), the machine that runs qemu (I understand it is a
 Linux machine in your case) and cannot access the relevant FS
 (ufs in your case).


No. 1 ("Target Guest") The virtual machine that owns the virtual
  disk and uses a non-Linux file system (in your case a FreeBSD
  machine using ufs)


No. 2 ("Temporary Guest") A brand new throw away virtual machine,
  created just for the job of getting the files onto the disk of
  No. 1.  This would be a "dumb" freeBSD machine whose sole job
  is to mount the disk from machine No. 1 so it can put files
  on it.


If these were physical machines, my method would have worked
  like this:


(Steps 1 to 3 and 12 to 13 corresponding to virtual machine No. 1)
(Steps 4 to 11 and 14 correspond to virtual machine No. 2)

1. Purchase a new blank hard drive (much cheaper when virtual)

2. Turn off the machine (with hard drive No. 1)

3. Disconnect the No. 1 hard drive

4. Connect the No. 2 hard drive

5. Install a minimal FreeBSD on the No. 2 hard drive

6. Turn off the machine (with hard drive No. 2)

7. Connect the No. 1 hard drive as a "second hard drive"

8. Turn on the machine, booting from the "first hard drive"
  (No. 2 hard drive
)

9. Use the FreeBSD on the No. 2 hard drive to copy files
  from wherever
onto the No. 1 hard drive.

10. Turn off the machine (with hard drive No. 2 as boot,
  hard drive No. 1 as extra)


11. Disconnect both hard drives

12. Connect the No. 1 hard drive as the "first hard drive"
  again


13. Turn on the machine, now booting from its normal No. 1
  hard drive


14. Pack away that extra No. 2 hard drive, you might not
  need it again.


My problem is when MWDF and MTI do not have the same FS and when you cannot setup any client in the MTI since, by definition, it is not yet installed. In this configuration though, we have access to the iso of the Live/Install CD. But I don't want to have to prepare a specific Live/Install CD with the desired files - I need flexibility. I wonder if the MTI, when booted on the Live/Install CD could be configured as an ssh server to transfer the desired files with scp ? Or as an NFS server ?

Cheers,

Laurent.

Le 05/04/2013 20:11, Tony Su a écrit :
Am curious about this method which I have never used...
Following your recommended steps, Q about these steps...

3, 4. Assuming that the first machine is the machine without the desired Hosts file and the second machine is the one with the desired Hosts file, is this really any different than simply booting the first machine naturally but with the second machine's disk mounted as a second drive?

5. Not clear what is meant by "access," are you suggesting more than or only reading the second disk's file system?

Unless I'm missing something,
1. mounting the FreeBSD disk as a second drive won't work unless <maybe> something like FUSE might support if there isn't native support for the secondary disk's filesystem. This means that after investigating the FUSE option, network file sharing seems to be the most likely option. BTW - it might be worthwhile to consider filesystem support in <both> directions. So, in this case if you can mount the FreeBSD disk while itself booting or as a secondary disk in another FreeBSD instance, consider also mounting your Linux disk as another secondary disk...That should grant you read access to all your mounted disks, ie Although Linux might not support the FreeBSD fielsystem, perhaps FreeBSD will support your Linux filesystem.

2. Once the file system is accessible, seems to me it should be trivial to just copy and modify the template Hosts file.

IMO,
Tony


On Fri, Apr 5, 2013 at 5:45 AM, Jakob Bohm <address@hidden> wrote:
On 4/5/2013 12:27 AM, Laurent Alebarde wrote:
Hi all,

My host is Linux and my guest is FreeBSD, thus from http://en.wikibooks.org/wiki/QEMU/Images#Mounting_an_image_on_the_host , I cannot mount the image to access it since Linux has no driver for ufs nor zfs, I cannot setup a spice client since the client is not yet installed. Though I need to access/execute a host file.

How can I do that please ?

The standard trick is this:

1. Prepare another virtual machine supporting the desired file system
  and running an NFS or similar server (in your case, that would be a
  FreeBSD server)

2. Shut down both virtual machines

3. Start the second virtual machine, with the main disk of the first
  virtual machine as a second virtual hard drive

4. From the second virtual machine, mount the partition from the
  second (virtual) hard drive

5. Access the files either directly on the second machine or via NFS

6. Shut down the second virtual machine

7. Remove the disk of the first virtual machine from the configuration
  of the first virtual machine

8. Now the first virtual machine can be started to access its own disk
  again


A simpler alternative is to just boot the first virtual machine from
an ISO of a "Live CD" for the target OS (in this case a FreeBSD Live
CD/DVD).

Enjoy

Jakob
--
Jakob Bohm, CIO, Partner, WiseMo A/S.  http://www.wisemo.com
Transformervej 29, 2730 Herlev, Denmark.  Direct +45 31 13 16 10
This public discussion message is non-binding and may contain errors.
WiseMo - Remote Service Management for PCs, Phones and Embedded






Enjoy

Jakob
-- 
Jakob Bohm, CIO, Partner, WiseMo A/S.  http://www.wisemo.com
Transformervej 29, 2730 Herlev, Denmark.  Direct +45 31 13 16 10
This public discussion message is non-binding and may contain errors.
WiseMo - Remote Service Management for PCs, Phones and Embedded

reply via email to

[Prev in Thread] Current Thread [Next in Thread]