The solution to the failure of the shared folder after the Linux restart in the VMware virtual machine

After restarting the virtual machine, I found that my shared folder is not displayed in the shared path.

1. Check the virtual machine settings

        I found that the shared folder set by my virtual machine is always enabled, why can't I find it after every restart? that's weird

 2. Use the command to check the current shared folder

It is found that the shared folder is mounted by checking the command.

vmware-hgfsclient

 3. Modify the /etc/rc.local file

sudo chmod a+x /etc/rc.local
sudo vi /etc/rc.local 

If /etc/rc.local is an empty file, add the following content

#!/bin/sh -e
sudo vmhgfs-fuse .host:/ /mnt/hgfs -o allow_other
sudo vmhgfs-fuse .host:/ /mnt/hgfs -o nonempty -o allow_other

If it is not an empty file, append the following at the end

sudo vmhgfs-fuse .host:/ /mnt/hgfs -o allow_other
sudo vmhgfs-fuse .host:/ /mnt/hgfs -o nonempty -o allow_other

If you do not add the above two commands to the /etc/rc.local file, just execute these two commands on the command line, the mounted folder will also take effect, but you must manually execute these two commands every time you restart the virtual machine command, so I added these two commands to the /etc/rc.local file, so that it will be executed automatically every time it is turned on.

4. Restart the virtual machine

reboot

After restarting the virtual machine, we found that the shared folder we mounted took effect. I hope I can help you.

Guess you like

Origin blog.csdn.net/m0_64655190/article/details/130614466