Shared-folder not mounted anymore after reboot (Virtualbox -- Windows7) - linux

I work on Linux and for that I'm using virtual box. I actually need to share a folder between the host and the virtual machine.
My problem is, I know how to mount a shared file and it works. But as soon as I reboot the virtual box, it's like I've never done anything to share this folder. So I have to do it again and again every time I have to shut down my computer.
It's super aonying.
Does anyone have a solution for me please ?
That would be really appreciated !
Morgane

There is an option for Auto-mount within VirtualBox that should accomplish what you are trying to do.
Within the VirtualBox Manager Gui go to:
Settings -> Shared Folders
Either opt to create a new shared folder or edit an existing one.
The dialog box that appears has a check box for Auto-Mount. Selecting this option will mount the shared folder automatically each time you start the virtual machine.
After that you will need to add the following line to your /etc/rc.local
mount -t vboxsf shareName path/to/mount

Related

Delete files on a SMB3 share to recycle bin

I have a Synology NAS (DS1621+) in my local network. A shared folder XXX is crated with SMB3 and SMB2 MTU enabled. The "Enable Recycle Bin" option is also activated for this shared folder. And I can see there is a #recycle directory in this folder.
In my Windows10 Pro, I connect to my NAS by using "Map network drive" in Explorer. But when I try to delete something in this shared folder, it always makes a "delete permanent", and the recycle option is in gray (see image below).
I've learned that SMB protocol supports truly the recycling functionality. So how could I fix this problem?
Thanks for your help.
Solution
After searching in a Chinese forum, I find out that this is just a graphical misunderstanding. In fact, the file is NOT permanently deleted when "Enable Recycle Bin" is activated on NAS. It will be moved to #recycle directory on your shared folder, and you can access it through Synology DSM. So, you can delete any files in Windows on that SMB share without any worries about permanent lost. But in Windows, it always shows a warning panel of "permanent delete" when you do a removing action.
If you want to deactivate the warning panel of permanent delete in your Windows, you can go to your user foled in C:\Users\{username}, choose a system default folder, for example "Downloads". Right click on this folder, go to "Location" tab and change the location to your SMB share. In this case, the files you that you delete will be showed in Recycle Bin on your Windows desktop as usual.
References
简化操作:Win10删除群晖NAS文件不再显示【删除对话框】,Del即删除
From a windows point of view, every delete on a network share in permanent (not in windows recycle bin). It can't know that the NAS will do the move to its own recycle folder.

How to monitor a directory for file changes without using inotifywait?

I require a VM for developing and my host is where my IDE is. I have discovered that inotifywait does not work with shared folders, as I am sharing a local folder with my Linux guest using Virtual Box.
Basically, I have a simple bash script which needs to watch a directory and wait for any file changes. Inotifywait would be the best option but I cannot get it to work with my shared folder.
I was wondering if there is another option for my problem?
Depending on the sizes of the files and the nature of the changes you could:
Create a checksum (md5, CRC, SHA256) of the files and watch for changes
check the size of the files and watch for changes

Can create and delete files on mounted file system yet not create links or change ownership

I have a Xubuntu install running in a VM (VirtualBox) on a Windows 10 host. There is a directory on the Windows file system which I have mounted in the guest as a vboxsf. I think it's a Linux problem but that's the background in case it's relevant.
I have write access to this directory and all files within it (everything is -rwxrwxrwx). I can create, modify and delete files and directories in it. But trying to create a soft link (ln -s) or chown a file or directory to a different owner produces the following message:
ln: failed to create symbolic link 'myLink': Read-only file system
Have tried everything I can think of including unmounting and re-mounting. I don't understand how I am able to write, modify and delete files, yet a symbolic link produces "read only". Chown completes without an error or warning, but still hasn't changed ownership when done.
So eventually I found the answer to this. It's a bug / design decision in VirtualBox itself. See here:
https://www.virtualbox.org/ticket/10085
They used to support it and then realised it enabled a very hard to fix security vulnerability and so deliberately disabled linking in their shared folders. There's no great work around. You can edit your
to add the following:
<ExtraDataItem name="VBoxInternal2/SharedFoldersEnableSymlinksCreate/SHARE_NAME" value="1"/>
That comes with security risks so you must trust your guest. You can also (and this is what I might do) create an NFS mount point and connect to it in more old school ways.

Create a symbolic link on shared folder between guest Ubuntu and host Windows on VM Virtualbox

First of all let me apologize because I know there are many topics related to my issue. But I was not able to solve it so have to ask community. Not sure is it a Linux specific topic or VM Virtual box issue but here is my problem description:
I have a VM Virtual box with Ubuntu as a guest OS and Windows as a
host.
I shared folder between them. I also switched on option to be
able create symbolic links inside shared folder
Network is set up with NAT with Port Forwarding.
I have a PhpStorm installed on host operation system (in my case Windows) and all source file stored on guest operation system (Ubuntu).
So I want one folder have full access for guest and host so I can edit source code with PhpStorm and use the same source on Ubuntu. So from inside Ubuntu I have tried make symbolic link on shared folder. And here I have troubles (see an attachment).
On the left site here is my workspace folder with projects. And on the right I have tried to create a link inside shared (sf_) folder.
P.S. I do not wana use SSH deploy on phpStorm :(

How to package synced folder in vagrant box

What I want and achieved so far:
I want to create a custom vagrant box including a configuration and an application to reuse it in different client or serve environments.
Specifically I managed to create vagrant box, based on Ubuntu (precise/64), that has node.js installed, and package it on my dev machine with
vagrant package my-box --output filename.box
I am able to copy the filename.box to a remote server and vagrant up the box there. Node.js is installed within the vagrant box as expected.
The problem is, that I am not able to package the files in the synced folder vagrant. After starting the box on the remote server, the synced folder is empty
Therefore the application I developed on the local machine is not included in the box.
I tried to find a solution or any information about this behavior, but apart from this unanswered Post i couldn't find anything on the net.
My questions:
How can i preserve the files in the synced folder and package them in the filename.box for reuse in the server environment.
Is this even possible? Is the behavior I see a bug or is Vagrant not meant to package the files also?
I didn't do any configuration for the synced folders so far. Is it possible to package files from a different synced folder than the regular /vagrant?
If this is not possible at all, what are best practices for deployment or reusage of vagrant environments including applications?
1-3) No. This is not possible and not intended to work in the way you expect it to work.
Think of VirtualBox's shared folder as a mounted volume on a remote machine. It's not part of the file system of your virtual machine. The actual data is saved on the host machine, not the virtual one.
4) If you want to add data into your box, just copy your data over to the vm before you pack it. No need to use shared folders.
You cannot package a synced folder but what you are desiring is absolutely possible.
The easiest way to accomplish this is to put the data in some other directory in the box (thus ensuring it gets packaged with the box). And during the Vagrant box's provisioning, move or copy the data to the synced directory.
Once the box is up and running, the synced directory will have the files you want in it.

Resources