[Box Backup] How to move store to new machine

E.W. Peter Jalajas boxbackup@fluffy.co.uk
Sat, 13 May 2006 15:47:27 -0700 (PDT)


Hi all,

I'm back...  Sorry to go quiet for so long; just busy.

I'm moving my store from an old ubuntu (debian) breezy machine with
boxbackup 0.09 to a new ubuntu dapper with boxbackup 0.10 across the
room.  I've got about 8 clients out there in the wild, mostly
boxwin0.09. About 9 GB and 85,000 files in the store.

Details below.

I'm about to change my router/firewall port 2201 forwarding from the
old store machine to the new one... 

Can you all help me prevent hours of wasted time and bandwidth?  The
two error messages I'm concerned about are the rsync, for example:

rsync: send_files failed to open 

"/root/.bu/backup/<acctno>/write.lock": Permission denied (13)

and the bbstoreaccounts check, for example:

Directory ID 496 has wrong size for object 82b

Are they fatal?  Will they cause a complete repeat backing up my entire
9GB of storage?  How can I fix or work around them?

I hope my treatise below helps others.  I intend to clean it up and add
it to the wiki and Per's docs if appropriate.

Thanks!
Pete
--------------
(Please excuse my feeble redaction and the likely typo errors I
caused.)
I've kind of followed the FAQ:
http://boxbackup.hostworks.ca/index.php/FAQ
and bits and pieces from elsewhere (I'm too lazy to retrace my steps).

On the new store, I installed boxbackup 0.10 essentially following:

http://boxbackup.hostworks.ca/index.php/Compiling_and_Installing_on_Debian_GNU/Linux

but using 

http://prdownloads.sourceforge.net/boxbackup/boxbackup-0.10.tgz?download

(I flailed a bit doing apt-get installs to make readline work, but I
think I recall that installing libreadline5-dev finally made it work.)

My bbstored.conf:
user@new:~$ cat /etc/box/bbstored.conf

RaidFileConf = /etc/box/raidfile.conf
#pj 20060406: RaidFileConf points to a single dir /media/bu
AccountDatabase = /etc/box/bbstored/accounts.txt
# Uncomment this line to see exactly what commands are being received
from clients.
ExtendedLogging = yes
# scan all accounts for files which need deleting every 15 minutes.
TimeBetweenHousekeeping = 900
Server
{
        PidFile = /var/run/bbstored.pid
        User = _bbstored
        ListenAddresses = inet:0.0.0.0
        CertificateFile = /etc/box/bbstored/bu1.<domain>.com-cert.pem
        PrivateKeyFile = /etc/box/bbstored/bu1.<domain>.com-key.pem
        TrustedCAsFile = /etc/box/bbstored/clientCA.pem
}

My /etc/box/raidfile.conf:
disc0
{
        SetNumber = 0
        BlockSize = 1024
        Dir0 = /media/bu
        Dir1 = /media/bu
        Dir2 = /media/bu
}

(Note that I think the docs and mail archives are unclear as to doing
the 3 Dir[0-2] lines like that when NOT using boxbackup's raid.  Can
someone confirm?  It seems to work, so I think it's correct.)

(I also couldn't find anything useful about how to choose a good block
size.  Would someone please comment extensively on that?)

/media/bu is mounted on /dev/md0 which is 2 250GB harddrives raid 1
(mirrored):
df -h /media/bu/ | grep md
/dev/md0              230G   13G  206G   6% /media/raid
cat /etc/mdadm.conf
ARRAY /dev/md0 level=raid1 num-devices=2 <snip>

I stopped any possible running bbstored with:

sudo killall bbstored

and did a:

ps -ef | grep bbstored

to make sure.

I copied the accounts.txt and keys from the old /etc/box/bbstored/ to
the new one using on the old store:

for x in `sudo find /etc/box/bbstored -type f` ; do zip bbstored.zip
${x} ; done

scp bbstored_old.zip user@new:~

and then on the new store, moved that zip file to /etc/box/bbstored/
and unzipped it (well not exactly, but something like that with a few
key-file moves by hand to clean up the little mess I had just made).

(For editing some files, I typically lately use something like the
following to make a quick backup first:
sudo cp -p --force --backup=t /etc/box/bbstored/accounts.txt
/etc/box/bbstored/accounts.txt ; sudo vim
/etc/box/bbstored/accounts.txt )

One both machines, to make sure I had the same files in 
/etc/box/bbstored/, I ran:

for x in `sudo find /etc/box/bbstored -type f` ; do sudo sha1sum ${x} ;
done

and compared the output.

I've been using the rsync command below approx daily over the past
several weeks to keep the old and new stores in sync in prep for the
move.  See the write.lock errors that I got for every account.

user@new:~$ sudo nice rsync -v -u -a --delete --rsh=ssh --stats
user@old:/root/.bu /media/bu
receiving file list ... done
<snip>
backup/<acctno>/
backup/<acctno>/info.rfw
backup/<acctno>/od7.rfw
backup/<acctno>/odb.rfw
rsync: send_files failed to open
"/root/.bu/backup/<acctno>/write.lock": Permission denied (13)
backup/<acctno>/14/
backup/<acctno>/14/o55.rfw
<snip>
Number of files: 85820
Number of files transferred: 14
Total file size: 9811359304 bytes
Total transferred file size: 252040 bytes
Literal data: 12277 bytes
Matched data: 239763 bytes
File list size: 1212024
File list generation time: 9.919 seconds
File list transfer time: 0.000 seconds
Total bytes sent: 2760
Total bytes received: 1227291
sent 2760 bytes  received 1227291 bytes  54668.93 bytes/sec
total size is 9811359304  speedup is 7976.38
rsync error: some files could not be transferred (code 23) at
main.c(1173)

I think the write.lock errors are because those files are owned by user
_bbstored with 
-rw-------   1 _bbstored users      0 2006-05-13 18:19 write.lock
and I'm too lazy and not smart enough to figure out if I should change
those permissions to 644 or rsync as root (on ubuntu) or other fix, or
if I need them on the new store anyway (maybe they get recreated?
Please help!).

To check the new store, I ran:

for x in `sudo cat /etc/box/bbstored/accounts.txt | cut -d\: -f1` ; do
sudo bbstoreaccounts check ${x} ; done

and for each account I got (note the many "wrong size" errors):

Check store account ID <acctno>
Phase 1, check objects...
<snip>
Directory ID 496 has wrong size for object 82b
<above repeated many times for different ID and objects>
Phase 3, check root...
Phase 4, fix unattached objects...
Phase 5, fix unrecovered inconsistencies...
Phase 6, regenerate store info...
Store account checked, no errors found.

I don't know if that "wrong size" error is important, and/or related to
the write.lock error, or neither.  

When I get the two errors above resolved, I'll change my firewall to
forward port 2201 to the new machine. And it should just work, right?

(I'll eventually move my current boxbackup0.09 clients to 0.10, but I'm
in no rush.  However, for new Windows clients, I'll use
http://boxbackup.hostworks.ca/index.php/0.10#Windows_native_client_status
)