LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - General
User Name
Password
Linux - General This Linux forum is for general Linux questions and discussion.
If it is Linux Related and doesn't seem to fit in any other forum then this is the place.

Notices


Reply
  Search this Thread
Old 07-20-2011, 11:15 AM   #1
chief427
LQ Newbie
 
Registered: Jul 2011
Location: Newcastle, NSW, Australia
Distribution: ESXi with Open Suse, Centos, Ubuntu, Win XP, Win7, MS Server 2008 R2, Solaris x86, QNX and others,
Posts: 8

Rep: Reputation: Disabled
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.
 
Old 07-20-2011, 08:07 PM   #2
chrism01
LQ Guru
 
Registered: Aug 2004
Location: Sydney
Distribution: Rocky 9.2
Posts: 18,361

Rep: Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751Reputation: 2751
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
 
Old 07-21-2011, 07:07 AM   #3
chief427
LQ Newbie
 
Registered: Jul 2011
Location: Newcastle, NSW, Australia
Distribution: ESXi with Open Suse, Centos, Ubuntu, Win XP, Win7, MS Server 2008 R2, Solaris x86, QNX and others,
Posts: 8

Original Poster
Rep: Reputation: Disabled
Thumbs up 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)
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] NFS export multiple mounted file systems under a single root AdamDaughterson Linux - Server 2 07-28-2009 01:28 PM
export NFS mounted file system via NFS smkamene Linux - Networking 3 02-10-2009 03:12 PM
Remote NFS export (via fstab) isn't mounted at boot tisource Linux - General 3 10-30-2005 04:57 PM
export a mounted Samba share w/NFS nifflerX Linux - Software 3 07-18-2005 11:29 PM
NFS export of directory with mounted iso-images leipy SUSE / openSUSE 1 06-03-2005 08:12 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - General

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

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration