Until yesterday, I was happy with my partition schema:
Device Boot mounted at
/dev/nvme0n1p1 * /boot/efi
/dev/nvme0n1p2 swap
/dev/nvme0n1p3 / ext4
/dev/nvme0n1p6 /media/Volume ext4
/dev/nvme0n1p5 /home ext4
I also use Windows 10 with virtual box, the vdi is somewhere in /home.
Now I am forced to enlarge the sice of the vdi and, albeit possible, I don't want to have a 100GB vdi file in my /home. Because I appreciate the idea of being able to boot windows natively and I have > 100GB unparitioned space on my disk, so I
- created raw img:
VBoxManage internalcommands converttoraw Win7.vdi win10.img
- analyzed output:
parted win10.img unit B print
Number Start End Size Type File system Flags
1 1048576B 105906175B 104857600B primary ntfs boot
2 105906176B 54022924799B 53917018624B primary ntfs
3 54023684096B 54522806271B 499122176B primary ntfs diag
- created an unformatted partition at
/dev/nvme0n1p7
using gparted - copied the second partition from win10.img:
sudo dd if=.local/win10.img of=/dev/nvme0n1p7 skip=105906176 count=53917018624 iflag=skip_bytes,count_bytes
Now if I mount it with sudo mount /dev/nvme0n1p7 /media/x
, it complains that windows was not shutdown appropriately and that I shall mount it ro.
I fixed that usingntfsfix
. It looks like there's a solid windows installation on /dev/nvme0n1p7
.
Unfortunately, I cannot boot it, neither using virtual box not grub.
For VirtualBox, I created a raw disk using VBoxManage internalcommands createrawvmdk -filename win10.vmdk -rawdisk /dev/nvme0n1 -partitions 7
. After starting the vbox, a black screen appears and that's it.
For grub, I edited /etc/grub.d/40_custom
:
#!/bin/sh
exec tail -n +3 $0
# This file provides an easy way to add custom menu entries. Simply type the
# menu entries you want to add after this comment. Be careful not to change
# the 'exec tail' line above.
menuentry "Windows 10 (loader) (on /dev/nvme0n1p7)" {
insmod part_msdos
insmod ntfs
set root='(hd0,msdos7)'
chainloader +1
}
then I run sudo update-grub
. It displays error: not a valid root device
.
I read that grub cannot start windows directly, but only starts a dedicated windows bootloader (chainloader). I think my problem is that I don't have it.
My Questions: How can I obtain and install that windows bootloader? How can I boot the partition with vbox?