Shared Folders/samba with DOS guest on VBox 4.1.8
Posted: 20. Jan 2012, 14:55
After trying to follow the very old HOWTO and following some of the hints in this post, I finally managed to get Shared Folders in a DOS guest to work properly in the latest VirtualBox 4.1.8. Below, I'll describe each step necessary to get everything working.
The most important point to make clear -- which caused me the most confusion -- is that *true* Shared Folders are NOT SUPPORTED in DOS guests. You cannot use the VirtualBox Manager to point to a folder on the host, and make it visible in the guest. Instead, what can be done, is installing drivers in the DOS guest to access the virtual network adapter, which can then connect to a Samba share on your network (or the same PC as the host). This means you will need a Samba server setup which exports a shared folder in order to access it from the DOS guest.
NOTE: This HOWTO was written using Linux as the host, with samba-3.6.1 running on the same PC as the DOS guest. Windows hosts should be supported using the file sharing built-in to the OS, but I don't have any specific information on how to set that up. I also don't have any information for setting up a share on Mac OSX hosts either. If anyone can contribute this information, please post in this thread!
So, here's a list of what's required:
1) An already setup Samba server exporting the share you want to mount in the DOS guest.
2) An already installed DOS in a VirtualBox guest (MS-DOS, FreeDOS, doesn't matter). I used MS-DOS 6.22.
3) Microsoft Client for Networks for DOS from microsoft.com: DSK3-1.EXE (864,723 bytes) and DSK3-2.EXE (288,142 bytes)
4) Advanced Micro Devices PCNET NDIS2 driver from amd.com: wfw31.zip (166,262 bytes)
You do not need any other files, like the ones listed on the older HOWTO. Below are the MD5 hashes of the three files listed above. Feel free to check your downloaded files with these hashes, if you want:
2a0a0065e8080a3e46e55658415cfb76 *DSK3-1.EXE
532c91001ff4750407b00af7007e0984 *DSK3-2.EXE
24d38d936ef9040ec70ba0df9701016a *wfw31.zip
Right, let's get on with installing!
1) First, you'll need to unpack the AMD PCNET driver. Decompressing the .zip gives you an .exe -- which is a Windows executable, not a DOS one. Run the wfw31.exe within a Windows environment (I used wine-1.3.28), which will decompress the DOS drivers to the path: C:\pcnet\wfw31. The only two files you'll need from that directory are: oemsetup.inf and pcntnd.dos.
2) Next you need to actually get the necessary files into your DOS guest. The best way to do this is to create a floppy disk image. If you're on Windows, you can use WinImage to do this. If you're on Linux, using the loopback device to mount an image and copying the files inside is probably the easiest:
3) Open up the VirtualBox Manager Settings panel for your DOS guest. Under "Network", ensure the adapter is enabled -- "Attached to:" can be set to NAT. (I'll assume you already have a Floppy Controller added to the Storage Tree, since it was likely necessary to install DOS in the first place.)
4) Boot your DOS guest. Mount the floppy image you just created, and copy all of the files somewhere to the virtual hard disk, like C:\TEMP (you should avoid C:\NET as this is the default path which will be used by Microsoft Network Client!).
5) Run the DSK3-1.EXE and DSK3-2.EXE files in the temporary directory to decompress them. Three files (two .txt files and one .com file) in DSK3-1 also exist in DSK3-2, so you can either overwrite or skip them.
6) Run the decompressed setup.exe. This will start the install for the Microsoft Network Client v3.0 for MS-DOS.
7) When presented with a network adapter selection, pick "*Network adapter not shown on the list below ...". Enter the path to the oemsetup.inf file you copied earlier (C:\TEMP should be the default), and press Enter. The only selection available will be the "Advanced Micro Devices PCNET Family", so select that one. Next, you'll be prompted to configure network buffers for "best performance". Since DOS already has very little memory for applications with the network drivers loaded, I have only used the Network Client without performance (it's not that slow anyway), so hit 'C'.
8) Next you'll be asked to enter a user name. Enter the same login name you use to authenticate to your Samba server.
9) On the next screen, you'll be presented with a review of the setup options. First, we don't need the Full Redirector, so select "Change Setup Options", and under "Change Redir Options", pick "Use the Basic Redirector." The other options are fine for this menu, so select "The listed options are correct." once.
10) Next, you'll need to add TCP/IP support, so select "Change Network Configuration". Select "Add Protocol", then "Microsoft TCP/IP". You're done here, so select "Network configuration is correct."
11) Everything is now configured, so start the Network Client install by selecting "The listed options are correct." from the setup options review screen.
12) After the setup files have been copied, unmount the floppy disk image (if it's still mounted), and press Enter to reboot your DOS guest.
13) After rebooting, you'll be prompted to "Type your user name, or press ENTER if it is <USER>:". If the user name is correct, just hit Enter, otherwise enter the correct user name. Next, you'll need to enter your password to access the Samba server. After entering your password, you'll get a prompt saying "There is no password-list file for <USER>. Do you want to create one?" Select Y if you don't want to enter your password after every reboot, or N if you're security conscious and want to authenticate every time.
14) Finally at the DOS prompt, you can map a shared folder to your DOS guest with the command: "net use e: \\<sambaserver>\<sharename>". If you authenticated properly, and the share is accessible, you'll see "The command completed successfully.", hopefully like the screenshot below:
15) Once a "net use" command completes successfully, the drive will automatically be remapped after every reboot. To unmap a drive, use the command: "net use /d e:".
16) Feel free to remove the temporary C:\TEMP folder, as you no longer need it.
Congratulations, you now have Samba working in a DOS guest! Hopefully this helps others trying to get this working as well. If I missed anything, or if someone runs into a problem, let me know and I'll try to help out. Good luck!
Tip: Since this HOWTO describes how to connect using TCP/IP, the NWLink drivers are unnecessary. Edit your autoexec.bat and remove (or comment out by inserting "rem" in front of) the following two lines: "C:\NET\nwlink" and "C:\NET\nmtsr.exe". Not only will this will increase your available DOS memory by 16KB, but it will also provide a faster connection to the samba server on bootup.
The most important point to make clear -- which caused me the most confusion -- is that *true* Shared Folders are NOT SUPPORTED in DOS guests. You cannot use the VirtualBox Manager to point to a folder on the host, and make it visible in the guest. Instead, what can be done, is installing drivers in the DOS guest to access the virtual network adapter, which can then connect to a Samba share on your network (or the same PC as the host). This means you will need a Samba server setup which exports a shared folder in order to access it from the DOS guest.
NOTE: This HOWTO was written using Linux as the host, with samba-3.6.1 running on the same PC as the DOS guest. Windows hosts should be supported using the file sharing built-in to the OS, but I don't have any specific information on how to set that up. I also don't have any information for setting up a share on Mac OSX hosts either. If anyone can contribute this information, please post in this thread!
So, here's a list of what's required:
1) An already setup Samba server exporting the share you want to mount in the DOS guest.
2) An already installed DOS in a VirtualBox guest (MS-DOS, FreeDOS, doesn't matter). I used MS-DOS 6.22.
3) Microsoft Client for Networks for DOS from microsoft.com: DSK3-1.EXE (864,723 bytes) and DSK3-2.EXE (288,142 bytes)
4) Advanced Micro Devices PCNET NDIS2 driver from amd.com: wfw31.zip (166,262 bytes)
You do not need any other files, like the ones listed on the older HOWTO. Below are the MD5 hashes of the three files listed above. Feel free to check your downloaded files with these hashes, if you want:
2a0a0065e8080a3e46e55658415cfb76 *DSK3-1.EXE
532c91001ff4750407b00af7007e0984 *DSK3-2.EXE
24d38d936ef9040ec70ba0df9701016a *wfw31.zip
Right, let's get on with installing!
1) First, you'll need to unpack the AMD PCNET driver. Decompressing the .zip gives you an .exe -- which is a Windows executable, not a DOS one. Run the wfw31.exe within a Windows environment (I used wine-1.3.28), which will decompress the DOS drivers to the path: C:\pcnet\wfw31. The only two files you'll need from that directory are: oemsetup.inf and pcntnd.dos.
2) Next you need to actually get the necessary files into your DOS guest. The best way to do this is to create a floppy disk image. If you're on Windows, you can use WinImage to do this. If you're on Linux, using the loopback device to mount an image and copying the files inside is probably the easiest:
Code: Select all
# dd if=/dev/zero of=/tmp/floppy.img bs=1024 count=1440
1440+0 records in
1440+0 records out
1474560 bytes (1.5 MB) copied, 0.00308289 s, 478 MB/s
# losetup /dev/loop1 /tmp/floppy.img
# mkdosfs -F 12 -v /dev/loop1
mkdosfs 3.0.12 (29 Oct 2011)
/dev/loop1 has 2 heads and 18 sectors per track,
logical sector size is 512,
using 0xf0 media descriptor, with 2880 sectors;
file system has 2 12-bit FATs and 1 sector per cluster.
FAT size is 9 sectors, and provides 2847 clusters.
There is 1 reserved sector.
Root directory contains 224 slots and uses 14 sectors.
Volume ID is 53ed3d35, no volume label.
# mount -o loop /dev/loop1 /mnt/floppy
# cd /mnt/floppy
# cp ~bpoint/dl/msdos6/net/DSK3-1.EXE .
# cp ~bpoint/dl/msdos6/net/DSK3-2.EXE .
# cp ~bpoint/dl/msdos6/net/oemsetup.inf .
# cp ~bpoint/dl/msdos6/net/pcntnd.dos .
# umount /mnt/floppy
# losetup -d /dev/loop1
4) Boot your DOS guest. Mount the floppy image you just created, and copy all of the files somewhere to the virtual hard disk, like C:\TEMP (you should avoid C:\NET as this is the default path which will be used by Microsoft Network Client!).
5) Run the DSK3-1.EXE and DSK3-2.EXE files in the temporary directory to decompress them. Three files (two .txt files and one .com file) in DSK3-1 also exist in DSK3-2, so you can either overwrite or skip them.
6) Run the decompressed setup.exe. This will start the install for the Microsoft Network Client v3.0 for MS-DOS.
7) When presented with a network adapter selection, pick "*Network adapter not shown on the list below ...". Enter the path to the oemsetup.inf file you copied earlier (C:\TEMP should be the default), and press Enter. The only selection available will be the "Advanced Micro Devices PCNET Family", so select that one. Next, you'll be prompted to configure network buffers for "best performance". Since DOS already has very little memory for applications with the network drivers loaded, I have only used the Network Client without performance (it's not that slow anyway), so hit 'C'.
8) Next you'll be asked to enter a user name. Enter the same login name you use to authenticate to your Samba server.
9) On the next screen, you'll be presented with a review of the setup options. First, we don't need the Full Redirector, so select "Change Setup Options", and under "Change Redir Options", pick "Use the Basic Redirector." The other options are fine for this menu, so select "The listed options are correct." once.
10) Next, you'll need to add TCP/IP support, so select "Change Network Configuration". Select "Add Protocol", then "Microsoft TCP/IP". You're done here, so select "Network configuration is correct."
11) Everything is now configured, so start the Network Client install by selecting "The listed options are correct." from the setup options review screen.
12) After the setup files have been copied, unmount the floppy disk image (if it's still mounted), and press Enter to reboot your DOS guest.
13) After rebooting, you'll be prompted to "Type your user name, or press ENTER if it is <USER>:". If the user name is correct, just hit Enter, otherwise enter the correct user name. Next, you'll need to enter your password to access the Samba server. After entering your password, you'll get a prompt saying "There is no password-list file for <USER>. Do you want to create one?" Select Y if you don't want to enter your password after every reboot, or N if you're security conscious and want to authenticate every time.
14) Finally at the DOS prompt, you can map a shared folder to your DOS guest with the command: "net use e: \\<sambaserver>\<sharename>". If you authenticated properly, and the share is accessible, you'll see "The command completed successfully.", hopefully like the screenshot below:
15) Once a "net use" command completes successfully, the drive will automatically be remapped after every reboot. To unmap a drive, use the command: "net use /d e:".
16) Feel free to remove the temporary C:\TEMP folder, as you no longer need it.
Congratulations, you now have Samba working in a DOS guest! Hopefully this helps others trying to get this working as well. If I missed anything, or if someone runs into a problem, let me know and I'll try to help out. Good luck!
Tip: Since this HOWTO describes how to connect using TCP/IP, the NWLink drivers are unnecessary. Edit your autoexec.bat and remove (or comment out by inserting "rem" in front of) the following two lines: "C:\NET\nwlink" and "C:\NET\nmtsr.exe". Not only will this will increase your available DOS memory by 16KB, but it will also provide a faster connection to the samba server on bootup.