Orphaned dataset directory after moving using rename

Hi! Brand new to TrueNAS and this is such a breath of fresh air to manage at the dataset level!

I did a zfs rename to move a dataset to a subdirectory:

zfs rename Pool1/Home Pool1/shares/Home

TrueNAS left what looks like an orphaned dataset mount:

root@matrix[/mnt/Pool1]# ls -altr
total 20
drwxr-xr-x 3 root     root   3 Oct  9 00:18 ..
drwxr-xr-x 2 root     root   2 Oct  9 03:19 Home
drwxrwx--- 2 root     root   2 Oct  9 15:08 apps
drwxr-xr-x 2 root     root   2 Oct  9 15:24 VMs
drwxrwxr-x 4 squatter common 5 Oct  9 20:53 media
drwxr-xr-x 8 root     root   8 Oct 10 03:44 shares
drwxr-xr-x 7 root     root   7 Oct 10 03:44 .

the directory is empty:

root@matrix[/mnt/Pool1]# ls -al Home
total 9
drwxr-xr-x 2 root root 2 Oct  9 03:19 .
drwxr-xr-x 7 root root 7 Oct 10 03:44 ..

and I verified my Home dataset is indeed in the right place:

root@matrix[/mnt/Pool1]# /sbin/zfs list | grep Home
Pool1/shares/Home                                        492G  1.02T   492G  /mnt/Pool1/shares/Home

While I realize I could have broken my system, I tried anyways:

root@matrix[/mnt/Pool1]# rmdir Home
rmdir: failed to remove 'Home': Operation not permitted

It’s just cosmetic so I’m not overly concerned but my OCD is kicking in :sweat_smile:

Even after a reboot (DXP2800 running SCALE 25.04), the orphaned directory is squatting pretty well :smiley:

The Home dataset works fine in its new location.

Any special permissions on it?

SCALE/CE:

nfs4xdr_getfacl /mnt/Pool1/Home

Core:

getfacl /mnt/Pool1/Home 

You can also check that nothing is using the path.

lsof +D /mnt/Pool1/Home
$ nfs4xdr_getfacl /mnt/Pool1/Home
nfs4xdr_getfacl: Failed to get NFSv4 ACL
$ lsof +D /mnt/Pool1/Home
$

it’s been a few weeks - the unit has been rebooted several times for upgrades and hardware changes and the pool has since been scrubbed. still getting the same error:

$ sudo rmdir /mnt/Pool1/Home
rmdir: failed to remove '/mnt/Pool1/Home': Operation not permitted
$ sudo lsof /mnt/Pool1/Home
$ sudo nfs4xdr_getfacl  /mnt/Pool1/Home 
nfs4xdr_getfacl: Failed to get NFSv4 ACL
$ sudo zfs list | grep Home
Pool1/shares/Home                                            506G  1.02T   495G  /mnt/Pool1/shares/Home

how do we find out what else TrueNAS believes /mnt/Pool1/Home is used for?

It might be immutable directory. Depending on circumstances we will create immutable directory when dataset is unmounted to prevent people writing into the mountpoint of a ZFS dataset and then “losing” their data when the dataset is mounted over the path.

c.f. man lsattr and man chattr