[fedora-virt] uniquely identifying drives in virt configurations
Richard W.M. Jones
rjones at redhat.com
Thu Feb 4 10:15:32 UTC 2010
On Wed, Feb 03, 2010 at 07:54:05PM -0500, Bill McGonigle wrote:
> I'm wondering what folks are doing for uniquely identifying plain disks
> in their virtual machine configs.
>
> For instance, I'm trying out the new Xen version and stuck a couple SATA
> drives in a box. I'd like to use them as physical devices, but not
> break my vm config if I re-cable the drives (or move them to another
> machine).
>
> I could create a degraded RAID mirror, and then reference them by mdX
> and let md worry about the UUID's, but that's ugly. If I were using
> luks on the drives they'd get tagged and could be referenced uniquely.
> Same with iscsi, those are available uniquely under /sys.
>
> Maybe something with device mapper? But I'm actually interested in
> benchmarking ZFS through Xen with this, so I'd hate to add another layer
> just for this purpose, since it's only needed at setup time. I could
> script some ugly hacks but I'd rather not.
>
> I was hoping to find a /sys/block/scsi/model/serialnumber type of thing
> symlinked back to the ../../devices/pci... , but I didn't. So, I hope
> I'm missing something obvious and folks here have this solved.
I wonder if you'd be better off uniquely identifying the filesystems
instead of the devices. Filesystems have a unique ID:
# tune2fs -l /dev/sda1 | grep UUID
Filesystem UUID: 868b1447-0ec5-41bf-a2e5-6a77a4c9b66d
and you can use this to mount the filesystem, eg in /etc/fstab:
UUID=868b1447-0ec5-41bf-a2e5-6a77a4c9b66d /boot ext3 defaults 1 2
This is well tested too -- all Fedora installs use UUIDs like this.
This will survive physical rearrangement of the disks containing the
filesystem, and even work if you decide to turn the filesystem into a
virtual disk.
Rich.
--
Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones
virt-df lists disk usage of guests without needing to install any
software inside the virtual machine. Supports Linux and Windows.
http://et.redhat.com/~rjones/virt-df/
More information about the virt
mailing list