1

I have this disk setup:

Device     Boot     Start       End   Sectors   Size Id Type
/dev/sda1  *         2048 195944447 195942400  93,4G 83 Linux
/dev/sda2       195944448 937701375 741756928 353,7G  c W95 FAT32 (LBA)

sda1 is Linux Ubuntu 18.04 with a vbox running Windows 7.
sda2 is just data to be shared between Linux and VM Windows7.

How can I make my vbox with Windows 7 access this FAT32 partition?

2
  • Why not make a network share?
    – Pilot6
    Commented Feb 26, 2019 at 18:49
  • That is what I first did, but I always get access denied doesn't matter what I do to fix it. I mount it in every way possible but no success yet. Thus I would like to share the partition if possible. Commented Feb 27, 2019 at 23:13

1 Answer 1

0

Welcome,

this technique is called: "raw partition support" and you can find an excellent explanation in the Virtualbox manual chapter "9.9 Advanced storage configuration"

Preliminary i'll presume that you know (for read and write from your Linux host): how to

mount and unmount at your will the FAT32 partition (/dev/sda2) on your Linux host, and eventualy how to add a line in the /etc/fstab file to mount your FAT32 partition,

Your virtual machine is called "Windows 7", and

you only have 1 virtual disk attached to "Windows 7".

For accomplish the task you could type some commands like this (adapt to your needs!!):

$ sudo VBoxManage internalcommands createrawvmdk -filename /path/to/file_of_the_fat32_partion.vmdk -rawdisk /dev/sda -partitions 2

$ sudo VBoxManage storageattach "Windows 7" --storagectl "SATA" --port 1 --device 0 --type hdd --medium /path/to/file_of_the_fat32_partion.vmdk -rawdisk /dev/sda -partitions 2

The first command creates the

"...special VMDK image file which defines where the data will be stored..."

The second command attachs the

"...newly created image ..."

to your "Windows 7" virtual machine.

(I'm quoting chapter 9.9.1. from the Virtualbox User Manual).

Then you can start you "Windows 7" virtual machine and you will find the new partition (dev/sda2) surely over the letter D: (Note: It is possible that windows will ask you to restart the OS system after have finded the new partition).

To find out the name of your virtual machine this is the command to launch:

$ sudo VBoxManage list vms

To find out the parameters of: --storagectl "SATA" and --port 1 and --device 0

This command is helpfull (for the virtual machine "Windows 7" and you should adapt to your needs):

$ sudo VBoxManage showvminfo "Windows 7" | grep SATA

and you will see some like this:

Storage Controller Name (0)   SATA
SATA (0, 0): /path/to/your_actual_windows_7_virtual_machine_already_working.vdi (UIDD:....)
SATA (1, 0): Empty

Note that "SATA (1, 0): Empty" is where you will go to attach the partition (port 1, device 0) = --storagectl "SATA"and--port 1and--device 0


The other technique you should try first is to: - mount /dev/sda2 in some place on your Linux host (/mnt/diskFAT32 for example), and then with the Virtualbox Manager GUI on shared folders section just add a share of /mnt/diskFAT32 with automount and read/write permitions on it. This is, for me, the safest mode to start to "play" with a partition of your Linux host on the virtual machine "Windows 7".

I hope this could help you.

2
  • Thank you for your reply but none of the two solutions worked. The option -rawdisk belongs to the first command (createrawvmdk), I was able to create the raw vmdk but attaching the image returned an unknown error and the partition does not appear on the windows vm. I tried it all day long, and the second option was my very first attempt, I can list the shared folder on windows vm but it gives me access denied forever, no matter what I do, different users, allowing guest... Commented Feb 19, 2019 at 19:38
  • I just edited the answer and added "-rawdisk /dev/sda -partitions 2" at the end of the first command. Take in consideration that "Extension pack" should be installed on Virtualbox. Guess Additions should be installed on the guest. For Windows 7 if you need 3D enabled you should install guest additions in "Safe mode". For the Sata controller on Windows 7 guest, you could install the drivers "Intel Matrix Storage". What is the output of "sudo lsblk -f | grep sda" ? (without quotes). Commented Feb 26, 2019 at 19:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .