[sf-lug] Xen block device mappings
Michael Paoli
Michael.Paoli at cal.berkeley.edu
Sun Apr 3 14:53:07 PDT 2011
Thought I posted something like this somewhere once before, but couldn't
find it, so ... figuring it once again ...
Though one can look at the Xen configuration file(s), things can also be
changed dynamically (e.g. temporary) and not reflected in configuration
file, or Xen guest could be created and started without a configuration
file. So, in any case, sometimes one wants to check to see what
device(s) are presented to Xen guest(s), and how those devices are
mapped within the Xen guest(s). There may also be some higher-level
tools that do some or much of this. Nevertheless, if one wants/needs to
determine such, just from the basic Xen software and /sys filesystems:
//Xen device mapping/examples,
//from host:
# xm list
Name ID Mem VCPUs State
Time(s)
Domain-0 0 1504 4 r----- 47681.8
balug 4 256 1 -b---- 832.3
sflug 2 256 1 -b---- 17808.0
# xm block-list balug
Vdev BE handle state evt-ch ring-ref BE-path
2048 0 0 4 8 8 /local/domain/0/backend/vbd/4/2048
2064 0 0 4 9 9 /local/domain/0/backend/vbd/4/2064
5632 0 0 4 10 10 /local/domain/0/backend/vbd/4/5632
# xm block-list sflug
Vdev BE handle state evt-ch ring-ref BE-path
2049 0 0 4 8 8 /local/domain/0/backend/vbd/2/2049
2050 0 0 4 9 9 /local/domain/0/backend/vbd/2/2050
5632 0 0 4 10 10 /local/domain/0/backend/vbd/2/5632
# (cd /sys/devices/xen-backend && for tmp in */physical_device; do
echo `dirname "$tmp"` `cat "$tmp"`; done)
//block device major and minor numbers, in hex
vbd-2-2049 fd:6
vbd-2-2050 fd:7
vbd-2-5632 7:2
vbd-4-2048 fd:a
vbd-4-2064 fd:d
vbd-4-5632 7:1
brw-rw---- 1 root disk 253, 6 2010-08-13 10:26 /dev/vg-sflug/sflug-disk
brw-rw---- 1 root disk 253, 7 2010-08-13 10:26 /dev/vg-sflug/sflug-swap
brw-rw---- 1 root disk 7, 2 2010-08-13 10:26 /dev/loop2
brw-rw---- 1 root disk 253, 10 2010-08-13 10:26 /dev/vg-balug/balug-sda
brw-rw---- 1 root disk 253, 13 2010-08-13 10:26 /dev/vg-balug/balug-sdb
brw-rw---- 1 root disk 7, 1 2010-08-13 10:26 /dev/loop1
# losetup /dev/loop1
/dev/loop1: [fd05]:25
(/var/local/pub/mirrored/cdimage.debian.org/debian-cd/5.0.5/i38*)
# losetup /dev/loop2
/dev/loop2: [fd05]:25
(/var/local/pub/mirrored/cdimage.debian.org/debian-cd/5.0.5/i38*)
//from guest(s):
# ls -d /sys/devices/xen/vbd-*/block*
/sys/devices/xen/vbd-2048/block:sda
/sys/devices/xen/vbd-2064/block:sdb
/sys/devices/xen/vbd-5632/block:hdc
find /proc/[!0-9]* /sys -name '*loop*' -print
/sys/block/loop1
/sys/block/loop2
More information about the sf-lug
mailing list