[OT] Major and minor numbers assigned to /dev/vdx virtio devices

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) Thanks, Gianluca

+Paolo Bonzini <pbonzini@redhat.com> can you help here? Il giorno mer 1 lug 2020 alle ore 16:56 Gianluca Cecchi < gianluca.cecchi@gmail.com> ha scritto:
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)
Thanks, Gianluca _______________________________________________ Users mailing list -- users@ovirt.org To unsubscribe send an email to users-leave@ovirt.org Privacy Statement: https://www.ovirt.org/privacy-policy.html oVirt Code of Conduct: https://www.ovirt.org/community/about/community-guidelines/ List Archives: https://lists.ovirt.org/archives/list/users@ovirt.org/message/AEQB6H75QLYP6E...
-- Sandro Bonazzola MANAGER, SOFTWARE ENGINEERING, EMEA R&D RHV Red Hat EMEA <https://www.redhat.com/> sbonazzo@redhat.com <https://www.redhat.com/> *Red Hat respects your work life balance. Therefore there is no need to answer this email out of your office hours. <https://mojo.redhat.com/docs/DOC-1199578>*

I think they are assigned at boot time but I would have to check the sources and I am on vacation. :-) Paolo Il lun 13 lug 2020, 16:37 Sandro Bonazzola <sbonazzo@redhat.com> ha scritto:
+Paolo Bonzini <pbonzini@redhat.com> can you help here?
Il giorno mer 1 lug 2020 alle ore 16:56 Gianluca Cecchi < gianluca.cecchi@gmail.com> ha scritto:
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)
Thanks, Gianluca _______________________________________________ Users mailing list -- users@ovirt.org To unsubscribe send an email to users-leave@ovirt.org Privacy Statement: https://www.ovirt.org/privacy-policy.html oVirt Code of Conduct: https://www.ovirt.org/community/about/community-guidelines/ List Archives: https://lists.ovirt.org/archives/list/users@ovirt.org/message/AEQB6H75QLYP6E...
--
Sandro Bonazzola
MANAGER, SOFTWARE ENGINEERING, EMEA R&D RHV
Red Hat EMEA <https://www.redhat.com/>
sbonazzo@redhat.com <https://www.redhat.com/>
*Red Hat respects your work life balance. Therefore there is no need to answer this email out of your office hours. <https://mojo.redhat.com/docs/DOC-1199578>*

On Wed, Jul 1, 2020 at 5:55 PM Gianluca Cecchi <gianluca.cecchi@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)
This question belongs to qemu-discuss. Also added some people that may help. Nir

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@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

On Tue, Jul 14, 2020 at 4:40 PM Stefan Hajnoczi <stefanha@redhat.com> wrote:
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@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
Thanks for the information. No, it was only a curiosity: during a recovery action (actually it was a "poor man" P2V operation using dd) where I had to rebuild initrd file and to reinstall grub in a chroot environment, I had to run mknod commands to manually create the /dev/vdax files and comparing two different existing guests I stumbled upon their /dev/vda files that had different major/minor numbers, so I was not sure what to use.... Gianluca
participants (5)
-
Gianluca Cecchi
-
Nir Soffer
-
Paolo Bonzini
-
Sandro Bonazzola
-
Stefan Hajnoczi