[SOLVED] Virtual disk names

General support questions
Post Reply
MartinR
Posts: 714
Joined: 2015/05/11 07:53:27
Location: UK

[SOLVED] Virtual disk names

Post by MartinR » 2018/10/17 14:42:15

I'm building a test cluster using the host and three virtual machines (VM1, VM2 and VM3). I'm using a single disk partitioned into four: one partition for each VM and the fourth for cluster-wide storage. Up till now VM1, has had /dev/vda mapped to the host /dev/sdc1, VM2 had /dev/sdc2 and VM3 /dev/sdc3. You'll deduce that /dev/sdc4 was the cluster-wide partition.

At some point the device ordering has changed. Partition 4 (formatted as gfs2) has a label visible from the host: "lifeboat:gpfs", but partitions 1-3 do not. Furthermore partition 4 has an entry in /dev/disk/by-uuid, but partitions 1-3 do not. I tried editing (virsh edit) the XML for VM1 to change vdb from '/dev/sdc4' to 'LABEL=lifeboat:gpfs'* but virsh rejects it. I can edit /dev/sdc* to /dev/sdd* but that seems poor practice, I'd prefer to use a partition label, or failing that a UUID.

I expect that I'm missing something obvious, but a shove in the right direction would be appreciated.

*I've now also tried with UUID=string and that also fails.
Last edited by MartinR on 2018/10/18 21:57:16, edited 1 time in total.

hunter86_bg
Posts: 2019
Joined: 2015/02/17 15:14:33
Location: Bulgaria
Contact:

Re: Virtual disk names

Post by hunter86_bg » 2018/10/18 15:42:53

You can pass a 'serial number' for each disk to the VM.
Then your disks will have an entry like this one: '/dev/disk/by-id/scsi-your-serial-number' and will remain the same no matter when the kernel detects the disk.
For details how to define a serial number, check the example in first answer .

MartinR
Posts: 714
Joined: 2015/05/11 07:53:27
Location: UK

Re: Virtual disk names

Post by MartinR » 2018/10/18 21:56:46

Thank you. I knew it had to be something obvious, I just couldn't see it having gone off in the UUID= and LABEL= mindset. I just did a cut-and-paste from /dev/disk/by-id into the XML (using virsh edit) and all three VMs popped up like good 'uns right on cue.

Thanks.
Martin

Post Reply