Subject: bug#53212: feature request: mount option to specify the device number

From: Bernhard Voelker <[email-masked]>
Date: Wed, 12 Jan 2022 18:46:33 +0100

tag 53212 notabug
close 53212
stop

On 1/12/22 17:59, Joachim Wagner wrote:
> Not sure whether this is coreutils or kernel. Maybe both.
> 
> A filesystem's device number such as reported by `stat` can be derived from 
> major and minor of the underlying block device, e.g. xfs, or be allocated at 
> mount time, e.g. btrfs. Even in the former case, the device number can change 
> between restarts, e.g. when multiple dm-crypt devices are created in different 
> order. Changing device numbers cause trouble for applications that use the 
> device number to identify a filesystem across restarts, e.g. KDE's baloo file 
> indexer.
> 
> A mount option to specify the device number would fix this trouble without 
> requiring applications to move to alternative ways of identifying filesystems, 
> e.g. based on UUIDs. This option could be general, i.e. the device number can 
> be set for any filesystem, including those that normally derive it from major 
> and minor of their block device(s).
> 
> The implementation would probably be simplified if the specified device 
> numbers must come from a reserved pool. Otherwise, care must be taken that the 
> numbers do not collide with automatically assigned device numbers, including 
> those allocated later.
> 
> Replaces bug #53209
> 
> References:
> https://bugs.kde.org/show_bug.cgi?id=402154
> https://bugs.kde.org/show_bug.cgi?id=404057
> https://bugs.kde.org/show_bug.cgi?id=413694
> https://unix.stackexchange.com/questions/345220/btrfs-how-to-get-real-device-id
> https://stackoverflow.com/questions/4309882/device-number-in-stat-command-output/4309947

mount is a command from the util-linux package, hence you'd be better off asking
on their mailing list <[email-masked]>.

FWIW: mount already knows quite a list of alternatives how to specify the source
device:

  mount --help | sed -n '/^Source:/,/^$/p'
  Source:
   -L, --label <label>     synonym for LABEL=<label>
   -U, --uuid <uuid>       synonym for UUID=<uuid>
   LABEL=<label>           specifies device by filesystem label
   UUID=<uuid>             specifies device by filesystem UUID
   PARTLABEL=<label>       specifies device by partition label
   PARTUUID=<uuid>         specifies device by partition UUID
   ID=<id>                 specifies device by udev hardware ID
   <device>                specifies device by path
   <directory>             mountpoint for bind mounts (see --bind/rbind)
   <file>                  regular file for loopdev setup

As this is not related to coreutils, I'm hereby closing this issue in our
bug tracker.

Have a nice day,
Berny