qemu-discuss
[Top][All Lists]
Advanced

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

Re: [Qemu-discuss] Using qemu to run a physical machine in parallel


From: Jakob Bohm
Subject: Re: [Qemu-discuss] Using qemu to run a physical machine in parallel
Date: Sun, 4 Aug 2019 18:46:55 +0200
User-agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.8.0

On 04/08/2019 17:26, Yassine Chaouche wrote:
Dear qemu,

I have installed Linux Mint on my machine on /dev/sda5. Later, I installed MX Linux on /dev/sda9, but the installation of MX eventually didn't work well as I tried to do things. I need to fix MX linux, but each I change something I need to reboot the machine to see if it fixed it, and this is cumbersome/tiresome/awkward. What I would like to do is boot on /dev/sda5 (Linux Mint) and run MX Linux (/dev/sda9) in parallel. Can I achieve this with qemu ? I don't want to reinstall MX as a virtual machine, I would like to run and fix the already installed one.

Thanks for your tips !

In general, qemu can use your physical hard disk partition (/dev/sda9) as a
the storage for a virtual machine disk (such as /dev/sda), thus almost
allowing you to run your MX system under qemu, however there are some important
differences between the virtual and real machine that you will need to work
aroundyourself.

1. The virtual machine will have different "hardware", for example it will
  have a different network card (at least a different mac address) and a
  different graphics card.  It will also have less memory because it has to
  fit inside the free memory not used by your Mint system.

2. If you mount /dev/sda9 as a virtual hard drive, the virtual machine will
  see it as a physical disk, not a partition of a physical disk. This may
  confuse the MX startup scripts and configuration.
   As an alternative, you can layer a qcow2 image on top of the full /dev/sda,   thus showing the virtual machine the entire disk, but redirecting all disk
  writes by MX to the qcow2 file.  Beware however that because the actual
  /dev/sda is changing every time your Mint system writes to it, the content   of the Mint and shared partitions as seen by the virtual machine will be a   garbled mess that you should not access.  Once you find a working MX setup,   you will have to copy out _only_ the MX-only partition content to the real   /dev/sda partitions while not using or overwriting the partitions belonging   to Mint or shared, probably by doing funny stuff with qemu-nbd and dd, very
  very carefully.
   Tip: To make a small shared partitions (such as boot or EFI) completely
  separate for the virtual machine, mount the qcow2 image with qemu-nbd (without   the virtual machine running!) and very carefully dd the initial contents of   the physical partition to the qcow2 partition.  I am not sure which additional   options are needed to prevent qcow2 from mapping those sectors back to the
  physical sectors that will change later.

3. If MX installs Linux kernels or bootloaders into common "boot" and/or "EFI"
  partitions, you will have to manually copy those files out to the Mint
  machine, then pass the kernels and initramfs images on the qemu command line
  to boot them.

Some configuration tips may be gleaned from "PV" (Physical to Virtual) conversion instructions and scripts, but with the key difference of not actually trying
to store a complete copy of your physical /dev/sda inside itself.


Enjoy

Jakob
--
Jakob Bohm, CIO, Partner, WiseMo A/S.  https://www.wisemo.com
Transformervej 29, 2860 Søborg, 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]