Linux virtualbox mount shared folders

Ubuntu Documentation

Introduction

This explains how to share files and folders (directories) between host and guest. (Files are shared over a network, in other words, you access remote files. For virtual machines, the network between host and guest is virtual since they are on the same real machine. But the steps you take are similar to setting up file sharing over real networks.)

Required: Virtualbox Guest Additions

Before sharing folders, you must install Guest Additions. For instructions on how to do this, see Guest Additions.

Creating a shared folder

Create a folder on the Host computer (ubuntu) that you would like to share, for example

Boot the Guest operating system in VirtualBox.

Select Devices -> Shared Folders.
Choose the ‘Add’ button.

/share

  • Optionally select the ‘Make permanent’ option
  • Prepare the folder

    Linux

    With a shared folder named share, as above, the folder can be mounted as the directory

    /host with the command

    Windows

    On the Windows Guest, run

    Now anything placed in this folder should be visible from the host in the

    Troubleshooting

    This can be done more generically with the following:

    For the above command if you get the following error:

    Then just change the vboxsf to vboxfs

    If you want to have it mount automatically upon each boot, put the mount command in /etc/rc.local Debian distros (e.g. Ubuntu 10.04 and later) HOWTO Use Shared Folders

    See Section 4.4 «Folder Sharing» in the VirtualBox documentation.

    Note: if you want to mount the directory as owned and writable only by root, omit the -o uid=1000,gid=1000 option to the mount command

    The above error could be one of the following.

    The name was not valid

    Make sure you specified the right name on the bash commands. If the guest machine is expecting «share» (as we did in the Prepare Host section) and you wrote

    it will not work.

    Ubuntu 10.04 host

    Note: Running on Ubuntu 10.04 host and Mint 14 as virtual system, the system would not accept a

    /share. It complained that it was not an absolute address. I entered /home/jim/share and it worked fine.

    Create a folder on the Host computer (ubuntu) that you would like to share, for example

    Boot the Guest operating system in VirtualBox.

    Select Devices -> Shared Folders.
    Choose the ‘Add’ button.

    Select ‘ /home/ /share‘ for Folder Path

  • Select ‘share’ for Folder Name
  • Optionally select the ‘Make permanent’ option
  • VirtualBox/SharedFolders (последним исправлял пользователь a-everard 2014-09-26 15:49:59)

    The material on this wiki is available under a free license, see Copyright / License for details
    You can contribute to this wiki, see Wiki Guide for details

    Источник

    Настройка общих папок в VirtualBox

    Для более комфортного управления виртуальной ОС, запущенной в VirtualBox, существует возможность создания общих папок. Они одинаково доступны из хостовой и гостевой систем и предназначены для удобного обмена данными между ними.

    Общие папки в VirtualBox

    Через общие папки пользователь может просматривать и использовать локально хранящиеся файлы не только на хост-машине, но и в гостевой ОС. Эта возможность упрощает взаимодействие операционных систем и избавляет от необходимости подключать флешки, переносить документы в облачные сервисы хранения и прочие способы хранения данных.

    Шаг 1: Создание общей папки на хост-машине

    Общие папки, с которыми в дальнейшем могут работать обе машины, должны располагаться в основной ОС. Они создаются точно таким же способом, как и обычные папки в вашей Windows или Linux. Кроме того, в качестве общей папки можно выбирать любую существующую.

    Читайте также:  Презентация история развития операционных систем windows

    Шаг 2: Настройка VirtualBox

    Созданные или выбранные папки необходимо сделать доступными для обеих операционных систем через настройку VirtualBox.

      Откройте VB Менеджер, выделите виртуальную машину и нажмите «Настроить».

    Перейдите в раздел «Общие папки» и нажмите на иконку с плюсом, что находится справа.

  • Поле «Имя папки» обычно заполняется автоматически, путем подстановки оригинального имени папки, но при желании его можно изменить на другое.
  • Активируйте параметр «Авто-подключение».
  • Если вы хотите запретить внесение изменений в папку для гостевой ОС, то поставьте галочку рядом с атрибутом «Только для чтения».

    Когда настройка будет закончена, выбранная папка появится в таблице. Можно добавлять несколько таких папок, и все они будут отображаться здесь же.

    Когда этот этап будет выполнен, потребуется воспользоваться дополнительным ПО, предназначенным для тонкой настройки ВиртуалБокс.

    Шаг 3: Установка гостевых дополнений

    Гостевые дополнения VirtualBox — это фирменный набор расширенных функций для более гибкой работы с виртуальными операционными системами.

    Перед установкой не забудьте обновить VirtualBox до последней версии во избежание проблем с совместимостью программы и дополнений.

    Перейдите по этой ссылке на страницу загрузок официального сайта ВиртуалБокс.

    Нажмите на ссылку «All supported platforms» и скачайте файл.

    На Windows и Linux он устанавливается по-разному, поэтому далее мы рассмотрим оба варианта.

    • Установка VM VirtualBox Extension Pack в Windows
    1. На панели меню VirtualBox выберите «Устройства» >«Подключить образ диска Дополнений гостевой ОС…».

      В Проводнике появится эмулированный диск с установщиком гостевых дополнений.

      Щелкните по диску два раза левой кнопкой мыши, чтобы запустить инсталлятор.

      Выберите папку в виртуальной ОС, куда будут установлены дополнения. Рекомендуется не менять путь.

      Отобразятся компоненты для установки. Нажмите «Install».

      На вопрос: «Установить программное обеспечение для данного устройства?» выберите «Установить».

      По завершении вам будет предложена перезагрузка. Согласитесь, нажав «Finish».

    2. После перезагрузки зайдите в Проводник, и в разделе «Сеть» вы сможете найти ту самую общую папку.
    3. В некоторых случаях сетевое обнаружение может быть отключено, и при нажатии на «Сеть» появляется такое сообщение об ошибке:

      Нажмите «Ок».
      Откроется папка, в которой будет оповещение о том, что сетевые параметры недоступны. Щелкните по этому уведомлению и в меню выберите пункт «Включить сетевое обнаружение и общий доступ к файлам».

      В окне с вопросом о включении обнаружения сети выберите первый вариант: «Нет, сделать сеть, к которой подключен этот компьютер, частной».

      Теперь, щелкнув по «Сеть» в левой части окна еще раз, вы увидите общую папку, которая называется «VBOXSVR».

      Внутри нее будут отображаться хранящиеся файлы той папки, которую вы расшарили.

      • Установка VM VirtualBox Extension Pack в Linux

      Установка дополнений в ОС на Linux будет показана на примере самого распространенного дистрибутива — Ubuntu.

        Запустите виртуальную систему и на панели меню VirtualBox выберите «Устройства» >«Подключить образ диска Дополнений гостевой ОС…».

      Откроется диалоговое окно, запрашивающее запуск исполняемого файла на диске. Нажмите на кнопку «Запустить».

      Процесс установки будет отображен в «Терминале», который затем можно будет закрыть.

      Созданная общая папка может быть недоступна со следующей ошибкой:

      «Не удалось показать содержимое этой папки. Недостаточно прав для просмотра содержимого объекта sf_Имя_папки».

      Поэтому заранее рекомендуется открыть новое окно «Терминала» и прописать в нем следующую команду:

      sudo adduser имя_учетной_записи vboxsf

      Введите пароль для sudo и дождитесь добавления пользователя в группу vboxsf.

    4. Перезагрузите виртуальную машину.
    5. После запуска системы зайдите в проводник, и в каталоге слева найдите ту папку, которую расшаривали. В данном случае общей стала стандартная системная папка «Изображения». Теперь ей можно пользоваться через хостовую и гостевую операционные системы.

      В других дистрибутивах Linux последний шаг может несколько отличаться, однако в большинстве случаев принцип подключения общей папки остается таким же.

      Таким несложным способом вы можете подключить любое количество общих папок в VirtualBox.

      Помимо этой статьи, на сайте еще 12315 инструкций.
      Добавьте сайт Lumpics.ru в закладки (CTRL+D) и мы точно еще пригодимся вам.

      Отблагодарите автора, поделитесь статьей в социальных сетях.

      Источник

      Linux virtualbox mount shared folders

      With the shared folders feature of Oracle VM VirtualBox, you can access files of your host system from within the guest system. This is similar to how you would use network shares in Windows networks, except that shared folders do not require networking, only the Guest Additions. Shared folders are supported with Windows 2000 or later, Linux, and Oracle Solaris guests. Oracle VM VirtualBox includes experimental support for Mac OS X and OS/2 guests.

      Shared folders physically reside on the host and are then shared with the guest, which uses a special file system driver in the Guest Additions to talk to the host. For Windows guests, shared folders are implemented as a pseudo-network redirector. For Linux and Oracle Solaris guests, the Guest Additions provide a virtual file system.

      To share a host folder with a virtual machine in Oracle VM VirtualBox, you must specify the path of the folder and choose a share name that the guest can use to access the shared folder. This happens on the host. In the guest you can then use the share name to connect to it and access files.

      There are several ways in which shared folders can be set up for a virtual machine:

      In the window of a running VM, you select Shared Folders from the Devices menu, or click on the folder icon on the status bar in the bottom right corner.

      If a VM is not currently running, you can configure shared folders in the virtual machine’s Settings dialog.

      From the command line, you can create shared folders using VBoxManage , as follows:

      There are two types of shares:

      Permanent shares, that are saved with the VM settings.

      Transient shares, that are added at runtime and disappear when the VM is powered off. These can be created using a checkbox in the VirtualBox Manager, or by using the —transient option of the VBoxManage sharedfolder add command.

      Shared folders can either be read-write or read-only. This means that the guest is either allowed to both read and write, or just read files on the host. By default, shared folders are read-write. Read-only folders can be created using a checkbox in the VirtualBox Manager, or with the —readonly option of the VBoxManage sharedfolder add command.

      Oracle VM VirtualBox shared folders also support symbolic links, also called symlinks , under the following conditions:

      The host operating system must support symlinks. For example, a Mac OS X, Linux, or Oracle Solaris host is required.

      Currently only Linux and Oracle Solaris Guest Additions support symlinks.

      For security reasons the guest OS is not allowed to create symlinks by default. If you trust the guest OS to not abuse the functionality, you can enable creation of symlinks for a shared folder as follows:

      4.3.1.В Manual Mounting

      You can mount the shared folder from inside a VM, in the same way as you would mount an ordinary network share:

      In a Windows guest, shared folders are browseable and therefore visible in Windows Explorer. To attach the host’s shared folder to your Windows guest, open Windows Explorer and look for the folder in My Networking Place s, Entire Network , Oracle VM VirtualBox Shared Folders . By right-clicking on a shared folder and selecting Map Network Drive from the menu that pops up, you can assign a drive letter to that shared folder.

      Alternatively, on the Windows command line, use the following command:

      While vboxsvr is a fixed name, note that vboxsrv would also work, replace x: with the drive letter that you want to use for the share, and sharename with the share name specified with VBoxManage .

      In a Linux guest, use the following command:

      To mount a shared folder during boot, add the following entry to /etc/fstab :

      In a Oracle Solaris guest, use the following command:

      Replace sharename , use a lowercase string, with the share name specified with VBoxManage or the VirtualBox Manager. Replace mountpoint with the path where you want the share to be mounted on the guest, such as /mnt/share . The usual mount rules apply. For example, create this directory first if it does not exist yet.

      Here is an example of mounting the shared folder for the user jack on Oracle Solaris:

      Beyond the standard options supplied by the mount command, the following are available:

      This option sets the character set used for I/O operations. Note that on Linux guests, if the iocharset option is not specified, then the Guest Additions driver will attempt to use the character set specified by the CONFIG_NLS_DEFAULT kernel option. If this option is not set either, then UTF-8 is used.

      This option specifies the character set used for the shared folder name. This is UTF-8 by default.

      The generic mount options, documented in the mount manual page, apply also. Especially useful are the options uid , gid and mode , as they can allow access by normal users in read/write mode, depending on the settings, even if root has mounted the filesystem.

      In an OS/2 guest, use the VBoxControl command to manage shared folders. For example:

      As with Windows guests, shared folders can also be accessed via UNC using \\VBoxSF\ , \\VBoxSvr\ or \\VBoxSrv\ as the server name and the shared folder name as sharename .

      4.3.2.В Automatic Mounting

      Oracle VM VirtualBox provides the option to mount shared folders automatically. When automatic mounting is enabled for a shared folder, the Guest Additions service will mount it for you automatically. For Windows or OS/2, a preferred drive letter can also be specified. For Linux or Oracle Solaris, a mount point directory can also be specified.

      If a drive letter or mount point is not specified, or is in use already, an alternative location is found by the Guest Additions service. The service searches for an alternative location depending on the guest OS, as follows:

      Windows and OS/2 guests. Search for a free drive letter, starting at Z: . If all drive letters are assigned, the folder is not mounted.

      Linux and Oracle Solaris guests. Folders are mounted under the /media directory. The folder name is normalized (no spaces, slashes or colons) and is prefixed with sf_ .

      For example, if you have a shared folder called myfiles , it will appear as /media/sf_myfiles in the guest.

      The guest properties /VirtualBox/GuestAdd/SharedFolders/MountDir and the more generic /VirtualBox/GuestAdd/SharedFolders/MountPrefix can be used to override the automatic mount directory and prefix. See Section 4.7, “Guest Properties”.

      Access to an automatically mounted shared folder is granted to everyone in a Windows guest, including the guest user. For Linux and Oracle Solaris guests, access is restricted to members of the group vboxsf and the root user.

      Copyright В© 2004, 2020 Oracle and/or its affiliates. All rights reserved. Legal Notices

      Источник

      Читайте также:  Как открыть динамический том windows
  • Оцените статью