How to change the drive location for GNOME Boxes VMs

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

Change the location of vmboxes drive gnome
Image: cendeced/Adobe Stock

Boxes is a great tool for easy booting of Linux virtual machines. With Boxes you can create virtual machines from multiple preconfigured machines or even from your own ISO. These VMs run smoothly and seamlessly and can be booted up much faster than with a tool like VirtualBox.

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

But while Boxes is incredibly easy to use, it’s also not nearly as flexible as other solutions. In this case, there isn’t even a settings option in the restricted menu. You can only create virtual machines.

This shouldn’t be a deal breaker for anyone. However, I recently encountered a problem. On my production machine, my primary drive was dangerously low on space. It turns out boxing was a big part of this problem. Why? Because Boxes stores the virtual machine files in ~/.local/share/gnome-boxes which means it will eat up your local disk space pretty quickly. Given that GNOME Boxes doesn’t have any settings to speak of, what do you do?

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

What you need to change drive location for GNOME boxes

The only thing you need for this is a separate drive, which will house the new location of the GNOME boxes. This drive must also be accessible (with full read/write permissions) to the user running Boxes. Let’s make it happen.

How to move the GNOME Boxes directory

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

From the 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 that would be:

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

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

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

Remember to change the path to the new directory according to your needs, so it would be:

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

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

Congratulations, you just stopped GNOME boxes from giving you an untold headache. Maybe one day the developers will allow in future versions to move the save location outside of the user’s home. In the meantime, you have a chance to avoid the problem.

Subscribe to TechRepublic’s How To Make Tech Work on YouTube for the latest tech advice for business professionals from Jack Wallen.

Leave a Reply

Your email address will not be published. Required fields are marked *