Create, Resize, Rename, Backup and Recover
How to create a gnome box
Last updated 2019-06-21
- You need to install gnome_boxes.
- You need the iso for the OS you are going to install. Download the iso and save it.
- Do you have enough disk space for the new gnome-box?
MS Windows 10 URL
3. Bring up gnome boxes. Click on “new”.
4. It will ask for the URL or path. Give it the path and continue.
5. Follow instructions. Just like any other install.
6. Follow instructions in How to backup a gnome Box so that this box will be in the backup schedule.
6A. In gnome_boxes, right click on the properties and type over the name to rename the gnome box so you have a XML file with the short name and gnome-boxes displays the correct fqdn.
6B. In a terminal: cd .local/share/gnome-boxes/images
6C. virsh dumpxml whatever_the_current_box_name >Name.xml
6D. cp whatever_the_current_box_name >fqdn
Now the actual image has the fully qualified domain name.
6E. Use your editor to change Name.xml contents. Change all occurance of the current box name to fqdn.
6F in gnome boxes delete the box. (This deletes the image and deletes the box name from gnome-boxes.
6G Finally, in a command window, type
virsh define name.xml
How to resize a gnome box
list the directory where gnome images are kept and find the path and name of the image. Make sure gnome-boxes is stopped and closed.
Lets say you want to add 20 gigabytes to a box whose image name is crashy-5. Now issue the following command in a terminal window:
qemu-img resize ~/.local/share/gnome-boxes/images/crashy-5 +20G
How to clone a gnome box
To clone my box called crashy,I bring up gnome-boxes, Then I right click on the box name, left click on clone. It takes a few minutes, but that is all. The new box will be named crashy-2.
How to rename a gnome box
Backup the box first. (see below). This is done in two parts.
1. Rename the box i n gnome-boxes so that the name displayed to you is the one you want. Lets rename crashy-2 to mswindow10.
right click on crashy-2
scroll to properties, left click
enter name mswindow10 in the box. This changes the display name in gnome-boxes. Use the fully quaified domain name here.
close gnome boxes
2. To change the name of the image, you must do the following (with gnome-boxes stopped and closed.)
cp crashy-2.domain mswindow10.domain
cp crashy-2.xml mswindow10xml
Open gnome boxes, right click on the old crashy-2 box and then click delete.
rm crashy-2.domain (gnome boxes should have already deleted it.)
edit mswindow10.xml and change all locations where crashy-2 exists to mswindow10. Check the xml file for errors, parameters, number of cpu’s etc.
virsh define mswindow10.xml
At the end of the above command, your gnome-box will be up and running under the new name.
How to backup a gnome box
create a file in your bin directory named backup-boxes.sh
add the following lines:
# backup a gnome boxes machine (aka domain)
echo “Backing up $nnn”
if [ -f $nnn ]; then
virsh dumpxml $1 >$1.xml
tar cvzf $HOME/Boxes/$1-$2.tgz $1.xml .local/share/gnome-boxes/images/$1 .config/libvirt/* .config/gnome-boxes/*
echo “err— no such box. Must specify the box name.”
chmod +x bin/backup-boxes.sh
Add a line to your normal nightly backup script for each box. /home/wlperry/bin/backup-boxes.sh crashy.williamperry.com $NOW
Make sure that all gnome-boxes are stopped and gnome-boxes is closed.
This will create a backup of crashy in the dir /home/wlperry/Boxes/
How to recover a gnome box from backup
copy both the xml and box image to:
virsh define <box name>.xml
virsh define crash-2.xml