On Mon, Jul 13, 2020 at 09:53:31PM +0300, Nir Soffer wrote:
On Wed, Jul 1, 2020 at 5:55 PM Gianluca Cecchi
<gianluca.cecchi(a)gmail.com> wrote:
>
> Hello,
> isn't there an official major/minor numbering scheme for virtio disks?
> Sometimes I see 251 major or 252 or so... what is the udev assignment logic?
> Reading here:
>
https://www.kernel.org/doc/Documentation/admin-guide/devices.txt
>
> 240-254 block LOCAL/EXPERIMENTAL USE
> Allocated for local/experimental use. For devices not
> assigned official numbers, these ranges should be
> used in order to avoid conflicting with future assignments.
>
> it seems they are in the range of experimental ones, while for example Xen /dev/xvdx
devices have their own static assignment (202 major)
No, the Linux virtio_blk driver does not use a static device major number.
Regarding udev, on my Fedora system
/usr/lib/udev/rules.d/60-persistent-storage.rules has rules like this:
KERNEL=="vd*[!0-9]", ATTRS{serial}=="?*",
ENV{ID_SERIAL}="$attr{serial}",
SYMLINK+="disk/by-id/virtio-$env{ID_SERIAL}"
The rules match on the "vd*" name. If you are writing udev rules you
could use the same approach.
Is there a specific problem faced when there is no static device major
number?
Stefan