LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Networking
User Name
Password
Linux - Networking This forum is for any issue related to networks or networking.
Routing, network cards, OSI, etc. Anything is fair game.

Notices

Reply
 
Search this Thread
Old 11-23-2007, 05:08 AM   #1
gmh04
LQ Newbie
 
Registered: Jan 2005
Distribution: Debian
Posts: 15

Rep: Reputation: 0
NFS mount external drive


Hello

I'm having some trouble NFS mounting a USB external drive.

On my server I mount the drive in /etc/fstab as:

Quote:
/dev/sda1/ /media/archive vfat rw,user,gid=archive,umask=007 0 0
On the client I can mount it with

Quote:
mount -t nfs 198.168.1.2:/media/archive /archive
However I get permission denied when I try to access /archive

I can successfully mount any other location from the server, but not the /media/archive which is a USB external drive.

I'm running Debian Etch on both machines.

Attempting to mount the same drive from Ubuntu give me the following error:

Quote:
mount: wrong fs type, bad option, bad superblock on 192.168.1.2:/media/archive,
missing codepage or helper program, or other error
In some cases useful info is found in syslog - try
dmesg | tail or so
Any help is appreciated.
 
Old 11-23-2007, 05:39 AM   #2
jschiwal
Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654
Could you show "ls -ld /media/archive" on the server.

Also, /etc/exports on the server and /usr/sbin/showmount --exports 192.168.1.2 at the client.

You might want to use the "uid=<username>" option in mounting the devices.
 
Old 11-23-2007, 05:58 AM   #3
gmh04
LQ Newbie
 
Registered: Jan 2005
Distribution: Debian
Posts: 15

Original Poster
Rep: Reputation: 0
ls -ld /media/archive/

Quote:
drwxrwx--- 11 root archive 32768 1970-01-01 01:00 /media/archive/
/etc/exports

Quote:
/media/archive 192.168.1.0/20(rw,sync,subtree_check)
(on client) /sbin/showmount --exports 192.168.1.2

Quote:
Export list for 192.168.1.2:
/media/archive 192.168.1.0/20

Can you give me an example of using "uid=<username>" option, I'm having a bit of trouble with it?
 
Old 11-23-2007, 07:22 AM   #4
jschiwal
Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654
For an external drive use the UUID= or LABEL= entry instead of the device node. The device node could easily change for an external drive.

Code:
udevinfo -q env -n /dev/sdb1
DEVTYPE=partition
ID_VENDOR=SanDisk
ID_MODEL=Cruzer_Mini
ID_REVISION=0.1
ID_SERIAL=SanDisk_Cruzer_Mini_200517395007FC20132F-0:0
ID_SERIAL_SHORT=200517395007FC20132F
ID_TYPE=disk
ID_INSTANCE=0:0
ID_BUS=usb
ID_PATH=pci-0000:00:02.2-usb-0:2.7:1.0-scsi-0:0:0:0
ID_FS_USAGE=filesystem
ID_FS_TYPE=vfat
ID_FS_VERSION=FAT16
ID_FS_UUID=3B69-1AFD
ID_FS_UUID_ENC=3B69-1AFD
ID_FS_LABEL=XMas
ID_FS_LABEL_ENC=XMas
ID_FS_LABEL_SAFE=XMas
Here I just now plugged in a pendrive. To create a unique fstab entry for this, I will use the UUID instead of the device. Some of these options were selected because it is a pendrive.
Code:
UUID=3B69-1AFD /media/xmas vfat rw,noauto,nosuid,nodev,noatime,flush,uid=1000,utf8,shortname=lower 0 0
Another way is to use a username instead:

Code:
UUID=3B69-1AFD /media/xmas vfat rw,noauto,nosuid,nodev,noatime,flush,user,uid=jschiwal,gid=jschiwal,fmask=117,dmask=007,utf8,shortname=lower 0 0
The noauto, and uid and user options work good together. (Come to think of it, using the "owner" option might be even better in this case) The uid= option sets the ownership of the mounted partition, and it's contents. The ownership for vfat and ntfs are set in the fstab options and not using "chown" as you could with a native Linux filesystem.

Using the above fstab entry, a normal user can mount and umount the disk. The ownership and group ownership will be jschiwal.jschiwal and the permissions will be rwxrrx--- on directories and rw-rw--- on files. Because the uuid number is unique, I can have more than one fstab entry, one for each pendrive. Another user could not access it on this computer. (very weak security I know, but still convenient.) User jschiwal can mount it without using sudo. It could even be mounted by a command in ~/profile.

On the client (hpmedia.jesnet) I added this to /etc/fstab:
Code:
hpamd64.jesnet:/mnt/xmas /mnt/xmas nfs noauto,defaults,soft,_netdev 0 0

On the server (hpamd64.jesnet) I added this to /etc/fstab:
Code:
UUID=3B69-1AFD  /mnt/xmas       vfat    rw,noauto,nosuid,nodev,noatime,flush,user,uid=jschiwal,gid=jschiwal,fmask=117,dmask=007,utf8,shortname=lower 0 0
and to /etc/exports:
Code:
cat /etc/exports
/mnt/xmas       *.jesnet(fsid=0,ro,root_squash,sync,no_subtree_check)
Now on the client:
Code:
sudo mount /mnt/xmas
root's password:
jschiwal@hpmedia:~> ls -ld /mnt/xmas
drwxrwx--- 2 jschiwal jschiwal 16384 Dec 31  1969 /mnt/xmas
If the pendrive weren't mounted on the server, then trying to mount /mnt/xmas on the client would fail. Also, I didn't change the ownership of /mnt/xmas on the client. Before mounting it's owned by root.

One difference is that I didn't use root as the owner, and I used root_squash on the export definition. I assume that in your case a member of user "archive" uses this nfs share for creating backups.

I wouldn't recommend using ntfs (or vfat) as the filesystem of choice. Use a native Linux filesystem. While ntfs-3g has read/write support, I wouldn't trust it for something as important as backups. Fat32 has a small filesize limit and isn't very robust.

Using /media/ for the drive mount may not be a good idea either on the nfs server. While /media/ is used for external media, since you are offering it up as a share and since you have an entry for it in /etc/fstab, using /media might cause problems due to hald interaction. I'm not certain but would use /mnt/ instead as a precaution.
---

I hope I remember to undo all this after posting!

Last edited by jschiwal; 11-23-2007 at 07:31 AM.
 
Old 11-23-2007, 08:33 AM   #5
gmh04
LQ Newbie
 
Registered: Jan 2005
Distribution: Debian
Posts: 15

Original Poster
Rep: Reputation: 0
Thanks for that, I can mount the drive from a debian client. A number of points though, my device has a blank ID_FS_UUID so I had to stick with /dev/sda1, and the flush option was not recognised (I just removed it).

More frustratingly though, I still have the same error on the Ubuntu client. I run the same command and still get:

Quote:
mount: wrong fs type, bad option, bad superblock on 192.168.1.2:/media/archive,
missing codepage or helper program, or other error
In some cases useful info is found in syslog - try
dmesg | tail or so
 
Old 11-24-2007, 04:03 AM   #6
gmh04
LQ Newbie
 
Registered: Jan 2005
Distribution: Debian
Posts: 15

Original Poster
Rep: Reputation: 0
I solved the problem on Ubuntu by installing nfs-common. I didn't realise this was required on the client.

jschiwal, thanks for you help and advice!
 
Old 12-30-2007, 05:58 AM   #7
borobudur
LQ Newbie
 
Registered: Dec 2007
Posts: 6

Rep: Reputation: 0
Serveral User Problem with remote usb mount

Nice explanation jschiwal!

I just have one little problem with my remote usb-drive.

I have two users on the client and one of them can't access the mount because the owner after mounting is the user with uid=1000.

I don't understand who sets it to this user?

Here a better explanation of the actual condition:
Server has user X
Client has user Y and Z
After mounting the mounted directory has the owner Y and group Y.
Z can't access

Any idea??
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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 Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
can not un-mount external drive, please help mhg Linux - Newbie 5 07-23-2007 01:29 AM
mount external drive problem DotHQ Linux - General 1 06-12-2007 10:47 PM
How to Mount External USB CD Drive? ArchiMark Linux - Laptop and Netbook 12 05-29-2006 07:10 PM
cant mount external scsi drive jmarsh Linux - Hardware 2 12-17-2003 06:13 PM
nfs mount of solaris drive starkeylabs Linux - Networking 4 06-20-2003 10:16 AM


All times are GMT -5. The time now is 07:09 AM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration