Archive

Posts Tagged ‘nfs’

Ubuntu 9.04 NFS fstab problems

July 19th, 2009 Arthur Gressick No comments

I had a problem with the new release of Ubuntu 9.04 server not mounting remote shares upon boot. Turns out that the network service starts up after fstab now. An easy fix was to edit the /etc/rc.local file here is what I changed/added

/etc/rc.local

#!/bin/sh -e
#
# rc.local
#
# This script is executed at the end of each multiuser runlevel.
# Make sure that the script will "exit 0" on success or any other
# value on error.
#
# In order to enable or disable this script just change the execution
# bits.
#
# By default this script does nothing.
 
#mount the NFS Shares
mount -a
 
exit 0

Above just added the “mount -a” just before the exit 0. Hope this helps everyone who is having the same problem. Seems to work perfect for me.

Categories: Ubuntu 9.x Server Tags: , ,

ZFS sharing over NFS

March 27th, 2009 Arthur Gressick 1 comment

These are some instructions for setting up a NFS share in OpenSolaris with ZFS commands.

My plan is to share a secondary drive installed in my PC to other computers using NFS protocol. I am using a 260 GB drive that is connected to the SATA port inside the computer. First we need to make sure that the drive is formatted properly and ZFS pool is set right.

You might want to take a look at the other ZFS references on our site before continuing.

My information: 2.5″ Hitachi drive, capacity 260GB RAW, Drive ID = “c6d0″

Setup my pool called “laptop” (running as root)

zpool create laptop c6d0

Then we need a few folders on the drive just to make things nice. I am going to call it “freebie”

zfs create laptop/freebie

Now for some NFS magic

zfs set sharenfs=on laptop/freebie

Verify that the NFS share point is set properly

zfs get sharenfs laptop/freebie

Set the permissions for the folder so people can read and write to it. There are normal NIX commands

chmod 1777 /laptop/freebie

Also I want to locally go into the folder to modify the information through the GUI

zfs allow -u arthur create,mount laptop/freebie

Now you can test this by connecting. I am going to use a Mac for connecting, here is the command:

nfs://192.168.1.21:/laptop/freebie

I dropped a few files and it transferred over to the folder. They were 616KB, 1.7MB, and 120KB, this is important for the next example which is to enable compression which I am going to turn on. If you don’t want any compression then you can stop this demo.

Enabling compression is quite easy but I am not sure if existing files will compress but any new files will compress as they are added and removed.

Enable Compression

zfs set compression=on laptop/freebie

Disable Compression

zfs set compression=off laptop/freebie

So I now the files are 608KB, 1.4MB, 38KB respectively, going to test larger files next. That is it for this demo. I have some other projects to work on including now setting up SMB to this folder as well or another folder.

Ubuntu NFS Server

February 12th, 2009 Arthur Gressick No comments

Well I always seem to need these notes for setting up the NFS server for Ubuntu so here they are. Also I found NFS to be a great storage share for anything related to backing up or moving around files. I even use it for VMware and databases.

NFS Installation

Run this as root

apt-get install nfs-kernel-server nfs-common portmap

When configuring portmap do not bind loopback. If you do you can either edit /etc/default/portmap using the following:

nano /etc/default/portmap

Restart Portmap using the following command

/etc/init.d/portmap restart

NFS Server Configuration

NFS exports from a server are controlled by the file /etc/exports. Each line begins with the absolute path of a directory to be exported, followed by a space-seperated list of allowed clients.

You need to edit the exports file using the following command

nano /etc/exports

Here are the mounts for our infrastructure

/mnt/left_raid/nfs 10.10.1.0/255.255.255.0(rw,sync,no_subtree_check)

Now you need to restart NFS server using the following command

/etc/init.d/nfs-kernel-server restart

If you make changes to /etc/exports on a running NFS server, you can make these changes effective by issuing the command

exportfs -a

Client Connection
This is the command you would want to run from a computer that would connect back to the NAS

mount 10.10.2.100:/mnt/left_raid/nfs /mnt/nas

Additional Information
If you’re connection to a Linux NFS server from Mac OS X, you need to specify ‘insecure’ in your exports and map the user IDs since Macs use uid 501 for the first regular user. For my /etc/exports I use:

/home 192.168.0.0/255.255.255.0(rw,async,insecure,all_squash,anonuid =1000,anongid=1000)