Меню Рубрики

Virtualbox linux mount shared folder

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

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

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

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

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

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

Шаг 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.

      Источник

      estorgio / Mounting VirtualBox shared folders on Ubuntu Server 16.04 LTS.md

      Update 28 July 2019: An updated version of this guide for Ubuntu Server 18.04 LTS is now available. Feel free to check it out.

      Update 23 May 2020: This guide is ALREADY OUTDATED and might no longer work with new versions of Ubuntu and VirtualBox. Please consider switching to the updated guide instead. I will no longer respond to the replies to this gist. Thank you.

      Mounting VirtualBox shared folders on Ubuntu Server 16.04 LTS

      This guide will walk you through steps on how to setup a VirtualBox shared folder inside your Ubuntu Server guest. Tested on Ubuntu Server 16.04.3 LTS (Xenial Xerus)

      Right-click your VM, then click Settings

      Go to Shared Folders section

      Add a new shared folder

      On Add Share prompt, select the Folder Path in your host that you want to be accessible inside your VM.

      In the Folder Name field, type shared

      Uncheck Read-only and Auto-mount, and check Make Permanent

      Once your VM is up and running, go to Devices menu -> Insert Guest Additions CD image menu

      Use the following command to mount the CD:

    1. Install dependencies for VirtualBox guest additions:
    1. Run installation script for the guest additions:
    1. Reboot VM
    1. Create «shared» directory in your home
    1. Mount the shared folder from the host to your

      /shared directory

    1. The host folder should now be accessible inside the VM.

    Make the mount folder persistent

    This directory mount we just made is temporary and it will disappear on next reboot. To make this permanent, we’ll set it so that it will mount our

    /shared directory on system startup

    1. Edit fstab file in /etc directory
    1. Add the following line to fstab (separated by tabs) and press Ctrl+O to Save.
    1. Edit modules
    1. Add the following line to /etc/modules and save
    1. Reboot the vm and log-in again
    1. Go to your home directory and check to see if the file is highlighted in green.

    If it is then congratulations! You successfully linked the directory within your vm with your host folder.

    How to point apache’s web directory to our folder in the host.

    1. Remove apache’s old html directory (WARNING! Backup your data if necessary)
    1. Add a symbolic link in its place

    This comment has been minimized.

    Copy link Quote reply

    fursserg commented Jun 15, 2018

    Some systems may need option comment=systemd.automount in their fstab entry (source).

    This comment has been minimized.

    Copy link Quote reply

    ssy341 commented Dec 7, 2018 •

    hi,
    this guide is a right way,Many thanks! I found so many ways, but all can’t work except this.
    below code can mount folder as root user

    but we hope mount folder as ubuntu user or other, try this:

    This comment has been minimized.

    Copy link Quote reply

    natrod commented Feb 5, 2019

    Great writeup, however if you plan on sharing your apache’s web directory through this method, i assume you would face permission issues since you would not be unable to change the group of the contents inside the shared folder. Do correct me if I’m wrong here please.

    This comment has been minimized.

    Copy link Quote reply

    binary-person commented Feb 14, 2019 •

    Nice job, only the mounting of the cdrom is a bit wrong. First, you should create a /media/cdrom if the user doesn’t have it already sudo mkdir /media/cdrom . The command should be sudo mount -t iso9660 /dev/cdrom /media/cdrom not sudo mount /dev/cdrom /media/cdrom (Reference: https://docs.oracle.com/cd/E10926_01/doc/owb.101/b12150/appbcdmount.htm). Nice job otherwise!

    This comment has been minimized.

    Copy link Quote reply

    estorgio commented Mar 5, 2019 •

    Hi everyone. I’m really surprised that my gist was getting some user engagement (comments, stars, forks, etc). To be honest I wrote this just for my own reference and I didn’t expect it would rank well on Google and get some traffic.

    Took me this long to notice since I usually don’t get notifications when somebody comments on my gist.

    @fursserg @ssy341
    While I was making this I used a fresh new install of Ubuntu Server 16.04.3 LTS with default VM settings on VirtualBox (with Windows 7 SP1 as host) so if you’re using a different setup from mine then chances are you might get some different results.

    @natrod
    As far as I can remember I didn’t encountered any issues with Apache with regards to file permissions. It could be an issue if you’re using linux as host. I used Win 7 while I was testing this so that could be a factor.

    @scheng123
    Thank you very much for the tip. I was just about to upgrade my guest to Ubuntu 18.04 LTS and I found out that CD-ROM mounting no longer works as expected. Maybe I should make a new version of this guide for Ubuntu 18.04 LTS when I have the time.

    This comment has been minimized.

    Copy link Quote reply

    timothy commented May 21, 2019

    I am using VertualBox 6 and Ubuntu 18.04. I do not see a checkbox that says «Make Permanent» as stated in step 7. On step 10 I get «mount: /media/cdrom: mount point does not exist.» error, and on step 15 I get «/sbin/mount.vboxsf: mounting failed with the error: Protocol error» error. Let me know if anyone knows what went wrong. Thanks!

    This comment has been minimized.

    Copy link Quote reply

    sagrawal-idrc commented May 31, 2019 •

    Host: Windows Server 2012 R2
    Guest: Ubuntu Server 18.04 LTS

    I had to additionally install following to get the shared folder mounted:

    sudo apt-get install virtualbox-guest-utils virtualbox-guest-dkms

    After rebooting, the shared folder appears under /media ; vboxadd-service.service still fails for me though.

    This comment has been minimized.

    Copy link Quote reply

    nuistzhou commented Jun 18, 2019

    Well, according to the chosen answer here, you could just skip steps 9 — 13 if the guest OS is Ubuntu, this works well when host OS is either Windows or Mac OS.

    This comment has been minimized.

    Copy link Quote reply

    sliawatimena commented Jul 25, 2019

    Host: Ubuntu 18.04 LTS
    Guest: Windows 10 Pro
    VirtualBox 6.0.10

    After I issue this command twice
    $ sudo apt-get install virtualbox-guest-utils virtualbox-guest-dkms
    I got make it permanent tick box. However in my Windows E: is a cdrom drive, not a harddisk as expected.

    How to correct this? Thank you very much in advance.

    Warmest Regards,
    Suryadi

    This comment has been minimized.

    Copy link Quote reply

    estorgio commented Jul 28, 2019 •

    I just posted an updated version of this guide for Ubuntu Server 18.04 LTS. Feel free to check it out.
    https://gist.github.com/estorgio/0c76e29c0439e683caca694f338d4003

    @sagrawal-idrc @sliawatimena
    This guide only works with Ubuntu 16.04 LTS. If you’re using the newer Ubuntu 18.04 LTS then please see the updated version of the guide.

    Источник

  • Добавить комментарий

    Ваш адрес email не будет опубликован. Обязательные поля помечены *

  • Редактор pdf бесплатно для mac os
  • Редактор mp3 тегов mac os
  • Редактор dsdt mac os
  • Редактировать hosts mac os
  • Расширения для редактирования фото mac os