Permission problems when populating datasets as root (cli)

masl

Cadet
Joined
Sep 22, 2020
Messages
4
I'm setting a home NAS taking it as a chance to get familiar with FreeNAS

My specs:
FreeNAS-11.3-U2
Intel(R) Core(TM) i5-4690 CPU @ 3.50GHz
16GB DDR3 RAM
OS: runs on a SSD ADATA SP600 250GB
My Pools:
1) NAS01. /mnt/NAS01 2x 2TB Mirror w/ 1 spare (the real backup/NAS space). The 2 dev of the mirror are WDC WD2003FZEX ; the spare is a ST2000DL003
2) S500. /mnt/S500 1x 500GB (scratch space). The disk is a ST3500320AS
There is also a 6th 1TDB disk waiting to be used...

I originally backed up some 80GB of data from another computer into an zfs dataset on an external HD. Only after that I learned such a disk can't be imported. This dataset had a snapshot created in that original computer.

I then managed to transfer the dataset into pool2 as S500/pre2012 mounted on /mnt/pre2012 (honestly, can't remember exactly right now how I did it by, but must have been through cli via zpool and ifs).

At some point I used a `zfs send | recv` to transfer (can I say copy?) S500/pre2012@snp1 to pool1 under NAS01/pre2012 -which unexpectedly to me was mounted under /mn/mnt/pre2012.

After testing and getting somewhat familiar with SMB shares and checking I could have it working with all my MACs & Linux boxes I decided it was time to organize pool 1 (NAS01) into different datasets according to what I'm planning to store and how to use it. I created these datasets using the GUI.

The result is the following structure of pools (as per `zfs list`):
NAS01/PRIVATE 55.0G 1.62T 20.5G /mnt/NAS01/PRIVATE
NAS01/PRIVATE/Documents 573M 1.62T 573M /mnt/NAS01/PRIVATE/Documents
NAS01/PRIVATE/Fotos 33.9G 1.62T 33.9G /mnt/NAS01/PRIVATE/Fotos
NAS01/PUBLIC 16.9G 1.62T 96K /mnt/NAS01/PUBLIC
NAS01/PUBLIC/Library 57.6M 1.62T 57.6M /mnt/NAS01/PUBLIC/Library
NAS01/PUBLIC/Movies 15.5G 1.62T 15.5G /mnt/NAS01/PUBLIC/Movies
NAS01/PUBLIC/Music 1.05G 1.62T 1.05G /mnt/NAS01/PUBLIC/Music
NAS01/PUBLIC/Software 299M 1.62T 299M /mnt/NAS01/PUBLIC/Software
NAS01/pre2012 71.3G 1.62T 71.3G /mnt/mnt/pre2012
S500 268G 178G 136K /mnt/S500
S500/SharedScratch 196G 178G 196G /mnt/S500/SharedScratch
S500/pre2012 71.4G 178G 71.3G /mnt/pre2012


SharedScratch has been working well under SMB in my network -while I used only guest account access and nobody:nobody ownerships. But that's another story.

Currently, the structure of S500/pre2012 ( or rather that of of its mount point) is:
/mnt//pre2012/120/30/home/
/mnt//pre2012/120/30/MatLab6.5/
/mnt//pre2012/120/80/home/
/mnt//pre2012/120/80/O/
/mnt//pre2012/120/80/usr/
/mnt//pre2012/250/48/home/
/mnt//pre2012/250/80win/

It also had other folders like Music that I managed to `mv` (not w/o quite some pain) to NAS01/PUBLIC/Music, say.

All these folders under S500/pre2012 are owned by user `admin`. It's the only additional user I created.


My problem seems to be related to privileges issues, although I sudoed into root when issuing commands like the following:
root@freenas[/mnt/S500/pre2012]#mv 120 /mnt/NAS01/PRIVATE/Documents
mv: chmod: /mnt/NAS01/PRIVATE/Documents/120/30/home/msantos/Reports/Apoptosis: Operation not permitted
mv: chmod: /mnt/NAS01/PRIVATE/Documents/120/30/home/msantos/Reports/.Designability.March.2005.tex.swp: Operation not permitted
mv: /mnt/NAS01/PRIVATE/Documents/120/30/home/msantos/Reports/NMR: File exists
mv: /bin/cp 120 /mnt/NAS01/PRIVATE/Documents/120: terminated with 1 (non-zero) status


The folders' permissions are:
root@freenas[/mnt/S500/pre2012/120]# ll ; ll /mnt/NAS01/PRIVATE/Documents/120
total 26
drwxr-x---+ 4 admin admin uarch 4 Sep 22 21:03 ./
drwxr-x---+ 4 admin admin uarch 4 Sep 22 21:03 ../
drwxr-x---+ 3 admin admin uarch 3 Sep 22 21:14 30/
drwxr-x---+ 5 admin admin uarch 5 Sep 14 15:56 80/
total 2
drwxrwx---+ 3 root admin uarch 3 Sep 22 21:57 ./
drwxrwx---+ 3 admin admin uarch 4 Sep 22 21:57 ../
drwxrwx---+ 3 root admin uarch 3 Sep 22 21:57 30/

As you can see the move failed to copy everything, although it did copy something! That's even more worrisome bc it's a move!

Here some permissions of destination folders:
root@freenas[~]# ls -lF /mnt/NAS01
total 9
drwxr-xr-x+ 5 admin admin 6 Sep 22 19:16 PRIVATE/
drwxrwx---+ 6 root wheel 6 Sep 22 15:30 PUBLIC/

root@freenas[~]# ls -lFd /mnt/NAS01/*/*
drwxrwx---+ 3 admin admin 4 Sep 22 21:57 /mnt/NAS01/PRIVATE/Documents/
drwxrwx---+ 15 admin admin 19 Sep 22 20:37 /mnt/NAS01/PRIVATE/Fotos/
drwxrwx---+ 2 nobody admin 4 Sep 22 21:03 /mnt/NAS01/PUBLIC/Library/
drwxrwx---+ 5 nobody admin 38 Sep 22 20:13 /mnt/NAS01/PUBLIC/Movies/
drwxrwx---+ 17 nobody admin 36 Sep 22 20:41 /mnt/NAS01/PUBLIC/Music/
drwxrwx---+ 9 nobody admin 9 Sep 22 21:09 /mnt/NAS01/PUBLIC/Software/


All those children datasets of PRIVATE and PUBLIC are being shared via SMB. The first one should only be accessible to admin user. Hence those permissions/ownerships.

My questions:
How can I reliably use `mv` here to populate these datasets?
I don't understand how to use zfs send/ recv to copy data into a specific datasets/folder. That's why initially when I tried I ended up with a copy of pre2012 under /mnt/mnt/ which the GUI doesn't let me use as a share. Hence my using `mv`.

Furthermore, since I'm trying to sort different folders of the original dataset into different dst datasets, I can't see how zfs send/recv can do that. Is that possible?

I'm a bit frustrated at this point. Either I did things totally wrong or I'm missing a fundamental idea of how FreeNAS is supposed to be used...or both :-/ In any case, I didn't expect that populating the server with data would be so complicated.

Again, this is just after my first 1.5 weeks in toying with FreeNAS. Sorry for the lengthly post.

Thanks in advance.
 

masl

Cadet
Joined
Sep 22, 2020
Messages
4
Solved.

TL;DR: I recreated some datasets and shared them as NFS share. This allows set the type to generic which in turn allows setting it as a case sensitive dataset.

For more details see this
 
Top