LinuxQuestions.org
Support LQ: Use code LQ3 and save $3 on Domain Registration
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Virtualization and Cloud
User Name
Password
Linux - Virtualization and Cloud This forum is for the discussion of all topics relating to Linux Virtualization and Linux Cloud platforms. Xen, KVM, OpenVZ, VirtualBox, VMware, Linux-VServer and all other Linux Virtualization platforms are welcome. OpenStack, CloudStack, ownCloud, Cloud Foundry, Eucalyptus, Nimbus, OpenNebula and all other Linux Cloud platforms are welcome. Note that questions relating solely to non-Linux OS's should be asked in the General forum.

Notices

Reply
 
Search this Thread
Old 07-04-2013, 04:22 PM   #1
lifeboy
LQ Newbie
 
Registered: Feb 2009
Location: Stellenbosch, South Africa
Distribution: Ubuntu, Lubuntu, Ubuntu-LTSP, FreeBSD, PC-BSD
Posts: 12

Rep: Reputation: 0
How to run Windows 7 partition as a VM in libvirt/Ubuntu/qemu?


I need to use an existing windows 7 installation in a virtual machine from a libvirt host running Ubuntu 12.10.

Windows 7 installs on two partitions. There a 100MB boot partition and then the main partition for the installation.

If I boot the laptop (which dual boots), I can select Windows 7 and boot it just fine, or alternative Ubuntu.

If I select /dev/sda1 in the virtmanager (the gui version) as the source path I can see disk activity, but in the VM window the "booting from hard disk..." text never goes away.

If I select /dev/sda2 (where the windows installation resides (and which is not marked as bootable), I get a boot failure right away.

Here is what /var/log/syslog has:

Jul 4 22:11:02 Matt-HP ntfs-3g[8385]: Version 2012.1.15AR.5 external FUSE 29
Jul 4 22:11:02 Matt-HP ntfs-3g[8385]: Mounted /dev/sda2 (Read-Write,label "", NTFS 3.1)
Jul 4 22:11:02 Matt-HP ntfs-3g[8385]: Cmdline options:rw,nosuid,nodev,uhelper=udisks2,uid=1001,gid=1001,dmask=0077,fmask=0177
Jul 4 22:11:02 Matt-HP ntfs-3g[8385]: Mount options rw,nosuid,nodev,uhelper=udisks2,allow_other,nonempty,relatime,default_permissions,fsname=/dev/sda2, blkdev,blksize=4096
Jul 4 22:11:02 Matt-HP ntfs-3g[8385]: Global ownership and permissions enforced, configuration type 7
Jul 4 22:11:02 Matt-HP udisksd[2569]: Mounted /dev/sda2 at /media/roland/BE26AE8326AE3C71 on behalf of uid 1001
Jul 4 22:12:31 Matt-HP kernel: [15366.356259] audit_printk_skb: 48 callbacks suppressed
Jul 4 22:12:31 Matt-HP kernel: [15366.356265] type=1400 audit(1372968751.291:34): apparmor="STATUS" operation="profile_load"
name="libvirt-c6a90ff5-9849-2ec5-fc8e-a331b144ceff" pid=8540 comm="apparmor_parser"
Jul 4 22:12:31 Matt-HP kernel: [15366.584252] device vnet0 entered promiscuous mode
Jul 4 22:12:31 Matt-HP kernel: [15366.588663] virbr0: topology change detected, propagating
Jul 4 22:12:31 Matt-HP kernel: [15366.588669] virbr0: port 1(vnet0) entered forwarding state
Jul 4 22:12:31 Matt-HP kernel: [15366.588685] virbr0: port 1(vnet0) entered forwarding state
Jul 4 22:12:31 Matt-HP kernel: [15366.588963] IPv6: ADDRCONF(NETDEV_CHANGE): virbr0: link becomes ready
Jul 4 22:12:31 Matt-HP NetworkManager[986]: SCPlugin-Ifupdown: devices added (path: /sys/devices/virtual/net/vnet0, iface: vnet0)
Jul 4 22:12:31 Matt-HP NetworkManager[986]: SCPlugin-Ifupdown: device added (path: /sys/devices/virtual/net/vnet0, iface: vnet0): no
ifupdown configuration found.
Jul 4 22:12:32 Matt-HP NetworkManager[986]: <warn> /sys/devices/virtual/net/vnet0: couldn't determine device driver; ignoring...
Jul 4 22:12:33 Matt-HP avahi-daemon[935]: Joining mDNS multicast group on interface vnet0.IPv6 with address fe80::fc54:ff:fe8a:8f93.
Jul 4 22:12:33 Matt-HP avahi-daemon[935]: New relevant interface vnet0.IPv6 for mDNS.
Jul 4 22:12:33 Matt-HP avahi-daemon[935]: Registering new address record for fe80::fc54:ff:fe8a:8f93 on vnet0.*.

Is there anything that I can learn from this log? What could I do to make this work. Dual booting it not an option in this case.

regards

Roland Giesler

Last edited by lifeboy; 07-04-2013 at 04:24 PM. Reason: readability
 
Old 07-04-2013, 06:22 PM   #2
Ser Olmy
Senior Member
 
Registered: Jan 2012
Distribution: Slackware
Posts: 1,919

Rep: Reputation: Disabled
As you say, by default Windows 7 will create two partitions; one 100 Mb partition for the boot loader and a few system files, and a second partition for the main OS. Only the second partition is visible as a mounted file system in Windows (C:), although the first can be seen in Disk Manager.

In order for Windows to boot, both partitions must be available. As far as I know, you cannot create a "virtual" disk in qemu from two separate partitions, so the only way to make this work would be to make the entire sda disk available to the VM.
 
Old 07-04-2013, 07:27 PM   #3
jefro
Guru
 
Registered: Mar 2008
Posts: 11,086

Rep: Reputation: 1362Reputation: 1362Reputation: 1362Reputation: 1362Reputation: 1362Reputation: 1362Reputation: 1362Reputation: 1362Reputation: 1362Reputation: 1362
Should still work to boot to qemu -m 1G -hda \\(I forget this exactly for partition) -hdb \\.\hd1 or some such. See qemu doc's.

The HAL will be messed up.
 
Old 07-04-2013, 07:49 PM   #4
Ser Olmy
Senior Member
 
Registered: Jan 2012
Distribution: Slackware
Posts: 1,919

Rep: Reputation: Disabled
Quote:
Originally Posted by jefro View Post
Should still work to boot to qemu -m 1G -hda \\(I forget this exactly for partition) -hdb \\.\hd1 or some such. See qemu doc's.
Probably not, as the Windows boot loader will expect to find the OS on \Device\Harddisk0\Partition2, not \Device\Harddisk1\Partition1. He could fix that by rebuilding the boot loader, but would then lose the ability to boot directly from the physical disk.
Quote:
Originally Posted by jefro View Post
The HAL will be messed up.
The HAL is not likely to cause any trouble, but the storage driver might. Most modern hardware uses AHCI, while I believe Qemu emulates a PIIX IDE controller. Installing Windows 7 on a system with an AHCI controller will leave the IDE driver disabled. He will probably need to boot the OS on the physical hardware and enable the IDE driver manually.

Should he eventually succeed in migrating the OS to a VM, the licensing service will most likely complain loudly about changed hardware and demand reactivation.
 
Old 07-05-2013, 10:27 AM   #5
Knightron
Senior Member
 
Registered: Jan 2011
Location: Planet Earth
Distribution: Slackware.
Posts: 1,324
Blog Entries: 7

Rep: Reputation: 157Reputation: 157
Hello lifeboy. I can not answer your question exactly, but a while ago i desired a similar thing.
I have written detailed instructions on how i managed to boot my Windows 7 partition in virtualbox, from Debian.

http://www.linuxquestions.org/questi...ox-4175428313/

I don't think i have two partitions for Windows 7 though, and i can confirm that those instruction i wrote do not work on a macbook pro, but i'm pretty sure that's because macs don't have a bios,.
 
Old 07-05-2013, 03:08 PM   #6
jefro
Guru
 
Registered: Mar 2008
Posts: 11,086

Rep: Reputation: 1362Reputation: 1362Reputation: 1362Reputation: 1362Reputation: 1362Reputation: 1362Reputation: 1362Reputation: 1362Reputation: 1362Reputation: 1362
As Knightron points out there are some needed fixes. In his original post I suggested a P2V app that fixes all of this. In any case the authentication scheme that MS uses will most likely be triggered. A VM is not using enough of the real hardware to let it slide. Only the processor is a registered device and even in qemu that can be changed. So HAL and activation will have to be looked at. Depending on the P2V app used some of that is automated and even transparent to the user. The better P2V apps will break the existing install. They assume you are never going back to the hardware install.

Knightron used the entire disk which is not exactly what the OP requested but it is a good to know way to attempt this.

Using a VM to boot to an existing or dual use physical drive isn't really practical.
 
  


Reply


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 On
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
transformation between libvirt xml and qemu native command screwzm Linux - Virtualization and Cloud 0 01-19-2013 10:44 AM
libvirt qemu cgroup problem faicker Linux - Virtualization and Cloud 0 07-19-2012 07:45 AM
LXer: Qemu-kvm 0.15.1 & Spice(0.10.0) & Libvirt 0.9.7-2 USB Redirection support for Ubuntu Precise a LXer Syndicated Linux News 0 11-14-2011 11:30 AM
LXer: Set up Qemu&Spice&Libvirt 0.9.6 USB Redirection on Ubuntu 11.10 LXer Syndicated Linux News 0 10-16-2011 02:40 PM
How can I run Slackware with QEMU on Windows? asilentmurmur Slackware 2 10-29-2008 12:59 PM


All times are GMT -5. The time now is 09:47 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