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.