Add a second disk to Gnome Boxes

Gnome Boxes icon


If you are like me, who wonders how to add a second disk to a gnome boxes vm, but doesn't knows a lot about qemu-kvm xml configuration, then the following tips is for you too.

There is no way to do this in the Gnome Boxes preferences. The only way is to edit the configuration file.

To open the configuration file right click on the vm and then on Preferences. Click on the Edit Configuration at the bottom.

You'll see the configuration in xml format in the text editor that has opened up.

Now add the entry for the second disk. The whole entries for all disks can look like this:

    <disk type='file' device='disk'>

      <driver name='qemu' type='qcow2' cache='writeback' discard='unmap'/>

      <source file='/home/user/.local/share/gnome-boxes/images/main-disk.qcow2'/>

      <target dev='vda' bus='virtio'/>

      <address type='pci' domain='0x0000' bus='0x04' slot='0x00' function='0x0'/>

    </disk>

    <disk type='file' device='disk'>

      <driver name='qemu' type='qcow2'/>

      <source file='/path/to/second-disk.qcow2'/>

      <target dev='vdb' bus='virtio'/>

      <address type='pci' domain='0x0000' bus='0x07' slot='0x00' function='0x0'/>

    </disk>

    <disk type='file' device='cdrom'>

      <driver name='qemu' type='raw'/>

      <source file='/path/to/first-optical-disk.iso' startupPolicy='optional'/>

      <target dev='hdc' bus='sata'/>

      <readonly/>

      <address type='drive' controller='0' bus='0' target='0' unit='2'/>

    </disk>


Adjust the path and the name of the disk then save the file. That's all.

Don't forget to restart the Gnome Boxes to make it read the configuration file again.