VirtualBox Windows host, Ubuntu guest installed on RAW partition
The -partitions
param of createrawvmdk
does NOT work as the way you thought. Instead of exposing the partition(s) you specified as disk(s) to the guest, it exposes the whole disk to the guest just like when you did not specify the -partitions
param. The only difference is, it masks the partitions you did not list so that you cannot read or write on them. You can use an ADDITIONAL image as the MBR for the guest, but it's limited to the boot code part (the guest will stick with the partition table on the raw disk). See 9.9.1.2. Access to individual physical hard disk partitions
for details: https://www.virtualbox.org/manual/ch09.html#rawdisk
GRUB does write boot code to the MBR if it is installed with the target i386-pc
(which is for BIOS/CSM booting). However, if it's installed with one of the EFI targets (x86_64-efi
/i386-efi
), it will put EFI executable on the EFI System Partition instead.
For the FITRIM ioctl to work, VirtualBox need to do proper SCSI passthrough (like, for example, Hyper-V does), so that the guest can identify and send commands to the disks (or, for SATA disks, the SCSI-ATA Translation Layer of Windows, which will translate SCSI UNMAP commands to ATA DSM/TRIM commands for SATA SSDs, for example) directly. As of VirtualBox 5.0, none of its storage controllers provides raw disk access in that level. It can be confirmed by checking and comparing outputs of sg3_utils (sg_vpd -a
, sg_readcap -16
and sg_inq
) on the Linux guest and the Windows host.