在项目设计需求文档中提到,需要对当前的项目实现跨平台部署,包括Win、Linux、Solaris、Mac等。方法是使用InstallAnyWhere对所做的系统进行打包出基于各个平台的安装文件。当前就在做Solaris的测试,由于资源有限,只能使用VirtualBox安装Solaris的虚拟机,但问题来了,如何实现目录共享呢?这是个比较纠结的问题。经过网络的一番搜索,最终也没有能够找到解决之后。无奈求助别的有经验的team,最终得以解决。
基本环境:Win7+VirtualBox3.2.8+Solaris10
安装完成Solaris后需要安装VirtualBox的增强工具包,Devices->Install Guest Additions...
完成后关闭虚拟机,在设置中设置共享目录。
tips:网上说需要修改共享的名称不能使用默认名称,未经测试。
启动系统进入,打开Terminal,键入:
mount -F vboxfs [-o OPTIONS] sharename mountpoint
其中,sharename为你在VBoxManager 中设置的共享目录名,mountpoint是你需要挂在Solaris的哪个目录下面。
其实后来我查看了VirtualBox的帮助手册,发现全在里面,诶,经验不足呀,帮助手册中几乎写了你全部需要的内容。所以,建议前来浏览的各位在脑中留下“帮助手册”的印象。
以下是帮助手册中的内容(Linux 和 Solaris 都奉上):
-
In a Linux guest, use the following command:
mount -t vboxsf [-o OPTIONS] sharename mountpoint
To mount a shared folder during boot, add the following entry to /etc/fstab:
sharename mountpoint vboxsf defaults 0 0
-
In a Solaris guest, use the following command:
mount -F vboxfs [-o OPTIONS] sharename mountpoint
Replace
sharename
(use lowercase) with the share name specified withVBoxManage
or the GUI, andmountpoint
with the path where you want the share to be mounted on the guest (e.g./mnt/share
). The usual mount rules apply, that is, create this directory first if it does not exist yet.Here is an example of mounting the shared folder for the user "jack" on OpenSolaris:
$ id uid=5000(jack) gid=1(other) $ mkdir /export/home/jack/mount $ pfexec mount -F vboxfs -o uid=5000,gid=1 jackshare /export/home/jack/mount $ cd ~/mount $ ls sharedfile1.mp3 sharedfile2.txt $
Beyond the standard options supplied by the
mount
command, the following are available:iocharset CHARSET
to set the character set used for I/O operations (utf8 by default) and
convertcp CHARSET
to specify the character set used for the shared folder name (utf8 by default).
The generic mount options (documented in the mount manual page) apply also. Especially useful are the options
uid
,gid
andmode
, as they allow access by normal users (in read/write mode, depending on the settings) even if root has mounted the filesystem.
特此,结束几天的摸索,感谢同事的帮助!!
转载于:https://blog.51cto.com/coldplay/720269