NFS permissions confusion

via

Dabbler
Joined
May 11, 2019
Messages
11
I have created a backup dataset for automated backup on servers of HTML and SQL yet I have hit a bit of a brickwall with permissions moving files over.

For some reason this has only affected the HTML backup, the SQL backup ran fine, this mysqldumps each database then gzips it afterwards. The HTML backup create tar files of each HTML directory but then failed on gzip with "Operation not permitted" I tried changing this to tar / gzip into a temp directory and moving to the backup mount, this also failed but creates a 0 byte file.

Manually I can create / put data / delete files OK, but as soon as I try to copy backup file with same name I get "Operation not permitted"

Code:
root@hqops:~# mv /tmp/backup/\[2019-05-12\]\[HXXL\]test.backup.tar.gz /mnt/backup/HQOps.d8ff.net/2019-05/
mv: cannot create regular file '/mnt/backup/HQOps.d8ff.net/2019-05/[2019-05-12][HXXL]test.backup.tar.gz': Operation not permitted

root@hqops:~# ls -al /mnt/backup/HQOps.d8ff.net/2019-05/\[2019-05-12\]\[HXXL\]test.backup.tar.gz
-rwxrwxr-x 1 dan root 0 May 12 10:17 '/mnt/backup/HQOps.d8ff.net/2019-05/[2019-05-12][HXXL]test.backup.tar.gz'
root@hqops:~# rm /mnt/backup/HQOps.d8ff.net/2019-05/\[2019-05-12\]\[HXXL\]test.backup.tar.gz

root@hqops:~# touch /mnt/backup/HQOps.d8ff.net/2019-05/\[2019-05-12\]\[HXXL\]test.backup.tar.gz
root@hqops:~# echo blah blah > /mnt/backup/HQOps.d8ff.net/2019-05/\[2019-05-12\]\[HXXL\]test.backup.tar.gz
root@hqops:~# ls -al /mnt/backup/HQOps.d8ff.net/2019-05/\[2019-05-12\]\[HXXL\]test.backup.tar.gz
-rwxrwxr-x 1 dan root 10 May 12 10:18 '/mnt/backup/HQOps.d8ff.net/2019-05/[2019-05-12][HXXL]test.backup.tar.gz'
root@hqops:~# cat /mnt/backup/HQOps.d8ff.net/2019-05/\[2019-05-12\]\[HXXL\]test.backup.tar.gz
blah blah
root@hqops:~# rm /mnt/backup/HQOps.d8ff.net/2019-05/\[2019-05-12\]\[HXXL\]test.backup.tar.gz

root@hqops:~# mv /tmp/backup/\[2019-05-12\]\[HXXL\]test.backup.tar.gz /mnt/backup/HQOps.d8ff.net/2019-05/
mv: cannot create regular file '/mnt/backup/HQOps.d8ff.net/2019-05/[2019-05-12][HXXL]test.backup.tar.gz': Operation not permitted
root@hqops:~#


* HXXL is actually HTML, just replaced afterwards to stop forum trying to insert HTML tags

I have the dataset owner set as 'dan' and the NFS mount maproot is also set as 'dan'
/mnt/backup is the FreeNAS NFS mount

Can anyone offer any pointers on whats going on?
 

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,703
Can you show the output of ls -l in the dir /mnt/backup/HQOps.d8ff.net/2019-05/ ?
 

via

Dabbler
Joined
May 11, 2019
Messages
11
Code:
root@hqops:~# ls -l /mnt/backup/HQOps.d8ff.net/2019-05/
total 155536
-rwxrwxr-x 1 dan root 254566400 May 12 11:14 '[2019-05-12][HXXL]sub1.d8ff.net.tar'
-rwxrwxr-x 1 dan root         0 May 12 11:14 '[2019-05-12][HXXL]sub1.d8ff.net.tar.gz'
-rwxrwxr-x 1 dan root  48599040 May 12 11:14 '[2019-05-12][HXXL]sub2.d8ff.net.tar'
-rwxrwxr-x 1 dan root         0 May 12 11:14 '[2019-05-12][HXXL]sub2.d8ff.net.tar.gz'
-rwxrwxr-x 1 dan root   6696960 May 12 11:14 '[2019-05-12][HXXL]sub3.d8ff.net.tar'
-rwxrwxr-x 1 dan root         0 May 12 11:14 '[2019-05-12][HXXL]sub3.d8ff.net.tar.gz'
-rwxrwxr-x 1 dan root   7475200 May 12 11:14 '[2019-05-12][HXXL]sub4.d8ff.net.tar'
-rwxrwxr-x 1 dan root         0 May 12 11:14 '[2019-05-12][HXXL]sub4.d8ff.net.tar.gz'
-rwxrwxr-x 1 dan root     10240 May 12 11:14 '[2019-05-12][HXXL]HXXL.tar'
-rwxrwxr-x 1 dan root         0 May 12 11:14 '[2019-05-12][HXXL]HXXL.tar.gz'
-rwxrwxr-x 1 dan root  33245659 May 12 11:14 '[2019-05-12][SQL]sub1.sql.gz'
-rwxrwxr-x 1 dan root  39494738 May 12 11:14 '[2019-05-12][SQL]sub2os.sql.gz'
-rwxrwxr-x 1 dan root      1393 May 12 11:14 '[2019-05-12][SQL]sub4.sql.gz'
-rwxrwxr-x 1 dan root    143422 May 12 11:14 '[2019-05-12][SQL]mysql.sql.gz'
-rwxrwxr-x 1 dan root      2973 May 12 11:14 '[2019-05-12][SQL]phpmyadmin.sql.gz'
root@hqops:~#


(have replaced sub names for confidentially and HTML with HXXL - everything else as is)
 

sretalla

Powered by Neutrality
Moderator
Joined
Jan 1, 2016
Messages
9,703
And what about ls -l /mnt/backup/HQOps.d8ff.net/ ?

Also can you run (as root) touch /mnt/backup/HQOps.d8ff.net/2019-05/test.txt
 

via

Dabbler
Joined
May 11, 2019
Messages
11
Code:
root@hqops:~# ls -l /mnt/backup/HQOps.d8ff.net/
total 50
drwxrwxr-x 2 dan root  62 May 11 13:18 2019-04
drwxrwxr-x 2 dan root  17 May 12 11:14 2019-05
drwxrwxr-x 2 dan root 115 May 12 10:18 2019-05-old
root@hqops:~#


2019-05-old and 2019-04 are backups made on old system and copied over yesterday which went fine. have tried renaming 2019-05 dir and it happily recreated OK but again stalled when gziping HTML backups (same result totally removing HQOps.d8ff.net directory, recreates it all fine but stops there).

touching files works fine...

Code:
root@hqops:~# touch /mnt/backup/HQOps.d8ff.net/2019-05/test.txt
root@hqops:~# ls -l /mnt/backup/HQOps.d8ff.net/2019-05/test.txt
-rwxrwxr-x 1 dan root 0 May 12 12:15 /mnt/backup/HQOps.d8ff.net/2019-05/test.txt
root@hqops:~#


This is a full backup run to show...

Code:
root@hqops:~# mv /mnt/backup/HQOps.d8ff.net /mnt/backup/HQOps.d8ff.net.old
root@hqops:~# ls -l /mnt/backup/HQOps.d8ff.net
ls: cannot access '/mnt/backup/HQOps.d8ff.net': No such file or directory

root@hqops:~# ./backup-sql
root@hqops:~# ls -l /mnt/backup/HQOps.d8ff.net
total 17
drwxrwxr-x 2 dan root 7 May 12 12:17 2019-05
root@hqops:~# ls -l /mnt/backup/HQOps.d8ff.net/2019-05/
total 71110
-rwxrwxr-x 1 dan root 33245659 May 12 12:17 '[2019-05-12][SQL]sub1.sql.gz'
-rwxrwxr-x 1 dan root 39494738 May 12 12:17 '[2019-05-12][SQL]sub2os.sql.gz'
-rwxrwxr-x 1 dan root     1393 May 12 12:17 '[2019-05-12][SQL]sub4.sql.gz'
-rwxrwxr-x 1 dan root   143422 May 12 12:17 '[2019-05-12][SQL]mysql.sql.gz'
-rwxrwxr-x 1 dan root     2973 May 12 12:17 '[2019-05-12][SQL]phpmyadmin.sql.gz'

root@hqops:~# ./backup-html
gzip: /mnt/backup/HQOps.d8ff.net/2019-05/[2019-05-12][HXXL]sub1.d8ff.net.tar.gz: Operation not permitted
gzip: /mnt/backup/HQOps.d8ff.net/2019-05/[2019-05-12][HXXL]sub2.d8ff.net.tar.gz: Operation not permitted
gzip: /mnt/backup/HQOps.d8ff.net/2019-05/[2019-05-12][HXXL]sub3.d8ff.net.tar.gz: Operation not permitted
gzip: /mnt/backup/HQOps.d8ff.net/2019-05/[2019-05-12][HXXL]sub4.d8ff.net.tar.gz: Operation not permitted
gzip: /mnt/backup/HQOps.d8ff.net/2019-05/[2019-05-12][HXXL]html.tar.gz: Operation not permitted
root@hqops:~# ls -l /mnt/backup/HQOps.d8ff.net/2019-05/
total 182582
-rwxrwxr-x 1 dan root 254566400 May 12 12:17 '[2019-05-12][HXXL]sub1.d8ff.net.tar'
-rwxrwxr-x 1 dan root         0 May 12 12:17 '[2019-05-12][HXXL]sub1.d8ff.net.tar.gz'
-rwxrwxr-x 1 dan root  48599040 May 12 12:17 '[2019-05-12][HXXL]sub2.d8ff.net.tar'
-rwxrwxr-x 1 dan root         0 May 12 12:17 '[2019-05-12][HXXL]sub2.d8ff.net.tar.gz'
-rwxrwxr-x 1 dan root   6696960 May 12 12:17 '[2019-05-12][HXXL]sub3.d8ff.net.tar'
-rwxrwxr-x 1 dan root         0 May 12 12:17 '[2019-05-12][HXXL]sub3.d8ff.net.tar.gz'
-rwxrwxr-x 1 dan root   7475200 May 12 12:17 '[2019-05-12][HXXL]sub4.d8ff.net.tar'
-rwxrwxr-x 1 dan root         0 May 12 12:17 '[2019-05-12][HXXL]sub4.d8ff.net.tar.gz'
-rwxrwxr-x 1 dan root     10240 May 12 12:17 '[2019-05-12][HXXL]html.tar'
-rwxrwxr-x 1 dan root         0 May 12 12:17 '[2019-05-12][HXXL]html.tar.gz'
-rwxrwxr-x 1 dan root  33245659 May 12 12:17 '[2019-05-12][SQL]sub1.sql.gz'
-rwxrwxr-x 1 dan root  39494738 May 12 12:17 '[2019-05-12][SQL]sub2os.sql.gz'
-rwxrwxr-x 1 dan root      1393 May 12 12:17 '[2019-05-12][SQL]sub4.sql.gz'
-rwxrwxr-x 1 dan root    143422 May 12 12:17 '[2019-05-12][SQL]mysql.sql.gz'
-rwxrwxr-x 1 dan root      2973 May 12 12:17 '[2019-05-12][SQL]phpmyadmin.sql.gz'
root@hqops:~#


backup-html bash script...

Code:
#!/bin/bash
DATEDMY=`date +%Y-%m-%d`
DATEMY=`date +%Y-%m`
BASE="/mnt/backup"
HOST=`hostname -A`
HOST="$(echo -e "${HOST}" | tr -d '[:space:]')"
DIR="$BASE/$HOST/$DATEMY"
NFS="secnas.d8ff.net:/mnt/Z2/backup"

# check if mount directory exists

if [ ! -d "$BASE" ]; then
        mkdir -p $BASE
fi

# if mount directory is empty then mount backup FS

if [ ! "$(ls -A $BASE)" ]; then
        mount -t nfs $NFS $BASE
fi

# check if backup directory exists

if [ ! -d "$DIR" ]; then
        mkdir -p $DIR
fi

cd /var/www/

for D in *; do
    if [ -d "${D}" ]; then
        if [ "${D}" != "System Volume Information" ]; then
                if [ ! -f "$DIR/[$DATEDMY][HXXL]${D}.tar.gz" ]; then
                        tar -cvf $DIR/[$DATEDMY][HXXL]${D}.tar ${D} > /dev/null 2&> /dev/null
                        if [ -f "$DIR/[$DATEDMY][HXXL]${D}.tar" ]; then
                                gzip $DIR/[$DATEDMY][HXXL]${D}.tar
                                echo "Backup ${D} for $DATEDMY completed" >> /tmp/backup.log
                        else
                                echo "Error processing ${D}" >> /tmp/backup.log
                        fi
                else
                        echo "Backup ${D} for $DATEDMY skipped (already exists)" >> /tmp/backup.log
                fi
        fi
    fi
done

 

via

Dabbler
Joined
May 11, 2019
Messages
11
Given up... deleted dataset and recreated with same settings and works as expected.
 
Top