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.
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 :
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
VMware 3/16/2013
VMware 2/7/2020
VMware 12/24/2021
VMware 12/10/2021
Pinned content
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.
No comment