LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   fstab or export options needed to write to an nfs mounted ntfs export (https://www.linuxquestions.org/questions/linux-general-1/fstab-or-export-options-needed-to-write-to-an-nfs-mounted-ntfs-export-892766/)

chief427 07-20-2011 11:15 AM

fstab or export options needed to write to an nfs mounted ntfs export
 
I need to be able to backup a (drupal) CMS site to an external location. For many reasons, that external location is an external USB HDD on another machine on my LAN.
The USB HDD has 2 partitions, 1 NTFS and the other ext3. I need to back up to the NTFS parition (don't ask why, unless it affects the solution, I just do and the reason is not pretty!).
The machine with the USB HDD attached (the destination) mounts it (via fstab) using the following:
/dev/disk/by-id/usb-WD_My_Book_1110_5743415A4131353639333138-0:0-part1 /usbhdd/ntfs ntfs-3g user,users,gid=users,fmask=133,dmask=022,locale=en_AU.UTF-8 0 0

and exports it (in /etc/exports) using this :
/usbhdd/ntfs *(fsid=0,crossmnt,rw,root_squash,sync,no_subtree_check)

The Drupal site runs a cron job to automate the backup (not sure if it is run as root or wwwrun, but the backup tests I have tried have been via the Drupal admin, while simple file/directory creation tests have been done as root).

The machine running Drupal that I want to back up mounts the USB hdd using nfs with the following fstab entry:
192.168.0.26:/usbhdd/ntfs /usbhdd nfs defaults 0 0

The mount works in read-only mode - I can see files and directories, but even as root I can not create a directory and of course the Drupal backup fails.
I have tried substituting the simplict "rw" option for "defaults" and a few combinations of umask (0000 and 0002) to no avail, along with quite a few variations of fstab and export options at the destination and fstab options at the source.
The backup path exists, the IP address is correct (obviously, I can mount and see files), but no matter what combination of source mount options or destination mount and export options I try, it seems I can not make this writable.
On the destination box (where the USB HDD is mounted via fstab), the permissions appear as this:
drwxr-xr-x 4 root users 4096 2011-07-20 23:05 usbhdd

On the source box where it is mounted via nfs, it appears as follows:
drwxrwxr-x 1 root root 4096 2011-07-21 01:08 usbhdd
and mount returns the following:
192.168.0.26:/usbhdd/ntfs on /usbhdd type nfs (rw,addr=192.168.0.26)

Even as simple mkdir (mkdir /usbhdd/test) as root on the source box fails with a "permission denied" error.

Both machines are running OpenSuse 11.3
Any and all help in resolving this would be greatly appreciated.

chrism01 07-20-2011 08:07 PM

Quote:

root_squash
NFS option (default) that automatically converts root client to non-priv user, therefore
Quote:

drwxr-xr-x
on nfs server is un-writeable from/by client-root user ....

HTH

chief427 07-21-2011 07:07 AM

most of the solution - many thanks
 
Thanks very much chrism01 - this got me most of the way there (I could create files/directories as root on the source box), however the backups still failed.

I went back and { for int x=0; x<5; x++) {re-read the man page(s);} } to ensure I understood the change you suggested and from there I believe I found the second part of the problem, which is (I think) in the way the ntfs partition was originally mounted on the destination.

The fstab entry is (AFIK) mounting as writable only by root, and nothing the nfsserver/exports configuration said was going to change that.

I changed the fstab entry to /dev/disk/by-id/...etc /usbhdd/ntfs ntfs-3g defaults,locale=en_AU.UTF-8 0 0

and lo and behold it became writable (by everyone), which then allowed your suggestion to work for the uid that actually performed the backup.
This is not quite optimal, as I would like this directory (which is a couple of levels below /usbhdd) to be rw only by that user (and root of course), but at least my backups now work and my site doesn't remain offline after the backup fails !
I can fine tune this (I think) by exporting directories below /usbhdd (specifically, /usbhdd/mywebsite/backups) with machine and user/group specific parameters (anonuid and anonguid)


All times are GMT -5. The time now is 05:22 PM.