Detect dataset permission type (UNIX/ACL) from terminal

Status
Not open for further replies.

kroko

Dabbler
Joined
Mar 9, 2015
Messages
21
Hi,

I have two scripts that rsync'es multiple datasets to remote. One for UNIX one for ACL datasets, as rsync flags should differ.
I could create more general approach using just one script by changing each "associative array" member, it's the way i have set it up (local path and remote path)

Code:
# PAIRS OF SOURCES AND DESTINATIONS
declare -a BACKUP_PAIRS
BACKUP_PAIRS[0]='/mnt/vol/mydataset1/:/remote/blabla/mydataset1'
BACKUP_PAIRS[1]='/mnt/vol/mydataset2/:/remote/blabla/mydataset2'
BACKUP_PAIRS[2]='/mnt/vol/mydataset3/:/remote/blabla/mydataset3'


to include third parameter denoting permission type
Code:
# PAIRS OF SOURCES AND DESTINATIONS
declare -a BACKUP_PAIRS
BACKUP_PAIRS[0]='/mnt/vol/mydataset1/:/remote/blabla/mydataset1:1'
BACKUP_PAIRS[1]='/mnt/vol/mydataset2/:/remote/blabla/mydataset2:2'
BACKUP_PAIRS[2]='/mnt/vol/mydataset3/:/remote/blabla/mydataset3:1'

That would flip rsync flags per pair.

But to make it maybe more automated the question:
Is it possible to detect dataset permission type via CLI, given that all dataset absolute paths are known for script, a la
Code:
whatpermtype /mnt/vol/mydataset1


Thanks!
 

Ericloewe

Server Wrangler
Moderator
Joined
Feb 15, 2014
Messages
20,194
You'll have to ask a ZFS dev, most likely. I haven't seen anyone say this is possible, but maybe one of them will come up with something.
 

Spearfoot

He of the long foot
Moderator
Joined
May 13, 2015
Messages
2,478
Hi,

I have two scripts that rsync'es multiple datasets to remote. One for UNIX one for ACL datasets, as rsync flags should differ.
I could create more general approach using just one script by changing each "associative array" member, it's the way i have set it up (local path and remote path)

Code:
# PAIRS OF SOURCES AND DESTINATIONS
declare -a BACKUP_PAIRS
BACKUP_PAIRS[0]='/mnt/vol/mydataset1/:/remote/blabla/mydataset1'
BACKUP_PAIRS[1]='/mnt/vol/mydataset2/:/remote/blabla/mydataset2'
BACKUP_PAIRS[2]='/mnt/vol/mydataset3/:/remote/blabla/mydataset3'


to include third parameter denoting permission type
Code:
# PAIRS OF SOURCES AND DESTINATIONS
declare -a BACKUP_PAIRS
BACKUP_PAIRS[0]='/mnt/vol/mydataset1/:/remote/blabla/mydataset1:1'
BACKUP_PAIRS[1]='/mnt/vol/mydataset2/:/remote/blabla/mydataset2:2'
BACKUP_PAIRS[2]='/mnt/vol/mydataset3/:/remote/blabla/mydataset3:1'

That would flip rsync flags per pair.

But to make it maybe more automated the question:
Is it possible to detect dataset permission type via CLI, given that all dataset absolute paths are known for script, a la
Code:
whatpermtype /mnt/vol/mydataset1


Thanks!
All Windows datasets have a file named .windows in the root directory of the share. Your script could check for the existence of this file and respond accordingly.

Example: I have a Windows share called bandit on one of my systems. The dataset is at /mnt/tank/bandit and the file I mentioned is at /mnt/tank/bandit/.windows.
 

Ericloewe

Server Wrangler
Moderator
Joined
Feb 15, 2014
Messages
20,194
All Windows datasets have a file named .windows in the root directory of the share. Your script could check for the existence of this file and respond accordingly.
Is that guaranteed?
 

Spearfoot

He of the long foot
Moderator
Joined
May 13, 2015
Messages
2,478

kroko

Dabbler
Joined
Mar 9, 2015
Messages
21
If there is not such helper then checking .windows is indeed possible. It seems it is guaranteed, as well as if ACL dataset is changed back to UNIX it is removed (just flipped test dataset back and forth few times). Other way would be to start messing with sqlite (web GUI somehow knows the type).

I'll just go with third param then, checking for file seems as inelegant as just hardcoding and i can implement it much easier, oh well. It's not that my datasets change on daily basis. Set it and forget it. :)

Thanks guys for the input!
 
Last edited:
Status
Not open for further replies.
Top