# gzip gives error when used over NFS

## Brent Dax

I have a fairly simple backup script on my Gentoo server which runs as root.  In summary, it dumps my MySQL databases and Subversion repositories to files, then writes a tarball of the entire file system to my (Ubuntu) desktop over NFS.  It hasn't been working for a while, though, and I finally got around to debugging it today.

From what I can see, the problem is specifically with gzip: it refuses to operate over NFS.  Writing a tarball of a small directory to the NFS mount works fine without the 'z' option, but fails with it; gzipping a file on the NFS mount also fails.  The error message the test file gives is "gzip: /mnt/backup/test.gz: operation not permitted"; tar formats its message a little differently, as "tar: /mnt/backup/test.tar.gz: Cannot open: operation not permitted".

Once again, I can perform other read and write operations on the NFS mount; only gzipping seems to fail.

Thanks for any assistance you can provide.

----------

## dfelicia

Is date/time in sync on client and server?  NFS is very particular about time...

Have you considered scrapping NFS as your solution, and streaing the tarball over ssh, instead?  Better yet, how about rsync to do incremental backups, rather than tarball your whole system every time?

Not an answer to your post, I know, but some viable alternatives to NFS.

----------

## Brent Dax

 *dfelicia wrote:*   

> Is date/time in sync on client and server?  NFS is very particular about time...

 

It looks that way, although they might be a second or two apart.  Both are talking to network time servers.

 *Quote:*   

> Have you considered scrapping NFS as your solution, and streaing the tarball over ssh, instead?

 

I tried that yesterday and it seemed to have its own issues (the backups didn't seem to finish), although I was in a hurry at the time and didn't really set things up the way I would if I seriously pursued this option (e.g. with SSH keys for access).

 *Quote:*   

> Better yet, how about rsync to do incremental backups, rather than tarball your whole system every time?

 

I actually have far less space on the partition I'm backing up to than I do on the server, so everything must be compressed before it's put on that partition.  I don't think that rsync can handle that, although I could be wrong.

 *Quote:*   

> Not an answer to your post, I know, but some viable alternatives to NFS.

 

I really don't like NFS much, so I'm certainly open to alternatives.

----------

## dfelicia

So if you're not married to NFS, try ssh, again.  Something like:

```

tar jcfp - <dir> | ssh <user>@<host> '(cd <destination dir> ; cat > backup_`date '+%m_%d_%Y'`.tar.bz2)'

```

You can use public key authentication to avoid being prompted for a password (or try keychain).

----------

