How to make VirtualBox virtual machines destroy on computer restart
May 4, 2022
How to use VirtualBox on Linux so that virtual machines and their settings are not saved
The desire to completely destroy virtual machines is extraordinary and may be related to security and privacy. However, there are at least two ways to achieve the desired effect: the virtual machines will be destroyed as soon as the computer is turned off.
1. Using VirtualBox on a Live System
If you need VirtualBox without saving settings, then you can work in a Live system.
Boot into Live mode, run the command to install VirtualBox:
sudo apt install virtualbox virtualbox-ext-pack
After the command completes, you can start VirtualBox, create virtual machines in it and work in them.
On the next reboot, all changes made will be lost.
To get VirtualBox again, repeat the previous steps exactly.
2. Saving virtual machines in the /tmp directory
The second method involves using a regular Linux installation or Persistence.
If you are working with a Live system, select “Live USB Persistence” or “Live USB Encrypted Persistence” when booting.
Install VirtualBox:
sudo apt install virtualbox virtualbox-ext-pack
Then open VirtualBox and go to menu File → Preferences → General.
Set “Default Machine Folder” to /tmp
As a result, all virtual machines will store their settings in the /tmp directory.
On each reboot, the /tmp directory is automatically cleared.
As a result, after the reboot, the VirtualBox executable files will remain in the system, but all virtual machines will be deleted.
If you are running a Live system, you will also need to select “Live USB Persistence” or “Live USB Encrypted Persistence” on subsequent reboots.
Related articles:
- How to change the VeraCrypt interface language in Linux (85.3%)
- Why computer can't connect to Wi-Fi Hotspot on Android phone for a long time (SOLVED) (85.3%)
- GUI program to view and delete metadata in Linux (68.4%)
- How to check IP history for SSH sessions (68.4%)
- How to change configuration files when migrating from OpenVPN 2.4.* to OpenVPN 2.5.* (67%)
- How to find out which shell is in use in Linux (RANDOM - 50%)