Page 1 of 1

Virsh - Auto attach disk at boot

Posted: 2018/01/27 05:51:15
by L4celek
Hi all,

not sure where to find this info

Every so often my server is rebooted (wife clips the plug, power outage etc..) and when this happens I have to go and rerun all the attach-disk commands and do a vgchange on my guest.

Is there some way of saving the current used config so this automatically happens in the future?

Re: Virsh - Auto attach disk at boot

Posted: 2018/01/27 14:03:58
by TrevorH
Do your virsh attach-disk commands but use --config to affect the xml it uses to start it up next time. Or use virsh edit to edit the xml and add the disks there.

Re: Virsh - Auto attach disk at boot

Posted: 2018/01/31 05:51:51
by Emma Taylor
Attach a disk image to a guest's CD-ROM drive:

Code: Select all

# virsh attach-disk <GuestName> sample.iso hdc --type cdrom --mode readonly
Disk attached successfully

Re: Virsh - Auto attach disk at boot

Posted: 2018/01/31 07:52:10
by L4celek
TrevorH wrote:Do your virsh attach-disk commands but use --config to affect the xml it uses to start it up next time. Or use virsh edit to edit the xml and add the disks there.
Thanks Trevor,

I saw this in the docs with a <config file> marker and didn't know which file to put there. It worked without the filename, and so I suspect this has done the trick :)