Re: [ovirt-users] [OT] Major and minor numbers assigned to /dev/vdx virtio devices
On Tue, Jul 14, 2020 at 4:40 PM Stefan Hajnoczi 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 > > 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
Re: [ovirt-users] [OT] Major and minor numbers assigned to /dev/vdx virtio devices
On Mon, Jul 13, 2020 at 09:53:31PM +0300, Nir Soffer wrote: > On Wed, Jul 1, 2020 at 5:55 PM Gianluca Cecchi > 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 signature.asc Description: PGP signature
Re: [ovirt-users] [OT] Major and minor numbers assigned to /dev/vdx virtio devices
On Wed, Jul 1, 2020 at 5:55 PM Gianluca Cecchi 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