Saving Files to NFS Storage

From BCCD 3.0

Jump to: navigation, search

Mounting the NFS Filesystem

Become Root

[bccd@mocha]>su -

The password is letmein (or see the login splash screen for your image's root password).

Start Portmap

Portmap is a service that needs to be running to mount an NFS share.

[root@mocha]# /etc/init.d/portmap start

Make a Mount Point

Make the "mount point" on a read-write area of the BCCD system:

mkdir /mnt/rw/nfs

Mount the NFS Filesystem

Finally, mount the NFS filesystem:

mount /mnt/rw/nfs

where is the host name of the nfs server, /remote/files is the filesystem that the nfs server is exporting, and /mnt/rw/nfs is where you would like the files locally mounted.

Accessing the Filesystem

Access as Root

Depending on what options the nfs server is currently running, you may or may not be able to access your files as user 'root' on the BCCD. To try this, just cd to the /mnt/rw/nfs directory and see what happens. If this works, then modify to your heart's content and skip to the next section. If it doesn't work, you will probably see an error message much like the following:

[root@mocha]# cd /mnt/rw/nfs
bash: cd: nfs: Permission denied

If you do NOT get any error, chances are you are all set: log out and enjoy. Otherwise, the NFS server is probably configured with a 'root squash' option, which doesn't allow root to access any filesystems.

Access as a New User

To get around the 'root squash', you need to create a user with the same UID (user id) as you usually have when using your NFS filesystem. If you don't know what your user id is, issue this command:

[root@mocha]>ls -la /mnt/rw/

and you should see something like the following:

total 12
drwxrwxrwt   10 root     root       200 Jun  3  15:01  .
drwxr-xr-x    1 root     root        32 Jan  1   1970  ..
drwx------      1001     1001        60 Jun  3   2004  nfs

Look for the nfs line. In the above example, the UID of the mounted nfs directory is 1001. Make a new user corresponding to the UID of the mounted nfs directory. This can be done as follows:

[root@mocha]# useradd -u 1001 username

where 1001 is your UID and username is your username (not root, but your usual NFS username).

Now become the new user.

[root@mocha]# su - username

where username is your username. Now cd into the NFS mounted directory and modify away!

[username@mocha]> cd /mnt/rw/nfs

Unmounting the NFS Filesystem

On a Unix-style system, drives that are mounted cannot be arbitrarilly removed. To unmount the filesystem, you will need to do a few simple things:

Once you have met these conditions, you need to unmount the disk partition.

[root@mocha:~]# umount /mnt/rw/nfs

[Note that there is no "n" in umount. It's missing. If you find it, please let us know so that we can put it with the "e" that we found left out of /etc/resolv.conf]

That should do it!

Personal tools