Artificial intelligent assistant

Can device numbers change after reboot? I'm building a service that checks for file uniqueness on block devices. File uniqueness on a system appears that it can be guaranteed through the pair `(st_dev, st_ino)`, where `st_dev` is the device number and `st_ino` is the inode number. These values come directly from the stat system call. However, I can't find any references on whether the device numbers for a partition actually are persistent. In other words, can the device number for a partition change if I unmount/mount it, or if I reboot the system?

Yes, the device number of a block device can change: these are assigned dynamically when the system boots up. Adding and removing devices (and sometimes even changes to your BIOS firmware) can result in things being discovered in a different order, and thus having different device ids.

If you want to uniquely identify a filesystem, use the filesystem UUID (available e.g. from the `blkid` command).

Using the inode as an identifier may also be problematic, depending on what you're trying to do: for example, a single file may be present in multiple locations with the same inode due to hard links, and inodes can be recycled for new files when the files with which they were originally associated are deleted.

xcX3v84RxoQ-4GxG32940ukFUIEgYdPy 47bd71346f03db97099d50a815d57133