I have 6 raspberry pi (model B) units on my home network and, following a tutorial (here: http://youresuchageek.blogspot.com.au/2013/01/raspberrypi-root-over-nfs-share.html?m=1), have configured them to mount rootfs on NFS from my NAS. (they each have their own NFS mounts - not sharing the same)
The rationale behind doing this was to simplify backups of the main root partition, and eliminate the risk of SD card corruption in the case of power failure, since my current setup is a rats nest of cables on top of my printer(!), which occasionally get knocked causing reboots.
The 2nd half of the linked article provides steps to create a swap file using a loop device, and the swapfile itself is also on the NAS. The NAS and pis are all connected to the same gigabit switch.
My question is this: is the swapfile in the best place for performance and stability? Since the pis now only use a boot partition, I could move the swap file back to the SD card, but I don't know if I would be re-exposing myself to data corruption risk. Also, if the swap gets too much use, will it have any adverse affect on the (WD red) disks in the NAS?
Edit following answer from Mark Komarinski:
As it turns out, there is not actually much swap being used - currently only 54k on the busiest pi:
~ $ free
total used free shared buffers cached
Mem: 496632 479404 17228 0 560 50740
-/+ buffers/cache: 428104 68528
Swap: 1048572 53684 994888
I ran the time tests with some interesting results:
First, creating a file on the NAS:
~ $ time dd if=/dev/urandom of=/tmp/myfile bs=1k count=10k
10240+0 records in
10240+0 records out
10485760 bytes (10 MB) copied, 11.4046 s, 919 kB/s
real 0m11.460s user 0m0.050s sys 0m9.610s
Second, mount the original root partition to /tmp/p2
~ $ mkdir /tmp/p2 && sudo mount /dev/mmcblk0p2 /tmp/p2/
Third, create a file on the mounted SD card 2nd partition
~ $ time dd if=/dev/urandom of=/tmp/p2/tmp/myfile bs=1k count=10k
10240+0 records in
10240+0 records out
10485760 bytes (10 MB) copied, 10.1706 s, 1.0 MB/s
real 0m10.217s user 0m0.020s sys 0m9.960s
Not much difference. I was expecting the NAS to be much faster, especially since the pi and NAS are on the same switch.
I also tested with creating a 100MB file and the results were more obvious - SD averaged 968 kB/s (1m48s) and the NAS averaged 692 kB/s (2m31s), so the SD card is definitely faster.
Many thanks, Tiksi