Gnome Boxes, create, resize, rename and backup

How to create a gnome box

  1.  You need to install gnome_boxes.
  2. You need the iso for the OS you are going to install.  Download the iso and save it.
  3. Do you have enough disk space for the new gnome-box?

MS Windows 10  URL

Fedora  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.

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.

ls ~/.local/share/gnome-boxes/images

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

done.

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

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.

open gnome-boxes

right click on crashy-2

scroll to properties

enter name mswindow10 in the box and press enter.

2. To change the name of the image, you must do the following (with gnome-boxes stopped and closed.)

cd ~/.local/share/gnome-boxes/images

mv crashy-2 mswindow10

cd ~/.config/libvirt/qemu

mv crashy-2.xml mswindow10.xml

edit mswindow10 and change two locations where crashy-2 exists to mswindow10.

virsh create ~/.config/libvirt/qemu/mswindow10

At the end of the above command, your gnome-box will be up and running under the new name, (but in background mode.)

How to backup a gnome box

create a file in your bin directory named backup-boxes.sh

add the following lines:

!/bin/bash
#===================================================
# backup a gnome boxes machine (aka domain)
#===================================================
date

n1=”.local/share/gnome-boxes/images/”
n2=$1

nnn=”$n1$n2″
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/*
rm $1.xml
else
echo “err— no such box. Must specify the box name.”
exit 1;
fi

date

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/

 

Up in the country.