NAS+Ubuntu+SVN

My NAS a “MyBook World Edition™ from  WesternDigital®” was sitting in the background just keeping the back-ups from time to time. Over the holiday period I took the time to setup and integrate the network drive better with Ubuntu and try to use the drive with subversion which I failed some time ago and did not bother to look any closer into it.

So here is what helped me (some of it is rather trivial).

As always this is without any warranty, try this at your own risk!

Ubuntu integration

For the integration with Ubuntu you just have to install an nfs package as shown below

[bash gutter=”false”]sudo apt-get install nfs-common[/bash]

Then you have to change the fstab file in an editor with root privileges by executing:

[bash gutter=”false”]sudo gedit /etc/fstab[/bash]

In this file you have to add for each of your partitions of your NAS a line. An example is given below, which works for me. You have to change the following to adapt it to your situatin.

  1. You should assign to your NAS a fixed IP
  2. The fixed IP has to go where in the example below you have the 192….100 address
  3. The path on the NAS drive follows the fixed IP address
  4. After some spaces you have to enter where on your Ubuntu machine the partitions are mounted

[code]# NAS Drive
192.168.1.100:/DataVolume/georg      /media/georg    nfs  defaults,user      0       0
192.168.1.100:/DataVolume/backup     /media/backup   nfs  defaults           0       0
192.168.1.100:/DataVolume/Public     /media/public   nfs  defaults,user      0       0[/code]

SVN integration

With the plain integration shown above SVN will not work properly. The nasty point is here that if you put your repository to the NAS you can check-out a working directory. But once you have made changes and want to commit you fail with an error that tells you that subversion was not able to get a lock on the file …db/txn-current-lock.

This can be worked around by adding to the fstab file options additional entries. For the previous example a change for a partition would look as given in the example below.

[code]# NAS Drive
192.168.1.100:/DataVolume/georg           /media/georg    nfs  defaults,user,nolock,bg      0       0
[/code]

A side effect will be probably (I am not 100% sure here) that in such an environment you should better not work with more than one person on the repository as otherwise you may get conflicts if 2 or more try to commit at the same point in time.