I have configured the Virtual Box in my machine. Now, I have the original Virtual Box images available under the folder /home/original_vbox_images.
Now, the Virtual Box, as per the configuration, uses the images from the location /root/VirtualBox VMs/. I am planning on providing root access to the users in the guest OS installed in Virtual Box. So basically, the users can do anything with root access in the guest OS machine. (I expect the users to even execute rm -rf /).
Now, during reboot, I want the initial Virtual Box image that I have with me to be available again. So, I thought of doing something like this.
vi /root/Desktop/newscript.sh
cp -R /home/original_vbox_images/ /root/VirtualBox VMs/
Now, after giving execute permission on the script, I will add it to /etc/rc.local as below.
vi /etc/rc.local
sh /root/Desktop/newscript.sh
As of now, I have 10 GB HDD. However, I plan on increasing the capacity of the Virtual HDD.
The problem is, the copy might take longer time and won't be efficient. I am looking for some other elegant solution.
VBoxManage modifyhd *filename*.vdi --type immutable(where*filename*is the name of the VM image). For each VM you are using. This allows the user to do anything, but upon restart the "original" image is restored.