Table of contents
3. Solve the problem that the shared folder fails after restarting
Problem Description
Running a program in a virtual machine wants to transfer the source code to the host, and there are also some files that I want to transfer from the host to the virtual machine. After the board cutting problem, I was not satisfied with the status quo, so I searched for content related to file sharing. The following is a set of solutions.
New issue: Shared folders disappear after restarting the virtual machine
solution
1. Shared clipboard
Step 1: Install vmware tools
Enter the following command in the terminal
sudo apt install open-vm-tools
sudo apt install open-vm-tools-desktop
Step 2: Restart the virtual machine
Note: At this point, the problem of sharing the clipboard has been solved
2. Shared folders
Step 3: Right-click the virtual machine in My Computer on the left, and click "Settings"
Step 4: Pay attention to the yellow part marked in the figure, change folder sharing to "always enable", click Add
Step 5: Click Next, enter the location and name of the shared folder on the host, click Next, and click Finish
Step 6: Open the terminal and enter ln -s /mnt/hgfs/shared file name~/Desktop/desktop shortcut name
ln -s /mnt/hgfs/共享文件名 ~/Desktop/桌面快捷名称
Next, put the files you want to share into the host/virtual machine shared folder
Note: The file sharing path is located in /mnt/hgfs/ and can be viewed
3. Solve the problem that the shared folder fails after restarting
Step 1: Remount the folder, terminal input:
sudo vmhgfs-fuse .host:/ /mnt/hgfs/ -o allow_other
If you still have virtual machine shared folders under /mnt/hgfs, skip this step
Step 2: Automatically mount the folder
Terminal input:
sudo su
vi /etc/fstab
Enter the letter i to modify
Add the red horizontal line code:
.host:/ /mnt/hgfs fuse.vmhgfs-fuse allow_other,defaults 0 0
As shown in the figure above, click Esc and enter: wq
This problem is solved.