Virtual CentOS access to shared files under Windows

Source: Internet
Author: User
Tags mkdir centos file permissions

With VirtualBox installed under Windows 7, and then VirtualBox virtual installation of CentOS 5.6, now you want to access some files in Windows under CentOS, you need to configure the data space in VirtualBox:

VirtualBox 4.0.8

[Root@zuantianyang-lnx ~]# Lsb_release-a

LSB Version:: core-4.0-amd64:core-4.0-ia32:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-ia32: Graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-ia32:printing-4.0-noarch

Distributor Id:centos

Description:centos Release 5.6 (Final)

release:5.6

Codename:final

1. Install VirtualBox Guest addition. Click "Install Enhancements" under the "Device" menu:

[Root@zuantianyang-lnx vboxadditions_4.0.8_71778]$ LS-LRT

Total 37520

-r-xr-xr-x 1 root root 278832 05-31 22:17 VBoxWindowsAdditions.exe

-r-xr-xr-x 1 root root 9284432 05-31 22:17 vboxwindowsadditions-amd64.exe

-r-xr-xr-x 1 root root 14664192 05-31 22:17 vboxsolarisadditions.pkg

-r-xr-xr-x 1 root root 7853516 05-31 22:17 vboxlinuxadditions.run

-r-xr-xr-x 1 root root 5523 05-31 22:17 runasroot.sh

-r-xr-xr-x 1 root root 6966 05-31 22:17 autorun.sh

-r-xr-xr-x 1 root root 647 05-31 22:17 AUTORUN. Inf

Dr-xr-xr-x 2 root root 4096 05-31 22:17 64Bit

Dr-xr-xr-x 3 root root 4096 05-31 22:17 32Bit

-r-xr-xr-x 1 root root 6190464 05-31 22:17 vboxwindowsadditions-x86.exe

[Root@zuantianyang-lnx vboxadditions_4.0.8_71778]$./vboxlinuxadditions.run

2. Find the data space in the VirtualBox settings, add the folders to be shared, select Auto-mount and fixed allocations:

Device--> Allocate data space--> add data space

I chose the whole Win7 under the C disk, data space location C:, Data space name c_drive

3. Confirm the existence of/sbin/mount.vboxsf

4. See if the BOXVFS module is loaded: Lsmod | grep Vboxvfs, if not loaded, execute modprobe VBOXVFS command load

5. Create a good mount point:

[Root@zuantianyang-lnx ~]# CD/

[Root@zuantianyang-lnx/]# mkdir win7_c_drive

[Root@zuantianyang-lnx/]# mount-t vboxsf c_drive win7_c_drive

The c_drive is the data space name, which corresponds to a folder under shared Windows.

6. If you want to restart the machine can also access Windows folder, after CentOS reboot automatically mount can, need to modify/etc/fstab, add

C_drive/win7_c_drive vboxsf defaults 0 0 Save, Mount Windows shared directory c_drive to Cenos/win7_c_drive

[Root@zuantianyang-lnx ~]# cd/etc/

[Root@zuantianyang-lnx etc]# VI fstab

/DEV/VOLGROUP00/LOGVOL00/EXT3 Defaults 1 1

Label=/boot/boot ext3 Defaults 1 2

TMPFS/DEV/SHM TMPFS Defaults 0 0

Devpts/dev/pts devpts gid=5,mode=620 0 0

Sysfs/sys Sysfs Defaults 0 0

PROC/PROC proc Defaults 0 0

/dev/volgroup00/logvol01 Swap Defaults 0 0

# automatically mount Windows7 c_drive to/win7_c_drive during startup, Byrneyang.

C_drive/win7_c_drive vboxsf Defaults 0 0

7. Cancellation of Mount

#sudo umount-f/mnt/shared

Building the VirtualBox Guest Additions kernel modules Faild

Friends who install Linux using VirtualBox often install the enhanced tools guest addtions, the main purpose of which is to enable the mouse to travel freely between the virtual machine and the real machine, automatically changing the x size according to the VirtualBox window size, and so on. But often when the installation will encounter setbacks!

The reason often lies in such a few things:

1. When you click Install Guest Additions, the desktop will appear in the Virtual installation CD folder, which is the enhanced toolkit, but if you need to install the enhanced package, you need to have at least Read and execute permissions, but the CD file can not modify the file permissions attribute, so you need to copy the CD file in the file , create a new folder on the desktop, paste the file into! Modify file permissions.

Here according to the virtual system you install different choose different file execution, if install is Linux, chmod 777 Vboxlinuxadditions-x86.run.

This is where the Add tool can be installed:./vboxlinuxadditions-x86.run (Note: Execute the Vboxlinuxadditions-x86.run under the current folder and require the command to be run at the terminal).

2. When you execute the./vboxlinuxadditions-x86.run in the terminal, the system may also prompt you:

Building the VirtualBox Guest Additions kernel modules [failed]

This hint often indicates that you have not installed a few necessary software packages such as-GCC-make.-kernel-default-devel-kernel-sources.-kernel-headers.

You can find them from the system installation CD and install them into the system, and when you install GCC, you may also be prompted to have the software package dependencies, the prompts to install the dependency pack!

When 3,mount data space, be aware that the name of the data space is not the same as the name of the folder you created under/mnt.

For example, to share the TempFolder folder in the host system, the default name for the data space is TempFolder, and the command can be:

sudo mkdir/mnt/share/

Basically there is no problem, restart your system will be more perfect!

Summary: If you encounter a dependency problem when installing the software, it is recommended that you use Yum to install the software to get rid of the dependency problem!

Related Article

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.