28

How should I transfer files from Windows to Ubuntu installed on Virtualbox? When I plugged in a USB, it only pops up in Windows.

How can I see it in Ubuntu?

  • I would love to do the opposite – user391339 Mar 1 '18 at 3:57
24

There are 2 ways, which I normally use

Option 1: Before booting up Ubuntu, inside Virtualbox Ubuntu VM settings, specify a share folder. Then after logged in to Ubuntu, create a new directory for example /media/vboxshared and mount that drive using the command sudo mount -t vboxsf SHARENAME /media/vboxshared. Enter your password when it prompts for the password.

Option 2: Before booting up Ubuntu, add a new Network adapter and select 'Bridged Adapter'. Then after logged in to Ubuntu, run the command ifconfig -a | more to get the ip address of that new network adapter. In Windows, use WinSCP or FileZilla to transfer the file to Ubuntu

  • 1
    Option 1 is not working for me! I get /sbin/mount.vboxsf: mounting failed with the error: No such device – J86 Jan 29 '15 at 11:59
11

Thank you for Alvin Sim's answer. Though it is clear, I still spend some time to do everything correct. OK, here are my detailed steps using Alvin Sim's Option 1.

  1. Before starting your Guest
  2. Go to VirtualBox Manager
  3. Select your interested Guest
  4. Go to Guest Settings
  5. In Guest Settings, scroll the left side-menu, and go to Shared Folders
  6. In Shared Folders, add your interested folder in the Host machine
  7. After adding your Host folder path, you will see an updated Folders List in Shared Folders. Remember your newly folder Name shown in this list. Say it is HOST_SHARE.
  8. Click OK and save your changes.
  9. Start your Guest machine
  10. In Guest machine, create a new folder, e.g. GUEST_SHARE
  11. In Guest terminal, type

    sudo mount -t vboxsf HOST_SHARE GUEST_SHARE`
    

    If you see the error mount: wrong fs type, bad option, bad superblock on …, this means you first need to install virtualbox-guest-utils.

    sudo apt-get install virtualbox-guest-utils
    

    Then run the mount command again

  12. You shall find your stuffs in this GUEST_SHARE folder.

  • Still works as of Ubuntu 16.04, Windows 10, and VirtualBox 5.1.14 – Lavamantis May 1 '17 at 19:19
  • 1
    Thank you so much for the "wrong fs type" error mention; I kept getting this error no matter which guide I was following and was puzzled, but got everything working after this "apt-get". I am surprised this utility package is not mentioned anywhere else. It wasn't obvious for a newer user like me. – Teemu Daniel Laajala Jan 21 at 18:02
  • 1
    Thank you! I found many other similar answers, but nobody else thought to mention the part about installing virtualbox-guest-utils – Shaul Behr Jan 23 at 12:36
6
sudo mount -t vboxsf SHARENAME /media/vboxshared 
  1. create your shared folder at your PC. for example "c:\SharedBoth"
  2. make sure you have selected your shared folder c:\SharedBoth at virtualbox menu "settings" - "shared folders" - "add" -"permanent/automount", before you start the ubuntu virtual machine.
  3. start the ubuntu terminal, type in command above,
    sudo mount -t vboxsf SharedBoth /media
  4. then check if folder sf_SharedBoth created in media folder Before you do the step 3, you need to make sure you have installed "guest additions"
3

In any case, you can easily make the USB key visible in the guest. From your question I imagine you run Ubuntu in a guest and the host is Windows.

Whenever you insert an USB key, if you want to see it in the guest proceed as follows:

  1. Cleanly unmount the USB from windows by clicking on the corresponding icon in the bottom right corner and selecting the "safely remove ..." option.

  2. In your VirtualBox window select the "Devices => usb devices" menu item on the top left guest window menu and select your USB key. It should appear in Ubuntu now.

This operation is equivalent to physically inserting your USB key in a USB port of your guest machine.

Otherwise, the other options are

  1. Shared folder as stated in laebshade's and Alvin Sim's answers. But that can be slow.

  2. FTP etc... as also stated in Alvin Sim"s answer (assumes you have an ftp server on your Windows host).

  3. A simple samba mount from the guest:

    mount -t cifs //winhost/share /home/yourname/mntpoint -o user=winusr%paswd,uid=0,gid=0,file_mode=0777,dir_mode=0777
  4. For small volumes and frequent synchronisation, open a dropbox account.

2

Which is the host, and which is the guest? Either way, Virtualbox has a sharing mechanism you can use; just install the Guest Additions as described in the documentation then setup a share in the VirtualBox configuration.

  • I went through that but when I tried to mount that I got an 'only root can do that' error. – GTyler Jul 7 '11 at 1:20
  • @laebshade: The OP already stated which way around this was in his question. Windows is the host, Ubuntu is the guest. – Caleb Jul 7 '11 at 12:07
2
  1. In virtual box, login to Ubuntu.
  2. In menu bar click devices -> USB devices -> Select your device (Pendrive).
  3. Then go to the Home folder. On the left you'll see your device.

protected by Community Oct 3 '15 at 11:19

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.