Permanently mount shared folder in Mint Linux running on Virtual Box - virtualbox

I have installed mint Linux 8.0 on Virtual box.
I have created a shared folder in virtual box and i have mounted on linux using mount command.
The problem here is as soon as i shut down and restart linux the mounted folder will not available and (i need to re mount it again).
So how i can mount the shared folder permenently on linux so that i can access any time?

You can mount the shared folder on startup by adding it to fstab.

I am currently using:
Linux Mint 17.3
VirtualBox Version 5.0.16 with Guest Additions installed
The way that I auto mount the drives upon loading is by modifying the
rc.local file located in the /etc folder.
Instructions:
Create a folder on the host machine and create a folder on on the virtual machine
Note: I don't recall if the names need to be named same (including case). Also, I put all of my shared folders in my Documents folder.
Add the folder to the virtual machine's list of shared folders
Click on the virtual machine in VirtualBox
Click on Settings
Click on Shared Folders
Click on the add folder button (located on the right side of the window
Give the folder path, folder name, and click on the "Make Permanent" checkbox
Click the okay buttons
vim into rc.local by typing sudo vim /etc/rc.local in the virtual machine
Note: You will need super user privileges to modify the file which is why sudo is there.
Append the mount command.
Example:
mount -t vboxsf <Folder_Name> /home/< My_Name >/Documents/< Folder_Name >
Note: Be sure to check your syntax in the terminal before appending the command. You won't need a sudo here because it is implied. You will want to double check yourself here because a bad line will prevent further lines from being executed and it won't tell you that there was an error.
Save and exit. (I use wq)
The folder should be mounted when you restart your computer next time.

Related

Shared folders with VirtualBox and ReactOS

I want to have shared folders between my computer on Arch Linux and a virtual machine with ReactOS, but I don't know where the folder appears in ReactOS.
Where does it appear?
Do it as you would do on Windows:
Install VirtualBox Guest Additions in your ReactOS VM
Define your shares in your virtual machine configuration (through VirtualBox interface)
Reboot your ReactOS VM
If you checked automount in the VirtualBox GUI, they'll be already available, mapped as a drive letter in the explorer. If you didn't, then either go to 'Network Places' to find them, or directly type the UNC path in the explorer address bar, or use the 'net use' command line tool

How does one configure shared folders to automount for arch/manjaro linux VM in virtualbox?

I have a manjaro/arch virtual machine running in virtualbox with a windows 10 host. I have configured the shared folder I want to share in virtualbox as c:\tfs with the name tfs but it doesn't show up in the linux vm anywhere. I am able to mount it manually, but it won't auto-mount. I created the /media and /media/tfs folder in the VM, since it did not exist, and now the following command successfully manually mounts my folder sudo mount -t vboxsf tfs /media/tfs. How do I get the automount to work as intended without resorting to editing /etc/fstab?
It turns out that a few more steps are needed to configure the automount for shared folders of virtualbox. This tiny forum post was the key. You need to enable and start the virtualbox service vboxservice.service installed with the guest utils.
First ensure you have a folder /media, this is where it will try to mount your shared folders
Ensure that the guest utils are installed with sudo pacman -Q virtualbox-guest-utils
Enable service with sudo systemctl enable vboxservice.service
Start service with sudo systemctl start vboxservice.service
Reboot, I tried just logging out but reboot was necessary for me to start the service
Verify that your folder is now automounted in /media with sf_ prefix, mine is /media/sf_tfs
p.s. I also ran this command based on another post to add my username to the vboxsf group, although I'm not sure whether this one was necessary or not. sudo usermod -aG vboxsf brandon

How to locate a virtual machine files in my local disk VMware

I have a virtual machine running on VMware (VMware Workstation 12 player). I accidentally removed it from my inventory instead of deleting from disk. Now, where can I find the files on my local disk so that I can release the disk space..
Any help would be appreciated. Thank you.
The default location for virtual machine files is the folder My Virtual Machines in the My Documents folder of the home directory of the user who created the virtual machines. If you are logged in as this user, you can:
Select Start>Run. The Run dialog appears.
Type %userprofile%
Click OK to see the home directory.
If you are still unable to locate the virtual machine files, you must search the host hard drive for virtual machine configuration files.
To search the host hard drive:
Open a command prompt.
Enter this command:
C:>dir *.vmx /s/p
Every virtual machine has a directory with multiple files in it, including vm* files (vmdk, vmx, vmem etc.). The default path is under the user's "Documents" directory, in a directory named "Virtual Machines". For removal just delete the relevant machine's directory.

Virtualbox shared folder permissions [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
This question does not appear to be about a specific programming problem, a software algorithm, or software tools primarily used by programmers. If you believe the question would be on-topic on another Stack Exchange site, you can leave a comment to explain where the question may be able to be answered.
Closed 1 year ago.
Improve this question
I'm using Windows and Virtualbox with RedHat, putting it simple: I've created a shared folder so I can use Eclipse on my Windows OS and do some testing in Linux.
However, I can't access the shared folder with my user, I've logged in with root and used chmod 777 and even moved my user to the folder's group.
Whatever I do the result is the same:
/media/sf_sharedFolder/: Permission denied
What can I do? How can I access the shared folder with my user?
Add yourself to the vboxsf group within the guest VM.
Solution 1
Run sudo adduser $USER vboxsf from terminal.
(On Suse it's sudo usermod --append --groups vboxsf $USER)
To take effect you should log out and then log in, or you may need to reboot.
Solution 2
Edit the file /etc/group (you will need root privileges). Look for the line vboxsf:x:999 and add at the end :yourusername -- use this solution if you don't have sudo.
To take effect you should log out and then log in, or you may need to reboot.
Try this (on the guest machine. i.e. the OS running in the Virtual box):
sudo adduser your-user vboxsf
Now reboot the OS running in the virtual box.
This also works
sudo usermod -aG <group> <user>
Then restart vm
For the truly lazy (no typing, only totally easy copy and paste):
sudo usermod -aG vboxsf $USER
Log out and back in to make the change active.
I know it's a "me too" solution, but I am truly lazy and didn't find any other solution to appeal my innate apathy... :)
For VirtualBox(5.0.24) Host=Mac(El Capitan) and Guest=RHEL(7.2)
Start up your RHEL Guest VM and open up a Terminal. Make sure you have the Developer Tools installed.
sudo yum groupinstall 'Developer Tools'
And the Kernel headers package so that the Guest Additions script can update your kernel.
sudo yum install kernel-devel*
Once you have the prereqs in place its time to install the Guest Additions. With your running VM selected go to the VirtualBox menu and select Devices --> Insert Guest Additions CD image...
Allow a few seconds for the mount to occur and the install script to kick off. Once they have click the "Run" button in the dialog that popped up in your Guest VM.
After the script finishes right click the CD Icon on the Desktop and choose Eject. Then Shutdown the Guest VM.
Create the Shared folder in you Host system using Terminal, I usually put it in my Documents folder, and make sure that your user can access it.
sudo mkdir ~/Documents/RhelShared
sudo chmod 755 <user> ~/Documents/RhelShared
In the Oracle VM Virtual Box Manager select your VM and then click on the "Shared folders" configuration element. In the next dialog click on the Add Folder icon to the right of the Folders List.
Then in the popup window select the Host Folder you just created as the Folder Path and give it a Folder Name that will be used by the Guest VM, also tick the "Auto Mount" check-box.
After rebooting the Guest VM launch a terminal on the Host and check the user that is associated with the running VirtualBox Guest process is either your user, very likely, or in a group with access to the Shared folder.
ps aux | grep VirtualBoxVM
Then as per several of the previous answers in a Terminal on the Guest VM add your user to the vboxsf group.
sudo usermod -a -G vboxsf <user>
Log out and in again to pickup the change.
The shared folder should now be available and accessible as sf_rhelshared assuming you used the same names as I did in the popup window above.
To clarify the last post:
The VBoxManage command is:
VBoxManage setextradata <VM_NAME> VBoxInternal2/SharedFoldersEnableSymlinksCreate/<SHARE_NAME> 1
In my case the following was necessary:
sudo chgrp vboxsf /media/sf_sharedFolder
sudo adduser xxxxxxx vboxsf
where xxxxxx is your user account name. Log out and log back in to Ubuntu.
The issue is that the shared folder's permissions are set to not allow symbolic links by default. You can enable them in a few easy steps.
Shut down the virtual machine.
Note your machine name at Machine > Settings > General > Name
Note your shared folder name at 'Machine > Settings > Shared Folders`
Find your VirtualBox root directory and execute the following command.
VBoxManage setextradata "[vm name]" VBoxInternal2/SharedFoldersEnableSymlinksCreate/[shared folder] 1
Start up the virtual machine and the shared folder will now allow symbolic links.
After adding the user to the vboxsf group, you might need to completely log out of the gnome/xfce/??? session, because someone long ago decided that group affiliation should be cached at first login to the window system.
Or go old school:
% newgrp vboxsf
in any shell you want to use to access the folder. Luckily, newgrp looks up the group list for itself and doesn't used the cached values. You'll still need to log out and back in to access the folder from something other than a shell.
In my personal experience, it's difficult to enable shared folders in VirtualBox but it Is posible. I have a debian Buster guest virtual machine installed in my Windows 10 host.
I don't recognize exactly what did it, but I remember I went to Windows defender, my antivirus to see if they recognize VirtualBox as a program and not as a virus. After that, I press right click on the document file and allowed to share the folder and I gave click to some buttons there and accepted to share with groups and with muy user in Windows 10.
Also, I found a webpage of Windows about something like virtual machines that I don't remember well, but it took me to a panel and I had to change three things double clicking so when I update Windows, it recognizes my virtual machine. Also, in muy debian, in the terminal, using some command lines, muy VirtualBox recognized my user giving permissions, I based on some info in the Ubuntu forums. I put all what I remember.

mkdir: cannot create directory : Protocol error : Virtualbox Shared folder

I am trying to create folders and file in Virtualbox shared folder from Host to guest.
But i get this error mkdir: cannot create directory : Protocol error.
Below are steps i performed to share folder
1:My host OS is Ubuntu and my guest is Ubuntu.
2:I attached a share folder to virtualBox VM
Folder Path:/DR/vault/config
Folder:config selected automount and make permanent.
3:In Guest OS i installed virtualbox guest additions
4:I am trying to mount folder on /mount/config path
I added entry in guest's /etc/fstab as
/config /mount/config vboxsf rw,uid=1000,gid=1000 0 0
Path gets successfully mounted after Guest reboot also i can see the files created in /DR/vault/config(Guest) to /mount/config(Guest) but i cant create folder or file in /mount/config (Guest)
Please suggest if anything is missing or if there is any other way.
In my case, I had the drive full, clearing some space on the drive solved the issue.
I have found this is a problem with filename lengths on DOS hosts.
I have been using VirtualBox VMs as a form of containerised environment for deploying to a JBoss server, having experienced far too many problems with Windows environments for said technology.
I was using a shared-directory with my host machine as I was trying to keep the virtual machine lightweight (i.e. keeping IDEs in the host machine), then checking code into the shared directory for deployment with Maven. However, maven was giving some odd errors when the directory length grew to over 255 characters. Try looking at your file absolute path (type "pwd") and seeing if it's longer than 255.
I've resolved this problem with the following:
On the guest machine, add your user to vboxsf group: sudo adduser username vboxsf
Restart the host machine.
My host OS is Windows, my guest OS Ubuntu.
This might be an indication that the folder does not have the correct permissions on the Virtualbox host.
E.g. my headless Virtualbox server is running as "vbox" user, so I had to give that user write permissions on the host folder.
I had a similar issue, turns out that for me it was the number of folders or length of path name involved in mkdir.
typically I had :
mkdir -p /projects/bot/node_modules/webpack/node_modules/uglifyjs-webpack-plugin/node_modules/uglify-js/node_modules/yargs/node_modules/cliui/node_modules/center-align/node_modules/align-text/node_modules/kind-of/node_modules/is-buffer
Manually I could create up to the last part of the path but not the 'is-buffer' folder
I am working in vagrant and my projects folder is a shared VM folder, maybe/probably windows' max path length is the reason.