Virsh - Auto attach disk at boot

General support questions
Post Reply
L4celek
Posts: 7
Joined: 2014/01/09 23:58:30

Virsh - Auto attach disk at boot

Post by L4celek » 2018/01/27 05:51:15

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?

User avatar
TrevorH
Site Admin
Posts: 33202
Joined: 2009/09/24 10:40:56
Location: Brighton, UK

Re: Virsh - Auto attach disk at boot

Post by TrevorH » 2018/01/27 14:03:58

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.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke

Emma Taylor
Posts: 58
Joined: 2015/04/11 04:59:25
Location: United Kingdom

Re: Virsh - Auto attach disk at boot

Post by Emma Taylor » 2018/01/31 05:51:51

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

L4celek
Posts: 7
Joined: 2014/01/09 23:58:30

Re: Virsh - Auto attach disk at boot

Post by L4celek » 2018/01/31 07:52:10

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 :)

Post Reply