Current-Users archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Running NetBSD as VirtualBox VM using GPT slices



Hi,

The following probably won't be of much use, but perhaps is worth mentioning. 

I have an HP laptop with a main nvme disk running Windows 10 and VirtualBox. There is also a GPT-partitioned second 750GB disk, holding some data plus several EFI-booting systems, one of which is NetBSD-current. I boot it only from time to time to build -current for various architectures plus for pkgsrc upgrades - I haven't been able to get Xorg work in any way on this machine (Intel 530 + NVidia GeForce 950M; FreeBSD 12 works fine, I can provide info and testing in case someone has time to add support for this more than two years old laptop). I run several NetBSD VMs under VirtualBox Windows setup and it came to my mind that I should be able to run my bare-metal system under VirtualBox. This turned out to be trivial, as follows:
----- Find out the physical disk in use - #1 here
C:\temp> wmic diskdrive list brief
Caption                    DeviceID            Model                      Partitions  Size
SDXC Card                  \\.\PHYSICALDRIVE2  SDXC Card                  1           62536803840
WDC WD7500BPKX-00HPJT0     \\.\PHYSICALDRIVE1  WDC WD7500BPKX-00HPJT0     11          750153761280
SanDisk SD7SN6S-512G-1006  \\.\PHYSICALDRIVE0  SanDisk SD7SN6S-512G-1006  4           512105932800
"
# Check the partitions - 9,10 and 11 are those used by NetBSD, 9 being the EFI partition
C:\temp> vboxmanage internalcommands listpartitions -rawdisk \\.\PhysicalDrive1
Number  Type   StartCHS       EndCHS      Size (MiB)  Start (Sect)
1       0x00  0   /0  /0   0   /0  /0          61440         2048
2       0x00  0   /0  /0   0   /0  /0           8192    125831168
3       0x00  0   /0  /0   0   /0  /0         102400    142608384
4       0x00  0   /0  /0   0   /0  /0            512    352323584
5       0x00  0   /0  /0   0   /0  /0         300000    353372160
6       0x00  0   /0  /0   0   /0  /0            200    967772160
7       0x00  0   /0  /0   0   /0  /0           1024    968181760
8       0x00  0   /0  /0   0   /0  /0         130887    970278912
9       0x00  0   /0  /0   0   /0  /0            128   1238335488
10      0x00  0   /0  /0   0   /0  /0         102400   1238597632
11      0x00  0   /0  /0   0   /0  /0           8220   1448312832
# Create a vmdk containing only the three interesting for us partitions
C:\temp> VBoxManage internalcommands createrawvmdk -filename   c:\temp\a.vmdk -rawdisk \\.\PhysicalDrive1 -partitions 9,10,11

The last command will create a.vmdk and a-pt.vmdk. After that one creates a usual NetBSD-amd64 VM with the VirtuaBox interface, using the new vmdk as the system disk (a.vmdk, not a-pt.vmdk). Of course, as the system is EFI, ine will have to enable the EFI boot for the VM. 

One only has to reconfigure the networking after reboot. I'll try to figure out how to use different network configurations depending on whether the boot is physical or virtual. 

And I can run Xorg when I boot the VM, which might be useful for some pkgsrc development... 

(I've stolen the method from https://stackoverflow.com/questions/34371180/virtualbox-fail-to-bootup-guest-from-gpt-physical-partition# and applied it to NetBSD in EFI mode, no need to install any boot loaders). 

Chavdar 


Home | Main Index | Thread Index | Old Index