I have an 8 GB multi-boot USB stick, created with
YUMI 2.0.6.4 (invaluable little tool!) that can multi-boot into:
- Hiren's Boot CD,
- Ultimate Boot CD, and
- Linux Mint 19 (Tara) Cinnamon 64-bit DVD.
I did the following:
$ sudo VBoxManage convertfromraw /dev/disk2 MultibootUSB.vdi
Converting from raw image file="/dev/disk2" to file="MultibootUSB.vdi"...
Creating dynamic image with size 8036285952 bytes (7664MB)...
and build a simple VM around it:
Code: Select all
$ VBoxManage showvminfo MultibootUSB
Name: MultibootUSB
Groups: /
Guest OS: Other/Unknown (64-bit)
UUID: 270a1588-614d-4529-99be-236fed361b56
Config file: /Users/Shared/VirtualBox/Machines/MultibootUSB/MultibootUSB.vbox
Snapshot folder: /Users/Shared/VirtualBox/Machines/MultibootUSB/Snapshots
Log folder: /Users/Shared/VirtualBox/Machines/MultibootUSB/Logs
Hardware UUID: 270a1588-614d-4529-99be-236fed361b56
Memory size 2048MB
Page Fusion: disabled
VRAM size: 128MB
CPU exec cap: 100%
HPET: disabled
CPUProfile: host
Chipset: piix3
Firmware: BIOS
Number of CPUs: 2
PAE: enabled
Long Mode: enabled
Triple Fault Reset: disabled
APIC: enabled
X2APIC: disabled
Nested VT-x/AMD-V: disabled
CPUID Portability Level: 0
CPUID overrides: None
Boot menu mode: message and menu
Boot Device 1: DVD
Boot Device 2: HardDisk
Boot Device 3: Not Assigned
Boot Device 4: Not Assigned
ACPI: enabled
IOAPIC: enabled
BIOS APIC mode: APIC
Time offset: 0ms
RTC: UTC
Hardw. virt.ext: enabled
Nested Paging: enabled
Large Pages: enabled
VT-x VPID: enabled
VT-x unr. exec.: enabled
Paravirt. Provider: Default
Effective Paravirt. Prov.: None
State: powered off (since 2019-03-30T15:30:14.376000000)
Monitor count: 1
3D Acceleration: enabled
2D Video Acceleration: disabled
Teleporter Enabled: disabled
Teleporter Port: 0
Teleporter Address:
Teleporter Password:
Tracing Enabled: disabled
Allow Tracing to Access VM: disabled
Tracing Configuration:
Autostart Enabled: disabled
Autostart Delay: 0
Default Frontend:
VM process priority: default
Storage Controller Name (0): IDE
Storage Controller Type (0): PIIX4
Storage Controller Instance Number (0): 0
Storage Controller Max Port Count (0): 2
Storage Controller Port Count (0): 2
Storage Controller Bootable (0): on
IDE (0, 0): /Users/Shared/VirtualBox/Machines/MultibootUSB/MultibootUSB.vdi (UUID: 3ed414f4-f43f-48ec-a2e3-7debece3dbfe)
IDE (1, 0): Empty
NIC 1: MAC: 08002765947F, Attachment: Host-only Interface 'vboxnet0', Cable connected: on, Trace: off (file: none), Type: 82540EM, Reported speed: 0 Mbps, Boot priority: 0, Promisc Policy: deny, Bandwidth group: none
NIC 2: MAC: 0800272F577F, Attachment: Internal Network 'VBoxIntNetwork', Cable connected: on, Trace: off (file: none), Type: 82540EM, Reported speed: 0 Mbps, Boot priority: 0, Promisc Policy: deny, Bandwidth group: none
NIC 3: MAC: 08002758BAED, Attachment: NAT Network 'VBoxNATservice', Cable connected: on, Trace: off (file: none), Type: 82540EM, Reported speed: 0 Mbps, Boot priority: 0, Promisc Policy: deny, Bandwidth group: none
NIC 4: MAC: 0800272B4275, Attachment: Bridged Interface 'en0: Wi-Fi (AirPort)', Cable connected: on, Trace: off (file: none), Type: 82540EM, Reported speed: 0 Mbps, Boot priority: 0, Promisc Policy: deny, Bandwidth group: none
NIC 5: disabled
NIC 6: disabled
NIC 7: disabled
NIC 8: disabled
Pointing Device: USB Tablet
Keyboard Device: PS/2 Keyboard
UART 1: disabled
UART 2: disabled
UART 3: disabled
UART 4: disabled
LPT 1: disabled
LPT 2: disabled
Audio: enabled (Driver: CoreAudio, Controller: HDA, Codec: STAC9221)
Audio playback: enabled
Audio capture: enabled
Clipboard Mode: Bidirectional
Drag and drop Mode: disabled
VRDE: disabled
OHCI USB: disabled
EHCI USB: disabled
xHCI USB: enabled
USB Device Filters:
<none>
Bandwidth groups: <none>
Shared folders:<none>
Capturing: not active
Capture audio: not active
Capture screens: 0
Capture file: /Users/Shared/VirtualBox/Machines/MultibootUSB/MultibootUSB.webm
Capture dimensions: 1024x768
Capture rate: 512kbps
Capture FPS: 25kbps
Capture options:
Guest:
Configured memory balloon size: 0MB
To my delight it worked right out of the box; audio "sung", all 4 networking cards got an IP, all tools, name it. Even the "Live Mint 19" that was installed in the USB worked. I guess because there was not any "custom" or "fancy" hardware to begin with, and the Live ones are more flexible regarding the hardware changes.
The only problem is that "convertfromraw" didn't take into account the 0-filled sectors, and the whole thing had to be "translated" to VDI-ish:
$ ls -al
total 15691784
drwx------ 4 socratis staff 136 30 Μαρ 17:38 .
drwxrwxrwx 108 socratis staff 3672 30 Μαρ 17:37 ..
-rw------- 1 socratis staff 3699 30 Μαρ 17:38 MultibootUSB.vbox
-rw------- 1 socratis staff 8034189312 30 Μαρ 17:38 MultibootUSB.vdi
$ VBoxManage showmediuminfo MultibootUSB.vdi
UUID: 3ed414f4-f43f-48ec-a2e3-7debece3dbfe
Parent UUID: base
State: created
Type: normal (base)
Location: /Users/Shared/VirtualBox/Machines/MultibootUSB/MultibootUSB.vdi
Storage format: VDI
Format variant: dynamic default
Capacity: 7663 MBytes
Size on disk: 7662 MBytes
Encryption: disabled
Property: AllocationBlockSize=
In use by VMs: MultibootUSB (UUID: 270a1588-614d-4529-99be-236fed361b56)
I then decided to be bold, and transform the VM into a real disk, the very thing that the OP is asking for. So I went for my "insiration" from the previous post, with another, new/virgin USB stick:
$ sudo VBoxManage clonemedium MultibootUSB.vdi /dev/disk2 --format RAW --existing
Syntax error: Specified options which cannot be used with --existing
Why not? That's a bummer...
Then I took out the "--existing" and I got the answer I was afraid of:
$ sudo VBoxManage clonemedium disk MultibootUSB.vdi /dev/disk2 --format RAW
0%...
Progress state: VBOX_E_FILE_ERROR
VBoxManage: error: Failed to clone medium
VBoxManage: error: Could not create the clone medium '/dev/disk2'.
VBoxManage: error: Raw: cannot create image '/dev/disk2' (VERR_ALREADY_EXISTS)
VBoxManage: error: Details: code VBOX_E_FILE_ERROR (0x80bb0004), component MediumWrap, interface IMedium
VBoxManage: error: Context: "RTEXITCODE handleCloneMedium(HandlerArg *)" at line 1071 of file VBoxManageDisk.cpp
If you can't overwrite an existing partition, there was only one thing to be done, but which defeats the whole purpose; create an intermediate IMG file which could be then transferred to the Physical disk with 'dd':
$ sudo VBoxManage clonemedium MultibootUSB.vdi MultibootUSB.img --format RAW
0%...10%...20%...30%...40%...50%...60%...70%...80%...90%...100%
Clone medium created in format 'RAW'. UUID: 4c476ace-af22-4216-9126-ef56ec47ed47
$ sufo dd if=MultibootUSB.img of=/dev/disk2 bs=1024
7847935+1 records in
7847935+1 records out
8036285952 bytes transferred in 5192.400374 secs (1547702 bytes/sec)
So I did go from Physical-to-Virtual just the way I had hoped, but not from Virtual-to-Physical, mainly because the "clonemedium" doesn't work with Physical devices. Something to ask the developers come Monday...