After realizing how slow SMB is between my QNAP NAS and my MBP is, I’ve decided to turn my CentOS 5 box into a NFS server to improve on my network speeds (mainly to view large iPhoto library archives over the network with a little less pain). Here are the steps I took to get NFS working between my CentOS 5 server and MBP client:
Server Configuration
1. Format 2nd 80GB HDD as a vfat partition
$ mkfs.vfat -c -F 32 /dev/sdb1
2. Create mount point and mount new vfat partition (I did this via /etc/fstab)
$ cat /etc/fstab /dev/VolGroup00/LogVol00 / ext3 defaults 1 1 LABEL=/boot /boot ext3 defaults 1 2 tmpfs /dev/shm tmpfs defaults 0 0 devpts /dev/pts devpts gid=5,mode=620 0 0 sysfs /sys sysfs defaults 0 0 proc /proc proc defaults 0 0 /dev/VolGroup00/LogVol01 swap swap defaults 0 0 /dev/sdb1 /media/disk1 vfat defaults,uid=501,gid=20 0 0
NOTE: The UID and GID need to be the same as the user on the Mac that you’ll be mounting the NFS share with. This is so that the user will have sufficient privileges to write to the disk. In my case the Mac user’s UID/GID is 501/20.
3. Create /etc/exports file
$ cat /etc/exports /media/disk1/pictures 192.168.1.0/255.255.255.0(rw,no_root_squash,sync,insecure,anonuid=501,anongid=20)
Again, note the anonuid is 501, and the anongid is 20, same as the Mac user’s UID/GID. Also, the ‘insecure’ option seems to be required as well when NFS mounting from a Mac.
4. Config /etc/hosts.allow file
$ cat /etc/hosts.allow # # hosts.allow This file describes the names of the hosts which are # allowed to use the local INET services, as decided # by the '/usr/sbin/tcpd' server. # portmap: 192.168.1.0/255.255.255.0
5. Configure NFS services to start on bootup
$ chkconfig nfs on $ chkconfig --list nfs nfs 0:off 1:off 2:on 3:on 4:on 5:on 6:off
6. Start NFS daemons
$ service nfs start Starting NFS services: [ OK ] Starting NFS quotas: [ OK ] Starting NFS daemon: [ OK ] Starting NFS mountd: [ OK ]
Client Configuration (on MBP)
1. Determine Mac user’s UID/GID and make sure NFS server’s /etc/exports and /etc/fstab files reflect the same UID/GID
$ id user uid=501(user) gid=20(staff) groups=20(staff),98(_lpadmin),81(_appserveradm),79(_appserverusr),80(admin),101(com.apple.sharepoint.group.1)
2. Create mount point on the Mac
$ mkdir /Users/echua/pics
3. Mount NFS export
$ /sbin/mount <seerver>:/media/disk1/pictures /Users/echua/pics
4. Test it out by dragging and dropping files to the new file share and if all goes well you should be able to write and delete files from the share.
This NFS solution works out so much better than Samba, at least for my iPhoto picture archiving needs. Viewing iPhoto albums over NFS is much faster than over SMB.
[...] case, so this led me to try using NFS as an alternative to SMB, at least for my iPhoto file share. Here are the steps I took to configure NFS between my CentOS 5 box and my MBP. Possibly related posts: [...]