1

I have a rather peculiar problem. I'm running 3.2.0-58-generic #88-Ubuntu (Ubuntu 12.04) and I have mouonted the following loopback devices:

cat /proc/mounts | grep loop
    /dev/loop0 /work/kernel/AEL/fpga-filesystem ext4 rw,relatime,user_xattr,barrier=1,data=ordered 0 0
    /dev/loop1 /work/kernel/AEL/model-filesystem ext4 rw,relatime,user_xattr,barrier=1,data=ordered 0 0

sudo losetup -a
/dev/loop0: [fc02]:4990567 (/work/kernel/AEL/openembed-fpga.img), offset 54525952
/dev/loop1: [fc02]:4990564 (/work/kernel/AEL/vexpress64-openembedded_minimal-armv8-gcc-4.8_20140222-611.img), offset 54525952

The 2 .img files are completely separate files and not symlinks:

ls -li /work/kernel/AEL/
      2 drwxr-xr-x 21 root     root           4096 Mar 26 20:14 fpga-filesystem
      2 drwxr-xr-x 21 root     root           4096 Mar 26 20:05 model-filesystem
4990567 -rw-r-----  1 nikbor01 nikbor01 3221225472 Mar 27 09:47 openembed-fpga.img
4990564 -rw-r-----  1 nikbor01 nikbor01 3221225472 Mar 26 20:06 vexpress64-openembedded_minimal-armv8-gcc-4.8_20140222-611.img

The reason why the 2 directories have the same INODE number is that the images are the same (as in have the same content) but are clearly mounted under a different loop device.

And finally I export the 2 directories where the images are mounted via nfs:

/work/kernel/AEL/fpga-filesystem *(rw,sync,no_subtree_check,no_root_squash,insecure)
/work/kernel/AEL/model-filesystem *(rw,sync,crossmnt,no_subtree_check,no_root_squash,insecure)

And now the pinnacle of everything - when I mount fpga-filesystem on client1 and model-filesystem on client2 they both see the same filesystem (e.g. the one under fpga-filesystem).

Here is the mount on client1:

10.1.209.36:/work/kernel/AEL/fpga-filesystem / nfs rw,relatime,vers=3,rsize=4096,wsize=4096,namlen=255,hard,nolock,proto=tcp,timeo=600,retrans=2,sec=sys,mountaddr=10.1.209.36,mountvers=3,mountproto=tcp,local_lock=all,addr=10.1.209.36 0 0

And on client2:

10.1.209.36:/work/kernel/AEL/model-filesystem / nfs rw,relatime,vers=3,rsize=4096,wsize=4096,namlen=255,hard,nolock,proto=tcp,timeo=600,retrans=2,sec=sys,mountaddr=10.1.209.36,mountvers=3,mountproto=tcp,local_lock=all,addr=10.1.209.36 0 0

However, when I do ls / on both clients I see the conents of only the fpga-filesystem directory, which makes absolutely no sense. Any ideas how i might be able to debug the issue.

  • Look at the fsid option in the exports man page. – Stéphane Chazelas Mar 27 '14 at 10:17
  • Thanks, this solved the issue. But it feels it is a hack, why wouldn't NFS automatically detect and assign unique id to the loopback-mounted filesystem? – JohnJohnson Mar 27 '14 at 10:40
  • It says it's using the UUID by default, and if you've cloned the images, the UUID would be the same. – Stéphane Chazelas Mar 27 '14 at 10:42
  • Thanks a lot, running blkid confirmed that both loop devices have the same UUID. But I would have expected the UUID to be generated based on the image as stored on my machine and not what is inside its metadata. – JohnJohnson Mar 27 '14 at 10:53
  • The UUID is information stored in the filesystem meta-data. blkid, misleadingly doesn't give the id of the block device (there's no such thing, unless you want to consider hard disk serial numbers, or partition IDs for those partitioning schemes (like GPT or LVM) that support them), but the id of the filesystem stored on that block device. – Stéphane Chazelas Mar 27 '14 at 10:59

Your Answer

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

Browse other questions tagged or ask your own question.