Menu
InformatiWeb Pro
  • Index
  • System admin
  • Virtualization

Login

Registration Password lost ?
FR
  • Windows Server
    • WMS 2012
    • WS2012 R2
    • WS2016
  • Citrix
    • Citrix NetScaler Gateway
    • Citrix XenApp / XenDesktop
    • Citrix XenServer
  • VMware
    • VMware ESXi
    • VMware vSphere
    • VMware Workstation
  • Microsoft
    • Hyper-V
  • RAID
    • Adaptec SmartRAID
  • UPS
    • APC Back-UPS Pro
  • InformatiWeb Pro
  • Virtualization
  • VMware
  • Courses
  • Learn in depth the VMware Workstation Pro virtualization solution
  • Transfer files between the host PC and VMs
26 / 52
  • Export VMware drivers
  • Print from virtual machines

Transfer files between the host PC and virtual machines (on Windows or Linux) with VMware Workstation 16 or 15

  • VMware
  • 15 May 2020 at 17:40 UTC
  • InformatiWeb
  • 2/2
Previous page

2. File transfer on Linux (Debian / Ubuntu)

2.1. Drag and drop and copy/paste

If you have properly installed VMware Tools on Linux, you can also use drag and drop (even if you use Windows as a host and Linux as guest and vice versa).

Important : for drag and drop to work with Linux-based guest OSs, you will need to have the open-vm-tools and open-vm-tools-desktop packages installed (as explained in our tutorial : VMware Workstation 16 / 15 - Install VMware Tools on Linux).
Otherwise, it may not work.

The file is moved.

2.2. VMware file sharing on Linux

As you can see, the option to create a network drive (to facilitate access to shared data from your virtual machine settings) is not available, because it's a feature only for Windows.
Select "Always enabled" to enable file sharing, and then click Add.

Important : although there are open-vm-tools and open-vm-tools-desktop packages for many Linux distributions, the VMware Tools (supplied with VMware Workstation) will also need to be installed for the file sharing system of VMware is supported by the guest OS.
To do this, refer to the tutorial cited at the top of this page.

Click Browse to share a folder on the physical PC and specify the name under which it will appear in the guest OS.

Leave the "Enable this share" box checked and check the "Read-only" box if you want this share to be read only.

Finally, click OK.

By default, if the VMware Tools are correctly installed, you will see that these shares will be available automatically in the folder : /mnt/hgfs

Bash

df -h

Plain Text

Filesystem         Size    Used Avail Used% Mounted on
udev               226M       0  226M    0% /dev
tmpfs               48M    4,3M   44M    9% /run
/dev/sda1           20G    4,3G   14G   24% /
tmpfs              238M       0  238M    0% /dev/shm
tmpfs              5,0M    4,0K  5,0M    1% /run/lock
tmpfs              238M       0  238M    0% /sys/fs/cgroup
tmpfs               48M     32K   48M    1% /run/user/116
tmpfs               48M     32K   48M    1% /run/user/1000
/dev/sr0           291M    291M     0  100% /media/cdrom0
vmhgfs-fuse        240G    120G  121G   50% /mnt/hgfs

To access this folder from the Debian GUI, open the File Explorer and click : Other Locations.
Then, double-click on Computer.

Then, enter into the "mnt/hgfs" folder.

In this folder, you will find the shared folder that you added in the settings of your virtual machine.

Now, if you want to automatically map your shared folders to another location, here's how to do it on the command line.

First, open a terminal and get root rights using the "su" or "sudo su" command (depending on the distribution used).

Bash

su

Unmount the folder automatically mounted by VMware :

Bash

umount /mnt/hgfs/

Check this by using the command :

Bash

df -h

As you can see, the "/mnt/hgfs/" mount point has disappeared.

Plain Text

Filesystem         Size    Used Avail Used% Mounted on
udev               226M       0  226M    0% /dev
tmpfs               48M    4,3M   44M    9% /run
/dev/sda1           20G    4,3G   14G   24% /
tmpfs              238M       0  238M    0% /dev/shm
tmpfs              5,0M    4,0K  5,0M    1% /run/lock
tmpfs              238M       0  238M    0% /sys/fs/cgroup
tmpfs               48M     32K   48M    1% /run/user/116
tmpfs               48M     36K   48M    1% /run/user/1000
/dev/sr0           291M    291M     0  100% /media/cdrom0

Create a folder where you want to mount your shared folders.
In our case : /vm-shares

Bash

mkdir /vm-shares

Warning : depending on the Linux kernel version of the distribution you are using, the file sharing provided by VMware Workstation will not work in the same way.
Indeed, as stated in the VMware official documentation, VMware Workstation uses different components depending on the version of your Linux kernel :

  • prior to Linux kernel version 4.0, VMware Tools used a driver for mounting shared folders from VMware Workstation.
  • since version 4.0 (included), VMware will use a FUSE file system (which is our case).
    By the way, the command "df -h" told us this : vmhgfs-fuse -- > /mnt/hgfs

Depending on the Linux kernel version of the guest OS, the command to use for mounting the shared folder, as well as the syntax to use in the "/etc/fstab" file, will not be the same.

To know the version of the Linux kernel used by your Linux distribution, use this command :

Bash

uname -r

In our case, this command shows us this :

Plain Text

4.9.0-8-amd64

To mount shared folders with a Linux kernel version below 4.0, use the command :

Bash

mount -t vmhgfs .host:/ /vm-shares

For version 4.0 or later of the Linux kernel, use the command :

Bash

/usr/bin/vmhgfs-fuse .host:/ /vm-shares -o subtype=vmhgfs-fuse,allow_other

Check from the GUI that the mounting was successful.

Or from the command line.

Bash

df -h

Plain Text

Filesystem         Size    Used Avail Used% Mounted on
udev               226M       0  226M    0% /dev
tmpfs               48M    4,3M   44M    9% /run
/dev/sda1           20G    4,3G   14G   24% /
tmpfs              238M       0  238M    0% /dev/shm
tmpfs              5,0M    4,0K  5,0M    1% /run/lock
tmpfs              238M       0  238M    0% /sys/fs/cgroup
tmpfs               48M     32K   48M    1% /run/user/116
tmpfs               48M     36K   48M    1% /run/user/1000
/dev/sr0           291M    291M     0  100% /media/cdrom0
vmhgfs-fuse        240G    120G  121G   50% /vm-shares

As you probably know (if you already knew folder mounts in Linux), this mounting is temporary and the folder "/vm-shares" you just mounted will not be available after restarting the virtual machine.

For the folder to be mounted each time the virtual machine starts, you will need to edit the "/etc/fstab" file.

Bash

vim /etc/fstab

Again, depending on the version of the Linux kernel used by your distribution, the syntax to use will not be the same.

If you are using a Linux kernel version earlier than version 4.0, you will need to use this syntax.
Source : VMware Workstation 12 Official Guide (page 97)

Plain Text

.host:/ /vm-shares vmhgfs defaults 0 0

Warning : if you use this syntax with version 4.0 or later of the Linux kernel, the virtual machine will not restart because this error will be displayed on reboot :

Plain Text

[FAILED] Failed to mount /vm-shares.
See 'systemctl status "vm\\x2dshares.mount"' for details.
[DEPEND] Dependency failed for Local File Systems.
...
You are in emergency mode. After logging in, type "journalctl -xb" to view
system logs, "systemctl reboot" to reboot, "systemctl default" or ^D to
try again to boot into default mode.

If you are using version 4.0 or later of the Linux kernel, use the new syntax (with reference to fuse).

Plain Text

.host:/ /vm-shares fuse.vmhgfs-fuse allow_other 0 0

Finally, type ":wq" to save and exit the file.
Then, restart your virtual machine :

Bash

reboot

Or type this so that the folders referenced in "/etc/fstab" are automatically mounted without having to restart the guest OS.

Bash

mount -a

Share this tutorial

Partager
Tweet

To see also

  • VMware Workstation - Boot a VM on the BIOS / EFI firmware

    VMware 3/16/2013

    VMware Workstation - Boot a VM on the BIOS / EFI firmware

  • VMware Workstation 15 - Installation on Linux

    VMware 2/7/2020

    VMware Workstation 15 - Installation on Linux

  • VMware Workstation 15 - Slice the virtual hard disk of a VM

    VMware 12/24/2021

    VMware Workstation 15 - Slice the virtual hard disk of a VM

  • VMware Workstation 15.5 - Convert a Virtual PC virtual machine to a VMware VM

    VMware 12/10/2021

    VMware Workstation 15.5 - Convert a Virtual PC virtual machine to a VMware VM

Comments

No comment

Share your opinion

Pinned content

  • Software (System admin)
  • Linux softwares
  • Our programs
  • Terms and conditions
  • Share your opinion

Contact

  • Guest book
  • Technical support
  • Contact

® InformatiWeb-Pro.net - InformatiWeb.net 2008-2022 - © Lionel Eppe - All rights reserved.

Total or partial reproduction of this site is prohibited and constitutes an infringement punishable by articles L.335-2 and following of the intellectual property Code.