How to share folders with VirtualBox virtual machines in CentOS

Source: Internet
Author: User
Environment: the host operating system is Windows 7, the virtual machine is CentOs5.5, and the virtual machine is VirtualBox3.2.12. 1. install the Enhancement Package (GuestAdditions) after CentOs5.5 is installed, run CentOs5.5 and log on. Select the device (Devices)-install the enhanced feature (InstallGuestAd) in the VirtualBox menu.

Environment: HostOperating systemYesWindows7. the virtual machine is CentOs5.5, and the virtual machine is VirtualBox 3.2.12.
1. install the Enhancement Package (Guest Additions)
After CentOs5.5 is installed, run CentOs5.5 and log on. Select "Devices"-> "Install Guest Additions" from the VirtualBox menu )".
You will find an extra disc icon on the CentOs5.5 desktop, which is automatically loaded to the folder/media/VBOXADDITION_3.2.10_66523 by default (the name may vary depending on the version ). Go to the command line terminal and enter:
# Cd/media/VBOXADDITION_3.2.10_66523

# Sudo bash./VBOXADDITION_3.2.10_66523-x86.run or shVBOXADDITION_3.2.10_66523-x86.run


Specify KERN_DIR = BaiduFind a solution
Install the kernel-devel and kernel-headers packages and configure the compiling environment.
Install gcc first
# Yum-y install gcc
Then install kernel-devel and kernel-headers.
# Yum install kernel-devel kernel-headers

After the installation is complete, make a connection
Ln-s/usr/src/kernels/2.6.18-194.26.1.el5-i686/usr/src/linux
Note: Be sure to perform this operation. Otherwise, the VirtualBox client will report an error during the installation process. "2.6.18-194.26.1.el5-i686" is the kernel version number. different versions may be different. you need to enter the version number based on your system kernel. # Uname-r can view the kernel version.

Run the command again after the installation is successful.
# Cd/media/VBOXADDITION_3.2.10_66523
# Sh VBOXADDITION_3.2.10_66523-x86.run

Restart
# Lsmod | grep vboxsf
Vboxsf 38088 0
Vboxguest 152104 7 vboxsf
The kernel module vboxsf is loaded.

2. set shared folders

After the restart is complete, click "Devices"-> allocate data space (SharedFolders) in the VirtualBox menu to add a shared folder. the fixed and temporary options indicate whether the folder is persistent. Try to use an English name. Here we use winshare.

3. Mount shared folders
Enter the virtual CentOs5.5 and enter the following command line terminal:
# Sudo mkdir/mnt/share
# Sudo mount-t vboxsf winshare/mnt/share

If/sbin/mount. vboxsf: mounting failed with the error: No suchdevice
The kernel module vboxfs is not loaded. check the following:
# Lsmod | grep vboxsf
If no result is returned, vboxsf is not loaded and executed.
# Sudo modprobe vboxsf

Normally, the mount-t vboxsf winshare/mnt/share shared folder should be accessible.
# Cd/mnt/share
# Ls-al

If you do not want to manually mount each time, you can add
Share/mnt/share vboxsf rw, gid = 100, uid = 1000, auto 0 0
This enables automatic mounting.

4. unmount
# Sudo umount-f/mnt/shared
Note: the name of the shared folder must not be the same as that of the Mount point (this is not an experiment, but it is not necessary ). For example, the mount point above is/mnt/share, if the name of the shared folder is also share, the following error message (http://www.virtualbox.org/ticket/2265) will appear during mounting ):
/Sbin/mount. vboxsf: mounting failed with the error: Protocolerror

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.