How to share a disk from XP host to FreeBSD guest



Reaction score: 4
Messages: 39

Host OS: Win XP (SP 3 ect)
Guest OS: FreeBSD x86 8.0 (release)
VirtualBox 3.1.8 r61349

Despite occasional comments currently the Virtual Box sharing is not available.

Best solution: samba (which in most cases auto loads when invoked on FBSD 8).

But even there some people have posted some amazingly complicated mixed with often unnecessary additional instructions.

Here is the steps:

1. On XP make sure File & Printer sharing is enabled.
Simplest way is right click on the folder you wish to share,
- tick the box that says "Share this folder on the network."
- if File & Printer sharing is not already enabled it will guide you through setting this up.
- Remember the name you gave for the share (defaults to the directory name).
If you want to write from the FreeBSD guest you will need to tick the next box: Allow network users to change my files.
(Any half decent firewall, even the standard one included on a home router will keep outside people off your shares - but the best protection is to force users to login to the XP host with a password (even if only for your own private use) - it actually makes XP more secure from net based sniffers/attacks and even viruses. I also [still] use ZoneAlarm Free - I also like to know what's trying to go out from my machine.

-- for my example I've shared D: \tmp on my drive as dtmp

2. (If not already running) start VirtualBox
- In the settings I have the network interface set to NAT (the default)
--(some posters suggested Bridged interface must be used for Samba to work- not so)
- Start the guest

3. Drop back to XP and open a cmd shell
a. type the command:
record the answer (mine is called box)

b. type the command:
look for the "Ethernet adapter VirtualBox Host-Only Network"
record the IP Address (probably same as mine:

4. Back to the FBSD guest, log in as root
- type the command:
mount_smbfs -I <answer-from-3.a> //<answer from 3.b>/XP-share-name/ FBSD-mount-point

when it asks for a password, just hit enter - that's right, [B]just hit enter*[/B]

[I]in my example:[/I]
    mount_smbfs -I //box/dtmp/ /mnt
check if it is mounted.

* on my XP I do have user accounts enabled and must login with a password to use it, and have no user accounts defined without a password, and user guest is disabled (mostly to stop me kids getting onto and trashing my pc)


5. Making things even easier for next time

edit the file /etc/nsmb.conf

skip to the end of the file and add the lines:

[BOX]              [I]<--use your hostname from 3.b, [B]must be in caps!!![/B][/I] 
addr=  [I]<--use your IP num from 3.a[/I]
[BOX]            [I]<--again your hostname from 3.b, [B]must be in caps[/B] (including the X)[/I]
Here some might suggest: 'oh so we have to add a user "X" to Win Xp.'
you do NOT have to add the user X to Win-XP!! (or FreeBSD)
let me repeat that: you do NOT have to add the user X to Win-XP!!

Lets test this:
umount the drive from freebsd,
try the command
mount -t smbfs //x@<host>/<xp-share>/ <fbsd-mountpoint>

[I]in my example:[/I]
    mount -t smbfs //x@box/dtmp /mnt
Making it even easier:
edit your /etc/fstab
add the line
//x@<host>/<xp-share>   <FBSD-mountpoint>  smbfs  rw,noauto  0 0
[I]    If you wish change the noauto to auto.[/I]

[I]for my example I add:[/I]
    //x@box/dtmp  /mnt  smbfs  rw,noauto 0 0
save it and issue the command
mount <FBSD-mountpoint>

[I]for my example:[/I] mount /mnt
And that is it.
(BTW: I did not add my host "box" into my /etc/hosts - also not needed.)
Will it work on Win 7? Dunno - perhaps somebody who "upgraded" (<-- pronounced ROTFLMAO) to W7 may want to try it, personally I trashed my Win 7 partition (now my VirtualBox play area) coz
- never used W7 for anything XP couldn't do,
- on my Q8400 actually measured as running slower than XP (just has a lot more "noise" so looks faster but it's not)
- It's an annoying system, far too soon got sick of pop-ups asking 'me to grant myself permission' to do even simple tasks (even what set options to stop that they still sometimes come back) - what is with that?, ugly menus, and childish cartoon style login.
For mine W7 treats even administrators like a 3 year old kid in a candy shop - i.e. won't trust you to do anything vaguely responsible, at all.


New Member

Messages: 9

It works fine in Windows 7. Just right-click on the folder you want to share, select sharing, choose who you want to share with and you're done.

What doesn't seem to work is using a bridged NIC adapter but it's easy enough to just enable a second NIC emulator.