1

I have a btrfs file system, and it all the folders in the top level are inode 256.
This is not good for me, the device id is the same, So I assume these are "virtual inodes numbers", Btrfs has their own mechanism of doing this.

Is it possible to get the real unique physical inode of each directory ?

look what happens:

root@ReadyNAS-DEV:/home# find  / -xdev -inum 256
/
/home
/data
/apps
root@ReadyNAS-DEV:/home#

Thats not good.

3

I'm assuming that the three directories /home, /data and /apps are mount points.

When you mount something on /home, the inode that is reported for /home is the inode of the root directory of the mounted partition, not that of the original /home directory. It is therefore not strange that these inodes are the same as those of other partition's root directories.

On my OpenBSD machine (which doesn't use btrfs):

$ find / -xdev -inum 2
/
/home
/usr
/var
/tmp

I see the same on my Ubuntu VM. This is not a bug.

Another way of saying it: The stat structure returned by the stat() system call for the different directories have the same value of st_ino, but different values of st_dev. See the description of stat() and sys/stat.h in POSIX.

It may be that you misunderstand the -xdev option to find. With it, it will not descend into those directories that are on other filesystems, but it will still print the directory names if they match the other criteria.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.