VirtualBox
Image manipulation
Raw disk image creation
The whole drive:
VBoxManage internalcommands createrawvmdk -filename IMAGE.vmdk -rawdisk /dev/DEV
or specific partitions:
... -partitions X,Y
Cloning VDI image
VBoxManage clonemedium [old-VDI] [new-VDI] --variant Standard
or
VBoxManage clonemedium [old-VDI] [new-VDI] --variant Fixed
or
VBoxManage clonemedium [old-VMDK] [new-VDI] --existing
Resizing VDI image
Expanding
VBoxManage modifyhd [VDI] --resize [megabytes]
Shrinking
Create new VDI image and clone existing image to the newly created one.
Guest Additions
Installation
Debian guest
# apt-get install virtualbox-guest-utils virtualbox-guest-x11
Shared drives
Mounting shared drives
mount -t vboxsf share /mnt/share
or fstab entry
share /mnt/share vboxsf defaults,noauto 0 0
OS specific tweaks
Linux
Setting console resolution for linux guest
/etc/default/grub
GRUB_CMDLINE_LINUX_DEFAULT="nomodeset"
GRUB_GFXMODE=1152x864
GRUB_GFXPAYLOAD_LINUX=keep
macOS
Setting screen resolution for EFI guest
VBoxManage setextradata "macOS (Mojave)" VBoxInternal2/EfiGraphicsResolution 1152x864
Setting processor type for macOS guest (relevant for AMD host processors)
VBoxManage modifyvm "macOS (Mojave)" --cpu-profile "Intel Core i7-6700K"
Running macOS guest on AMD CPU
$ VBoxManage modifyvm "macOS (Mojave)" --cpu-profile "Intel Core i7-6700K"