vbox Strange behaviour trying to create RAW vmdk disk



Reaction score: 31
Messages: 61

I'm trying to boot up Ubuntu that is installed in one of my disk's partition.
Following the Virtualbox manual to create the VMDK my command is:

VBoxManage internalcommands createrawvmdk -filename /usr/home/rod/VDI/ada0.vmdk -rawdisk /dev/ada0 -partitions 1,3

Partition 1 is the EFI partition (that contains grub entried from where I can boot Windows, FreeBSD or Ubuntu)
I was able to make this command work yesterday and created the ada0.vmdk file, but virtualbox wasn't able to detect boot entries in the EFI partition so it doesn't worked.

I decided to start over today, deleted the ada0.vmdk but wasnt able to recreate the vmdk doing exactly the same command as before, as root. For this time just got error 'VBoxManage: error: VMDK: could not open raw partition file '/dev/ada0''

Now if I set 'sysctl -w kern.geom.debugflags=0x10' the command worked again. Returned kern.geom.debugflags to it's default after vmdk creation but virtualbox wont load ubuntu with 'VERR_VD_IMAGE_READ_ONLY'.
Setting 'kern.geom.debugflags=0x10' worked also to load ubuntu partition in a VM.

From geom(4) manpage for kern.geom.debugflags:
   0x10 (allow foot shooting)
         Allow writing to Rank 1 providers.     This would, for example, al-
         low the super-user    to overwrite the MBR on    the root disk or write
         random sectors elsewhere to a mounted disk.  The implications are

I tried everything I described here logged as root (also running virtualbox as root)

And I never had these partitions 1 & 3 mounted in the FreeBSD session anyway.
Now this seems too radical having to change geom debugflags

I was afraid about trying to change /dev/ada0 permission bits. Is this OK?
I have root user in the 'vboxusers' group
Or, what is the correct way of doing this RAW access?