Skip to main content
The 2024 Developer Survey results are live! See the results
replaced http://unix.stackexchange.com/ with https://unix.stackexchange.com/
Source Link

I was just trying to do nearly the exact same thing, albeit from Ubuntu. I didn't want to create an image of the entire hard drive, and it didn't seem like a good idea to me to use the physical disk with the VM. I finally found the solution:

  1. (Recommended) If you don't have a Windows disc or ISO, download an ISO. I used X17-59465.iso

  2. If desired, shrink the windows partition so the image size will be smaller. I prefer to do this from Linux using GParted (to avoid "umovable" files that are in use), then reboot to Windows, let it do a chkdsk, and reboot back into Linux.

  3. If mounted, unmount the windows partition just to make sure it doesn't change while imaging it

     sudo umount /windows
    
  4. Install the MBR package. On Ubuntu:

     sudo apt-get -y install mbr 
    
  5. Create an image of the MBR (change the device as necessary)

     sudo dd if=/dev/sda of=mbr.img bs=512 count=1
    
  6. Install a fresh MBR on the image, to get rid of GRUB

     sudo install-mbr mbr.img
    
  7. Create a raw VMDK image that will mirror the existing partition layout (change the device and partition as necessary)

     sudo vboxmanage internalcommands createrawvmdk -filename windows.vmdk -rawdisk /dev/sda -partitions 2 -mbr mbr.img
    
  8. Create a VDI image that will copy the data from the partitions selected in the previous step

     sudo vboxmanage clonehd windows.vmdk windows.vdi --format VDI
    
  9. Change the ownership of the new image file

     sudo chown $USER. windows.vdi
    
  10. Cleanup

     sudo rm mbr.img windows.vmdk windows-pt.vmdk
    
  11. (Optional) Compact the new disk image

     vboxmanage modifyhd windows.vdi --compact
    
  12. Create a new Windows 7 VM, using the image you just created for the hard drive

  13. You can try to boot the VM, but it might fail. If it does, boot the VM to the Windows disc/ISO → Repair your computer, and if given the option click Repair and restart

Sources:

I was just trying to do nearly the exact same thing, albeit from Ubuntu. I didn't want to create an image of the entire hard drive, and it didn't seem like a good idea to me to use the physical disk with the VM. I finally found the solution:

  1. (Recommended) If you don't have a Windows disc or ISO, download an ISO. I used X17-59465.iso

  2. If desired, shrink the windows partition so the image size will be smaller. I prefer to do this from Linux using GParted (to avoid "umovable" files that are in use), then reboot to Windows, let it do a chkdsk, and reboot back into Linux.

  3. If mounted, unmount the windows partition just to make sure it doesn't change while imaging it

     sudo umount /windows
    
  4. Install the MBR package. On Ubuntu:

     sudo apt-get -y install mbr 
    
  5. Create an image of the MBR (change the device as necessary)

     sudo dd if=/dev/sda of=mbr.img bs=512 count=1
    
  6. Install a fresh MBR on the image, to get rid of GRUB

     sudo install-mbr mbr.img
    
  7. Create a raw VMDK image that will mirror the existing partition layout (change the device and partition as necessary)

     sudo vboxmanage internalcommands createrawvmdk -filename windows.vmdk -rawdisk /dev/sda -partitions 2 -mbr mbr.img
    
  8. Create a VDI image that will copy the data from the partitions selected in the previous step

     sudo vboxmanage clonehd windows.vmdk windows.vdi --format VDI
    
  9. Change the ownership of the new image file

     sudo chown $USER. windows.vdi
    
  10. Cleanup

     sudo rm mbr.img windows.vmdk windows-pt.vmdk
    
  11. (Optional) Compact the new disk image

     vboxmanage modifyhd windows.vdi --compact
    
  12. Create a new Windows 7 VM, using the image you just created for the hard drive

  13. You can try to boot the VM, but it might fail. If it does, boot the VM to the Windows disc/ISO → Repair your computer, and if given the option click Repair and restart

Sources:

I was just trying to do nearly the exact same thing, albeit from Ubuntu. I didn't want to create an image of the entire hard drive, and it didn't seem like a good idea to me to use the physical disk with the VM. I finally found the solution:

  1. (Recommended) If you don't have a Windows disc or ISO, download an ISO. I used X17-59465.iso

  2. If desired, shrink the windows partition so the image size will be smaller. I prefer to do this from Linux using GParted (to avoid "umovable" files that are in use), then reboot to Windows, let it do a chkdsk, and reboot back into Linux.

  3. If mounted, unmount the windows partition just to make sure it doesn't change while imaging it

     sudo umount /windows
    
  4. Install the MBR package. On Ubuntu:

     sudo apt-get -y install mbr 
    
  5. Create an image of the MBR (change the device as necessary)

     sudo dd if=/dev/sda of=mbr.img bs=512 count=1
    
  6. Install a fresh MBR on the image, to get rid of GRUB

     sudo install-mbr mbr.img
    
  7. Create a raw VMDK image that will mirror the existing partition layout (change the device and partition as necessary)

     sudo vboxmanage internalcommands createrawvmdk -filename windows.vmdk -rawdisk /dev/sda -partitions 2 -mbr mbr.img
    
  8. Create a VDI image that will copy the data from the partitions selected in the previous step

     sudo vboxmanage clonehd windows.vmdk windows.vdi --format VDI
    
  9. Change the ownership of the new image file

     sudo chown $USER. windows.vdi
    
  10. Cleanup

     sudo rm mbr.img windows.vmdk windows-pt.vmdk
    
  11. (Optional) Compact the new disk image

     vboxmanage modifyhd windows.vdi --compact
    
  12. Create a new Windows 7 VM, using the image you just created for the hard drive

  13. You can try to boot the VM, but it might fail. If it does, boot the VM to the Windows disc/ISO → Repair your computer, and if given the option click Repair and restart

Sources:

added 377 characters in body
Source Link
bmaupin
  • 348
  • 3
  • 11

I was just trying to do nearly the exact same thing, albeit from Ubuntu. I didn't want to create an image of the entire hard drive, and it didn't seem like a good idea to me to use the physical disk with the VM. I finally found the solution:

  1. (Recommended) If you don't have a Windows disc or ISO, download an ISO. I used X17-59465.iso

  2. If desired, shrink the windows partition so the image size will be smaller. I prefer to do this from Linux using GParted (to avoid "umovable" files that are in use), then reboot to Windows, let it do a chkdsk, and reboot back into Linux.

  3. If mounted, unmount the windows partition just to make sure it doesn't change while imaging it

     sudo umount /windows
    
  4. Install the MBR package. On Ubuntu:

     sudo apt-get -y install mbr 
    
  5. Create an image of the MBR (change the device as necessary)

     sudo dd if=/dev/sda of=mbr.img bs=512 count=1
    
  6. Install a fresh MBR on the image, to get rid of GRUB

     sudo install-mbr mbr.img
    
  7. Create a raw VMDK image that will mirror the existing partition layout (change the device and partition as necessary)

     sudo vboxmanage internalcommands createrawvmdk -filename windows.vmdk -rawdisk /dev/sda -partitions 2 -mbr mbr.img
    
  8. Create a VDI image that will copy the data from the partitions selected in the previous step

     sudo vboxmanage clonehd windows.vmdk windows.vdi --format VDI
    
  9. Change the ownership of the new image file

     sudo chown $USER. windows.vdi
    
  10. Cleanup

     sudo rm mbr.img windows.vmdk windows-pt.vmdk
    
  11. (Optional) Compact the new disk image

     vboxmanage modifyhd windows.vdi --compact
    
  12. Create a new Windows 7 VM, using the image you just created for the hard drive

  13. You can try to boot the VM, but it might fail. If it does, boot the VM to the Windows disc/ISO → Repair your computer, and if given the option click Repair and restart

Sources:

I was just trying to do nearly the exact same thing, albeit from Ubuntu. I didn't want to create an image of the entire hard drive, and it didn't seem like a good idea to me to use the physical disk with the VM. I finally found the solution:

  1. (Recommended) If you don't have a Windows disc or ISO, download an ISO. I used X17-59465.iso

  2. Install the MBR package. On Ubuntu:

     sudo apt-get -y install mbr 
    
  3. Create an image of the MBR (change the device as necessary)

     sudo dd if=/dev/sda of=mbr.img bs=512 count=1
    
  4. Install a fresh MBR on the image, to get rid of GRUB

     sudo install-mbr mbr.img
    
  5. Create a raw VMDK image that will mirror the existing partition layout (change the device and partition as necessary)

     sudo vboxmanage internalcommands createrawvmdk -filename windows.vmdk -rawdisk /dev/sda -partitions 2 -mbr mbr.img
    
  6. Create a VDI image that will copy the data from the partitions selected in the previous step

     sudo vboxmanage clonehd windows.vmdk windows.vdi --format VDI
    
  7. Change the ownership of the new image file

     sudo chown $USER. windows.vdi
    
  8. Cleanup

     sudo rm mbr.img windows.vmdk windows-pt.vmdk
    
  9. (Optional) Compact the new disk image

     vboxmanage modifyhd windows.vdi --compact
    
  10. Create a new Windows 7 VM, using the image you just created for the hard drive

  11. You can try to boot the VM, but it might fail. If it does, boot the VM to the Windows disc/ISO → Repair your computer, and if given the option click Repair and restart

Sources:

I was just trying to do nearly the exact same thing, albeit from Ubuntu. I didn't want to create an image of the entire hard drive, and it didn't seem like a good idea to me to use the physical disk with the VM. I finally found the solution:

  1. (Recommended) If you don't have a Windows disc or ISO, download an ISO. I used X17-59465.iso

  2. If desired, shrink the windows partition so the image size will be smaller. I prefer to do this from Linux using GParted (to avoid "umovable" files that are in use), then reboot to Windows, let it do a chkdsk, and reboot back into Linux.

  3. If mounted, unmount the windows partition just to make sure it doesn't change while imaging it

     sudo umount /windows
    
  4. Install the MBR package. On Ubuntu:

     sudo apt-get -y install mbr 
    
  5. Create an image of the MBR (change the device as necessary)

     sudo dd if=/dev/sda of=mbr.img bs=512 count=1
    
  6. Install a fresh MBR on the image, to get rid of GRUB

     sudo install-mbr mbr.img
    
  7. Create a raw VMDK image that will mirror the existing partition layout (change the device and partition as necessary)

     sudo vboxmanage internalcommands createrawvmdk -filename windows.vmdk -rawdisk /dev/sda -partitions 2 -mbr mbr.img
    
  8. Create a VDI image that will copy the data from the partitions selected in the previous step

     sudo vboxmanage clonehd windows.vmdk windows.vdi --format VDI
    
  9. Change the ownership of the new image file

     sudo chown $USER. windows.vdi
    
  10. Cleanup

     sudo rm mbr.img windows.vmdk windows-pt.vmdk
    
  11. (Optional) Compact the new disk image

     vboxmanage modifyhd windows.vdi --compact
    
  12. Create a new Windows 7 VM, using the image you just created for the hard drive

  13. You can try to boot the VM, but it might fail. If it does, boot the VM to the Windows disc/ISO → Repair your computer, and if given the option click Repair and restart

Sources:

Source Link
bmaupin
  • 348
  • 3
  • 11

I was just trying to do nearly the exact same thing, albeit from Ubuntu. I didn't want to create an image of the entire hard drive, and it didn't seem like a good idea to me to use the physical disk with the VM. I finally found the solution:

  1. (Recommended) If you don't have a Windows disc or ISO, download an ISO. I used X17-59465.iso

  2. Install the MBR package. On Ubuntu:

     sudo apt-get -y install mbr 
    
  3. Create an image of the MBR (change the device as necessary)

     sudo dd if=/dev/sda of=mbr.img bs=512 count=1
    
  4. Install a fresh MBR on the image, to get rid of GRUB

     sudo install-mbr mbr.img
    
  5. Create a raw VMDK image that will mirror the existing partition layout (change the device and partition as necessary)

     sudo vboxmanage internalcommands createrawvmdk -filename windows.vmdk -rawdisk /dev/sda -partitions 2 -mbr mbr.img
    
  6. Create a VDI image that will copy the data from the partitions selected in the previous step

     sudo vboxmanage clonehd windows.vmdk windows.vdi --format VDI
    
  7. Change the ownership of the new image file

     sudo chown $USER. windows.vdi
    
  8. Cleanup

     sudo rm mbr.img windows.vmdk windows-pt.vmdk
    
  9. (Optional) Compact the new disk image

     vboxmanage modifyhd windows.vdi --compact
    
  10. Create a new Windows 7 VM, using the image you just created for the hard drive

  11. You can try to boot the VM, but it might fail. If it does, boot the VM to the Windows disc/ISO → Repair your computer, and if given the option click Repair and restart

Sources: