# Cannot mount a btrfs partition over NFS [SOLVED]

## shimbob

My home server has two partitions that are exported via NFS:

```
/etc/fstab:

/dev/sda3               /mnt/storage    ext4            defaults,noatime,nodiratime,norelatime  0 1

/dev/sdb                /mnt/blackhole  btrfs           defaults,noatime,device=/dev/sdb,device=/dev/sdc        0 1

```

```
/etc/exports:

/mnt/blackhole  192.168.1.0/26(rw,async,no_root_squash,no_subtree_check)

/mnt/storage    192.168.1.0/26(rw,async,no_root_squash,no_subtree_check)
```

These are mounted on my clients:

```

/etc/fstab:

192.168.1.9:/mnt/blackhole   /mnt/blackhole   nfs   defaults   0 0

192.168.1.9:/mnt/storage   /mnt/storage   nfs   defaults   0 0
```

This used to work absolutely fine until recently when nfs-mounting the btrfs partition times out with "Stale NFS file handle" errors:

```
dezk mnt # mount -v /mnt/storage ; mount | grep storage

mount.nfs: timeout set for Wed Dec 18 10:01:52 2013

mount.nfs: trying text-based options 'vers=4,addr=192.168.1.9,clientaddr=192.168.1.12'

mount.nfs: mount(2): Protocol not supported

mount.nfs: trying text-based options 'addr=192.168.1.9'

mount.nfs: prog 100003, trying vers=3, prot=6

mount.nfs: trying 192.168.1.9 prog 100003 vers 3 prot TCP port 2049

mount.nfs: prog 100005, trying vers=3, prot=17

mount.nfs: trying 192.168.1.9 prog 100005 vers 3 prot UDP port 32767

monoliz:/mnt/storage on /mnt/storage type nfs (rw,addr=192.168.1.9)

dezk mnt # mount -v /mnt/blackhole ; mount | grep blackhole

mount.nfs: timeout set for Wed Dec 18 10:02:06 2013

mount.nfs: trying text-based options 'vers=4,addr=192.168.1.9,clientaddr=192.168.1.12'

mount.nfs: mount(2): Protocol not supported

mount.nfs: trying text-based options 'addr=192.168.1.9'

mount.nfs: prog 100003, trying vers=3, prot=6

mount.nfs: trying 192.168.1.9 prog 100003 vers 3 prot TCP port 2049

mount.nfs: prog 100005, trying vers=3, prot=17

mount.nfs: trying 192.168.1.9 prog 100005 vers 3 prot UDP port 32767

mount.nfs: mount(2): Stale NFS file handle
```

The last 6 lines repeat until it times out.

```
mount.nfs: trying text-based options 'vers=4,addr=192.168.1.9,clientaddr=192.168.1.12'

mount.nfs: mount(2): Protocol not supported

mount.nfs: trying text-based options 'addr=192.168.1.9'

mount.nfs: prog 100003, trying vers=3, prot=6

mount.nfs: trying 192.168.1.9 prog 100003 vers 3 prot TCP port 2049

mount.nfs: prog 100005, trying vers=3, prot=17

mount.nfs: trying 192.168.1.9 prog 100005 vers 3 prot UDP port 32767

mount.nfs: mount(2): Stale NFS file handle

mount.nfs: Connection timed out
```

I've searched and found a reference to possible file system corruption that the NFS server is picking up on and reports as ESTALE but I've run btrfsck 3 times as well as scrubbed it twice, no errors reported (btrfsprogs v3.12).

Nevermind. Fixed it. 

```
monoliz mnt # btrfs subvolume get-default blackhole/

ID 5 (FS_TREE)

monoliz mnt #
```

Then changed /etc/exports:

```

/mnt/blackhole  192.168.1.0/26(rw,async,no_root_squash,no_subtree_check,fsid=5)
```

I thought the fsid= option was only for NFSv4, oh well.

I have *NO* clue what changes were made that require fsid=.

----------

## depontius

Where did you learn this?

I'm running nfsv4 now, using ext4, and I have to use fsid=n in order to not get the stale file handle error.  But the value for fsid when running this way isn't critical, just that it be there, and not be 0.

I'm in the process of building a new server, and have considered using btrfs for this function instead of ext4.  I never saw the value of fsid mean anything, so I'm curious about what you've done.

----------

## shimbob

I first heard about fsid from this gentoo forum post, but it seemed purely an issue with NFSv4 (I'm using v3) and he was having an error message that didn't match mine. I didn't try fsid until the very end out of frustration that nothing else was working. It worked, go figure. My /mnt/blackhole btrfs doesn't even have any subvolumes created so I don't understand the requirement.

As an experiement, I unmounted the nfsclient and changed it to fsid=2. The client is still able to mount it so it seems the number does not have to match the number reported by 'btrfs su ge blackhole/'.

I just wish I could find out what change brought this requirement. I'll downgrade nfs-utils to see if I can figure out if & which new version introduced this.

----------

