Import a .img file (Windows7) into Qubes?

186 views
Skip to first unread message

Dima Puntus

unread,
Oct 23, 2016, 3:29:40 PM10/23/16
to qubes...@googlegroups.com
Is it possible at all? I'm trying to virtualize my windows machine and move entirely to Qubes. Some of the applications can't be reinstalled so fresh install isn't an option.

Thanks,
Dima

Marek Marczykowski-Górecki

unread,
Oct 23, 2016, 5:10:06 PM10/23/16
to Dima Puntus, qubes...@googlegroups.com
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
Should be possible, but probably you'll need to install some drivers (as
the emulated hardware is most likely different than your real one).
After that, you can simply copy your disk into .img file (using dd) and
point to that file when creating HVM, like:

qvm-create --hvm --label red --root-move-from=/path/to/file.img
some-vm-name

You'll need a lot of disk space for this... You can make it smaller by
first filling all free space of the (windows) disk with zeros (create
big file with zeros, then remove it). And then add "conv=sparse" to dd
command. It will not copy unused space.

- --
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQEcBAEBCAAGBQJYDScpAAoJENuP0xzK19csctoH/A+l9gz55qsArSJTtekdITew
/S2zv2mvEJykiz50utUV4IphMsuYxTg6K4siw757b3Y3/yYVOSD0+k/gaLiF7BTd
5yTGOoXvwrRO6uHeQwpjhe1SnRSBvp0rU80ELKaCsy7m3hPh+NWR5xnJYUC4VQuK
A9J9pJJKyoYgN13qJsurytrqebhb/7aYwEJtylBowKSafvAFYBSSpUIfr/JQ8ikL
A7oCuOYlsaZSio1rfMFwxR/azCOBINMghrj4zI0jAy3LPXdEEjXVMkZaAF43tWRq
kKiZXPhbtHY3idLQv1q4Wgp0Xu5VU4OUOWyGcpHyKVnpBHOuSR1M2/2j1aKcpjw=
=r5BK
-----END PGP SIGNATURE-----

Achim Patzner

unread,
Oct 23, 2016, 5:18:31 PM10/23/16
to qubes...@googlegroups.com
Am 23.10.2016 um 23:10 schrieb Marek Marczykowski-Górecki:
> On Sun, Oct 23, 2016 at 12:29:32PM -0700, Dima Puntus wrote:
> > Is it possible at all? I'm trying to virtualize my windows machine
> and move
> > entirely to Qubes. Some of the applications can't be reinstalled so
> fresh
> > install isn't an option.
>
> Should be possible, but probably you'll need to install some drivers (as
> the emulated hardware is most likely different than your real one).

And it depends on the installed software; some "enterprise-typical
software" for remote administration will make things hard to impossible
(I have a few machines) that really work hard on not being compatible
with Qubes, even as pure HVM without any XEN drivers).

> You'll need a lot of disk space for this... You can make it smaller by
> first filling all free space of the (windows) disk with zeros (create
> big file with zeros, then remove it). And then add "conv=sparse" to dd
> command. It will not copy unused space.

If wasting money is not a problem you can use a physical-to-virtual tool
to convert it to a VMware image which will do all those things on the
way and convert the VMware disk to a Xen image; the better ones will
also disable drivers that won't work in virtual environments.


Achim

jidar

unread,
Oct 23, 2016, 5:31:10 PM10/23/16
to qubes...@googlegroups.com
On 10/23/2016 04:18 PM, Achim Patzner wrote:
> If wasting money is not a problem you can use a physical-to-virtual tool
> to convert it to a VMware image which will do all those things on the
> way and convert the VMware disk to a Xen image; the better ones will
> also disable drivers that won't work in virtual environments.
>
>
> Achim
>

qemu-img has worked for an "enterprise" VM I use without any issue
(going from VMDK to raw/qcow2). If the disk is encrypted you might be
SOL though.

--jidar

mox...@gmail.com

unread,
Oct 24, 2016, 12:26:18 AM10/24/16
to qubes-users, mox...@gmail.com
That's what I did previously and it didn't work:

1. Converted to .VHD using Disk2VHD
2. Converted to .img using DD
3. qvm-create --hvm --root-move-from=/path_to .img

It didn't even start, can't detect hdd. The same procedure works in Virtualbox and KVM. The .img is about 50G while the physical disk where w7 is installed is 250G but only about 75G is used. The Qubes disk is 250G. I thought Xen would be able to auto set it to 50G dynamically expandable, same way other hypervisors do it. Is there a setting somewhere in the config files to enable the feature?

Drew White

unread,
Oct 24, 2016, 1:59:44 AM10/24/16
to qubes-users, mox...@gmail.com

check the size with "du -h" ?

Depending on how you made the image depends on how you get the result, and DD will write the zeros out too, and not be expanding. (as far as I found out)

There are many p2v options out there. But the easiest way would be to plug in your HDD to the system, and then use parted (or gparted) to copy the partitions to the img file.

Grzesiek Chodzicki

unread,
Oct 24, 2016, 10:12:54 AM10/24/16
to qubes-users, mox...@gmail.com
can the root.img be kept in an AppVM filesystem for this?

Marek Marczykowski-Górecki

unread,
Oct 24, 2016, 1:58:43 PM10/24/16
to Grzesiek Chodzicki, qubes-users, mox...@gmail.com
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256

On Mon, Oct 24, 2016 at 07:12:53AM -0700, Grzesiek Chodzicki wrote:
> W dniu niedziela, 23 października 2016 23:10:06 UTC+2 użytkownik Marek Marczykowski-Górecki napisał:
> > -----BEGIN PGP SIGNED MESSAGE-----
> > Hash: SHA256
> >
> > On Sun, Oct 23, 2016 at 12:29:32PM -0700, Dima Puntus wrote:
> > > Is it possible at all? I'm trying to virtualize my windows machine and move
> > > entirely to Qubes. Some of the applications can't be reinstalled so fresh
> > > install isn't an option.
> >
> > Should be possible, but probably you'll need to install some drivers (as
> > the emulated hardware is most likely different than your real one).
> > After that, you can simply copy your disk into .img file (using dd) and
> > point to that file when creating HVM, like:
> >
> > qvm-create --hvm --label red --root-move-from=/path/to/file.img
> > some-vm-name
> >
> > You'll need a lot of disk space for this... You can make it smaller by
> > first filling all free space of the (windows) disk with zeros (create
> > big file with zeros, then remove it). And then add "conv=sparse" to dd
> > command. It will not copy unused space.
>
> can the root.img be kept in an AppVM filesystem for this?

Not easily. You'll need to modify VM libvirt configuration and start the
VM with "qvm-start --custom-config=..." every time.

- --
Best Regards,
Marek Marczykowski-Górecki
Invisible Things Lab
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQEcBAEBCAAGBQJYDkvGAAoJENuP0xzK19csNg0H/3jkBKBH5ZF36PrBcrfhl5FY
GdEj4btZ0phjfXCIBHN9Z6E/MRe0l9X9lFW5gTeItg7XUnxBSrYhdc+zZeeuSqSM
7wvrX7arHCc7xtg4zFug60JYh+VBHN4xfFKneUk2hdThl8czBPFMn+EiKJjSdTch
vb+aj8ch2OgvJT0/vAjMz37rlyXJH5L6Kxz1IY7UaqiaUt1sPVd6RNQxSU5h3/+S
OaoMFFVKVMZgbWDucbsjifoycpHz46gR0Zk/9GvY9o9dlqVGXU5LkXv/HimkklDa
+XiK7FN9vq6IR7/0y/t6zc7RlaZapGcc+IYL4+s8h7pzyy1JWij8NuKRgkyR/6E=
=D9Bf
-----END PGP SIGNATURE-----

Achim Patzner

unread,
Oct 24, 2016, 4:13:20 PM10/24/16
to qubes...@googlegroups.com
Am 23.10.2016 um 23:30 schrieb jidar <ji...@faptastic.com>:
>
> qemu-img has worked for an "enterprise" VM I use without any issue (going from VMDK to raw/qcow2). If the disk is encrypted you might be SOL though.

It was the LanDesk Manager that killed me last time…


Achim
Reply all
Reply to author
Forward
0 new messages