Created
January 5, 2018 14:36
-
-
Save ba0f3/2e0711247ce2ae3a7765d403b72afd3c to your computer and use it in GitHub Desktop.
Use raw disk/partition as VirtualBox disk image
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# verify your disk layout | |
lsblk -o NAME,FSTYPE,UUID | |
# NAME FSTYPE UUID | |
# sda | |
# ├─sda1 ntfs ECEAA4D4EAA49BF8 <- reserve partition | |
# ├─sda2 ntfs 9CD2C43CD2C41C80 <- windows | |
# ├─sda3 | |
# ├─sda5 ext4 5f9e05c1-ace9-45ee-a884-ed1df68bdc3e <- /boot partition | |
# ├─sda6 ext4 bc1a75df-3625-4c1f-b53a-8ecc725f0d23 | |
# └─sda7 btrfs d305a656-442f-4579-96cf-dadc964c0be2 | |
# copy MBR | |
dd if=/dev/sda of=Windows.mbr count=1 bs=512 | |
# create raw disk image | |
# if you have grub installed on MBR, you must include partition contains /boot folder, this case it's sda5 | |
VBoxManage internalcommands createrawvmdk -filename Windows.vmdk -rawdisk /dev/sda -mbr Windows.mbr -partitions 2,5 | |
# That's all, use the created image as normal, and DONT forget to select Windows to boot if you are using grub |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment