Physical Partition as VB disk

Discussions related to using VirtualBox on Windows hosts.
Post Reply
nickreserved
Posts: 4
Joined: 26. Oct 2021, 20:00

Physical Partition as VB disk

Post by nickreserved »

Hi!
I have an SSD disk "\\.\PHYSICALDRIVE0" with 2 partitions: Partition 1 is Windows 10 and partition 2 is Lubuntu.
There is no GRUB in disk because installation of windows 10 destroy it.

I want to start Lubuntu from partition 2 from VirtualBox. So, I create a VM and assign a disk created from this command:

Code: Select all

VBoxManage.exe internalcommands createrawvmdk -filename LubuntuPartition.vmdk -rawdisk \\.\PHYSICALDRIVE0 -partitions 2
Running this VM results in "Missing Operating System".

How can I run correctly the Lubuntu from 2nd partition?
nickreserved
Posts: 4
Joined: 26. Oct 2021, 20:00

Re: Physical Partition as VB disk

Post by nickreserved »

Ok I fix it.

- You must create a second virtual disk about 20-30 MBs big, assigned to SATA port 0.
- You must assign physical partition to SATA port 1.
- You must create a virtual CD and boot from live CD Ubuntu Linux.
- On that linux, virtual disk is /dev/sda and physical partition is /dev/sdb2
- With cfdisk create a linux partition on /dev/sda and with mkfs.ext2 format it to ext2.
- Use Boot-Repair to avoid chroots, mounts, grub-installs and update-grub https://help.ubuntu.com/community/Boot-Repair)
Last edited by scottgus1 on 27. Oct 2021, 03:07, edited 1 time in total.
Reason: de-obfuscated link
scottgus1
Site Moderator
Posts: 20965
Joined: 30. Dec 2009, 20:14
Primary OS: MS Windows 10
VBox Version: PUEL
Guest OSses: Windows, Linux

Re: Physical Partition as VB disk

Post by scottgus1 »

It sounds like you used the tiny disk as a grub loader to point at the physical disk's partition. Interesting solution!

I wonder if a Linux LiveCD could have fixed the boot system so both Windows and Linux could boot on the SSD?
nickreserved
Posts: 4
Joined: 26. Oct 2021, 20:00

Re: Physical Partition as VB disk

Post by nickreserved »

Yes it can. But I am not interest now for physical boot to Linux.
So I work Linux only from VirtualBox.
nickreserved
Posts: 4
Joined: 26. Oct 2021, 20:00

Re: Physical Partition as VB disk

Post by nickreserved »

No.
My solution above can be simplified.

According to physical partition's VMDK file:

Code: Select all

# Extent description
RW 63 FLAT "LubuntuPartition-pt.vmdk" 0
RW 1044169 ZERO 
RW 1228924298 ZERO 
RW 723551535 FLAT "\\.\PHYSICALDRIVE0" 1229968530
RW 5103 ZERO 
It seems that whole disk is mapped with first sectors virtually stored in file "LubuntuPartition-pt.vmdk" and all other partitions zero'ed.
So, if you can manipulate virtually the start of physical disk, you can write a virtual Master Boot Record, saved in file "LubuntuPartition-pt.vmdk".

So, there is no need for a tiny virtual disk to boot the physical Linux partition. It is overkill.

Grub is installed in physical linux partition in directory /boot/grub.
Now, you can make the virtual MBR of disk to start grub directly from physical disk partition.

You can do this with the Boot-Repair program from a live linux CD.
fth0
Volunteer
Posts: 5668
Joined: 14. Feb 2019, 03:06
Primary OS: Mac OS X other
VBox Version: PUEL
Guest OSses: Linux, Windows 10, ...
Location: Germany

Re: Physical Partition as VB disk

Post by fth0 »

FWIW, if you know how to create the necessary MBR, you can also use the method documented in 9.7.1.2. Access to Individual Physical Hard Disk Partitions.
Post Reply