Jack Wallen shows you how to move the directory containing GNOME Boxes virtual machines off your primary drive to prevent filling up your drive.

Image: cendeced/Adobe Stock

Boxes is a great tool for easily spinning up Linux virtual machines. With Boxes, you can create virtual machines from several pre-configured machines or even from your own ISO. These virtual machines run smoothly and seamlessly and can spin up much faster than using a tool like VirtualBox.

SEE: 40+ Open Source and Linux Terms You Should Know (TechRepublic Premium)

But while Boxes is incredibly easy to use, it’s also not as flexible as other solutions. In this case, there isn’t even a preference option in the limited menu. All you can do is create virtual machines.

This shouldn’t be a deal breaker for anyone. However, I recently ran into a problem. On my production machine, my main drive space was dangerously small. It turns out that a big part of this problem is the boxes. Why? Because Boxes stores the VM files in ~/.local/share/gnome-boxes, which means it will eat up your local storage pretty quickly. Given that GNOME Boxes doesn’t have any preferences, what do you do?

Remember, this is Linux, so there’s always a way. Let me show you how.

What you will need to change the device location for GNOME Boxes

The only things you’ll need for this is a separate drive that will hold the new GNOME Boxes location. This drive will also need to be accessible (with full read/write permissions) by the user running Boxes. Let’s make it so.

How to move the GNOME Boxes directory

For my demonstration, I will move the directory to an external drive that is permanently mounted via fstab to /media/jack/HALEY/. To do this, log into your Linux machine and open a terminal window.

From a terminal window, move the GNOME Boxes directory to the destination with the command:

mv ~/.local/share/gnome-boxes /path/to/directory

Where /path/to/directory is the destination. In my case it would be:

mv ~/.local/share/gnome-boxes /media/jack/HALEY

After moving the directory, you must create a symlink in the original location that points to the new destination. In my case this command would be:

ln -s /media/jack/HALEY/gnome-boxes/ ~/.local/share/gnome-boxes

Be sure to change the path to the new directory according to your needs, so it will be:

ln -s /path/to/directory ~/.local/share/gnome-boxes

Now when you create a new virtual machine, it will be stored in the new destination instead of taking up valuable space on your primary drive.

Congratulations, you’ve just stopped GNOME boxes from causing you untold headaches. Maybe someday, in future releases, the developers will make it possible to move the storage location outside of the user’s HOME. In the meantime, you have the means to avoid the problem.

Subscribe to TechRepublic’s How to make the technique work on YouTube for all the latest tech tips for business professionals from Jack Wallen.

How to change the drive location for GNOME Boxes VMs

Previous articlePoint-of-care tools fail: why we need a new class of converged endpoint platforms
Next articleThe Bowers & Wilkins Px8 aims to set the new benchmark for performance