Re: cannot use btrfs for nfs server

Forza
2021-07-09T07:23:21Z

Hello everyone,

---- From: Ulli Horlacher <framstag@rus.uni-stuttgart.de> -- Sent: 2021-07-09 - 08:53 ----

> On Fri 2021-07-09 (01:05), Graham Cobb wrote:
>> On 08/07/2021 23:17, Ulli Horlacher wrote:
>>
>> >
>> > I have waited some time and some Ubuntu updates, but the bug is still there:
>>
>> Yes: find and du get confused about seeing inode numbers reused in what
>> they think is a single filesystem.
>
> A lot of tools aren't working correctly any more, even ls:
>
> root@tsmsrvj:~# ls -R /nfs/localhost/fex | wc
> ls: /nfs/localhost/fex/spool: not listing already-listed directory
>
> In consequence many cronjobs and montoring tools will fail :-(
>
>
>> You can eliminate the problems by exporting and mounting single
>> subvolumes only
>
> This is not possible at our site, we use rotating snapshots created by a
> cronjob.
>
>

Have you tried using the fsid= export option in /etc/exports?

Example:
/media/nfs/ 192.168.0.*(fsid=20000001,rw,sync,no_subtree_check,no_root_squash)

We're using this with Btrfs subvols without issues. We use NFSv4 so I do not know how this works with NFSv3.

Example:
## On the Ubuntu NFS server:
# btrfs sub list -o .
ID 5384 gen 345641 top level 258 path volume/nfs_ssd/132bbc3e-aed1-15a5-f30d-9515e490e62c/subvol1
ID 5385 gen 345640 top level 258 path volume/nfs_ssd/132bbc3e-aed1-15a5-f30d-9515e490e62c/subvol2

## On the NFS client:
[09:20 srv01 132bbc3e-aed1-15a5-f30d-9515e490e62c]# ll
total 0
drwxr-xr-x 1 root root 6 Jul 9 09:17 subvol1
drwxr-xr-x 1 root root 0 Jul 9 09:17 subvol2
[09:20 srv01 132bbc3e-aed1-15a5-f30d-9515e490e62c]# touch subvol1/foo
[09:20 srv01 132bbc3e-aed1-15a5-f30d-9515e490e62c]# touch subvol2/bar
[09:20 srv01 132bbc3e-aed1-15a5-f30d-9515e490e62c]# touch foobar
[09:20 srv01 132bbc3e-aed1-15a5-f30d-9515e490e62c]# ll -R
.:
total 0
-rw-r--r-- 1 root root 0 Jul 9 09:20 foobar
drwxr-xr-x 1 root root 12 Jul 9 09:20 subvol1
drwxr-xr-x 1 root root 6 Jul 9 09:20 subvol2

./subvol1:
total 0
-rw-r--r-- 1 root root 0 Jul 9 09:17 bar
-rw-r--r-- 1 root root 0 Jul 9 09:20 foo

./subvol2:
total 0
-rw-r--r-- 1 root root 0 Jul 9 09:20 bar