[Box Backup] backup on nfs-mounted storage

ruben boxbackup@fluffy.co.uk
Tue, 17 Oct 2006 15:53:26 +0200


Hi,

I have a simple NAS-box (Icy Box NAS-1000) with a large disk connected
on my home-network, which I would like to store my backups on. I
access the NAS through NFS.  My intention is to run both the server
and the client on each computer (on linux).

(ideally, the server should run on the NAS box, which is probably
possible with enough tinkering, but i already read that the server in
boxbackup requires 'some' cpu power because of the encrypted transfer
channel, so this is probably a better setup anyway)

The bbstored user can create and delete files on the NFS mounted
storage.  "root" can create files, but its uid is mapped to the
"nobody" uid.  So, root cannot modify files from bbstored.  Should
this configuration work?

I'm in the process of setting this up and get stuck when trying to
create a backup account with bbstoreaccounts. I ran it through strace,
output follows.

I assume the problem is the following:
flock(3, LOCK_EX|LOCK_NB)               = -1 ENOLCK (No locks available)

Hmm... I just looked at the source code, and I guess this is indeed
the problem.  On Linux, flock can't lock files which are on
NFS-mounted storage, one should use fcntl for that.  I see in the
source code (NamedLock.cpp) that there is an alternative lock
implementation that uses fcntl (if HAVE_DECL_F_SETLK is defined).

So, this should in principle work, if I compile it with the fcntl
implementation? Are there any drawbacks on using the fcntl
implementation instead of flock?

Ruben

=========================
beast ~ # strace  bbstoreaccounts create 130181 0 90G 100G    
<snipped irrelevant part....>
open("/etc/passwd", O_RDONLY)           = 3
fcntl64(3, F_GETFD)                     = 0
fcntl64(3, F_SETFD, FD_CLOEXEC)         = 0
_llseek(3, 0, [0], SEEK_CUR)            = 0
fstat64(3, {st_mode=S_IFREG|0644, st_size=3211, ...}) = 0
mmap2(NULL, 3211, PROT_READ, MAP_SHARED, 3, 0) = 0xb7f7e000
_llseek(3, 3211, [3211], SEEK_SET)      = 0
munmap(0xb7f7e000, 3211)                = 0
close(3)                                = 0
setresgid32(-1, 450, -1)                = 0
setresuid32(-1, 112, -1)                = 0
stat64("/mnt/nessy/backup", {st_mode=S_IFDIR|0755, st_size=4096,...})= 0
stat64("/mnt/nessy/backup/00130181", {st_mode=S_IFDIR|0755,
  st_size=4096, ...}) = 0
stat64("/mnt/nessy/backup/00130181/info.rfw", 0xbfc6bd70) = -1 ENOENT
  (No such file or directory)
stat64("/mnt/nessy/backup/00130181/info.rf", 0xbfc6bd70) = -1 ENOENT
  (No such file or directory)
open("/mnt/nessy/backup/00130181/info.rfwX",
  O_WRONLY|O_CREAT|O_LARGEFILE, 0666) = 3
flock(3, LOCK_EX|LOCK_NB)               = -1 ENOLCK (No locks available)
close(3)                                = 0
futex(0xb7d39b34, FUTEX_WAKE, 2147483647) = 0
futex(0xb7c514c8, FUTEX_WAKE, 2147483647) = 0
getgid32()                              = 0
setresgid32(-1, 0, -1)                  = 0
getuid32()                              = 0
setresuid32(-1, 0, -1)                  = 0
fstat64(1, {st_mode=S_IFCHR|0620, st_rdev=makedev(136, 8), ...}) = 0
mmap2(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1,
  0) = 0xb7f7e000
write(1, "Exception: RaidFile OSError (Err"..., 171Exception: RaidFile
  OSError (Error when accessing an underlying file. Check file
  permissions allow files to be read and written in the configured
  raid directories.) (2/8)
) = 171
exit_group(1)                           = ?
Process 17584 detached