This MindTouch Deki has expired; please contact your system administrator. Visit MindTouch.com for activation information.
Page last modified 01:18, 22 Apr 2006 by Ppragin?
Zmanda Documentation > How Backup Windows clients using Samba and Amanda

How Backup Windows clients using Samba and Amanda

Table of contents
No headers

Install Samba on the main Amanda backup server using SVN:
1. Install a recent copy of Subversion. All you really need is a copy of the Subversion client binary.
2. Run the command and make sure you are in the directory you want to copy the temp install files and be "root"

svn co svn://svnanon.samba.org/samba/trunk samba

This will create a directory called samba containing the latest Samba source code (usually the branch that is going to be the next major release). This currently corresponds to the 3.1 development tree.

After the source tarball has been unpacked, the next step involves configuration to match Samba to your operating system platform. If your source directory does not contain the configure script, it is necessary
to build it before you can continue. Building of the configure script requires the correct version of the autoconf tool kit. Where the necessary version of autoconf is present, the configure script can be
generated by executing the following:

3.Building the Binaries

root#  cd samba-3.0.20/source
root#  ./autogen.sh

To build the binaries, run the program ./configure in the source directory. This should automatically configure Samba for your operating system. If you have unusual needs, then you may wish to first run:

root# ./configure [... arguments ...]

Execute the following create the binaries:

root#  make

Once it is successfully compiled, you can execute the command shown here to install the binaries and manual pages:

root#  make install


4.Starting smbd as a Daemon
To start the server as a daemon, you should create a script something like this one, perhaps calling it startsmb.

#!/bin/sh
/usr/local/samba/sbin/smbd -D 
/usr/local/samba/sbin/winbindd -B
/usr/local/samba/sbin/nmbd -D 

Make it executable with chmod +x startsmb.
You can then run startsmb by hand or execute it from /etc/rc.local

You can look at the log files located in /usr/local/samba/sbin/var if Samba fails to start and make sure the smb.conf is in /usr/local/samba/lib directory

5. Configuration for Amanda

Once AMANDA and Samba are installed, the only difference between a Unix client/disk and PC client/share is in how the backup disks are specified in the file
disklist. For each PC share, the entry lists the 'samba server' host (where the patched Samba software is installed) and the disk field is the share name. The
remaining fields are like any other DLE.

A user must be created on the PC with full access rights (read/write) to the share. AMANDA, via the Samba server, will connect to the PC via this user. If the user
does not have full access, incremental backups will not work and the whole share will be backed up every time (the archive bits are never reset).

The file /etc/amandapass must be created by hand owned by the amanda user and have permissions of "700". It contains share name to user name, password and workgroup mapping. Each line consists of two or three fields, separated by whitespace:

  • Share name followed by optional directory. You have to use forward slashes (/), not backslashes (\). This must match the disklist entry exactly (case sensitive). This may be asterisk (*) to match all remaining shares for this Samba server. The first match in the file is used, so specific entries must be listed first. The directory is appended to the share name as full MS network path. Like //thepc/c$/mydir. No blanks are allowed in directory!
  • User name and password. Separated by a percent sign (%). See the description of the -U option in the manpage of smbclient. No whitespace is allowed in either the user name or password.
  • Workgroup (optional).

This file must be owned by the AMANDA-user, and disallow world access privileges. Blank lines are ignored. A "#" on a line at the start of a field (including start of line) causes the rest of the line to be ignored.

6. Example configuration

The AMANDA client software and Samba is installed on host "amanda_server_host". A share to be backed up called "share" is on PC "my-laptop". The share will be accessed via PC user "testing" and password "testing" and using a workgroup "workgroup".

The entry in the file disklist is:

amanda_server_host     //my-laptop/share   comp-user-tar

In /etc/amandapass on the machine 'amanda_server_host':

//my-laptop/share testing%testing workgroup

This will cause smbclient to be invoked with -W workgroup

7. Test the configuration by running amcheck on your configuration:

-bash-3.00$ amcheck DailySet1
Amanda Tape Server Host Check
-----------------------------
slot 15: read label `Tape-15', date `X'
NOTE: skipping tape-writable test
Tape Tape-15 label ok
Server check took 0.334 seconds
Amanda Backup Client Hosts Check
--------------------------------
Client check: 1 host checked in 0.311 seconds, 0 problems found
(brought to you by Amanda 2.5.0)

8. Start the backup with command amdump DailySet1:
logfile in the /etc/amanda/DailySet1:

-bash-3.00$ cat log.20060421112238.0
DISK planner amanda_server_host //my-laptop/share
START planner date 20060421112238
START driver date 20060421112238
INFO planner Adding new disk amanda_server_host://my-laptop/share.
STATS driver startup time 0.032
START taper datestamp 20060421112238 label Tape-15 tape 0
FINISH planner date 20060421112238 time 1.164
SUCCESS dumper amanda_server_host //my-laptop/share 20060421112238 0 [sec 7.356 kb 13772 kps 1872.1 orig-kb 17073]
SUCCESS taper amanda_server_host //my-laptop/share 20060421112238 0 [sec 11.515 kb 13824 kps 1200.5 {wr: writers 432 rdwait 11.219 wrwait 0.282 filemark 0.000}]
INFO taper tape Tape-15 kb 13824 fm 1 [OK]
FINISH driver date 20060421112238 time 14.219

How to restore a Samba client backup using amrecover:
1. You need to first mount the Samba share that you want to restore to on the backup server

mount -t smbfs -o  username=testing,password=testing //my-laptop/share /restore   -o workgroup=workgroup

2. Once its mounted cd in to that directory and start amrecover

[root@bugs restore]# amrecover DailySet1 -t amanda_server_host -s amanda_server_host
AMRECOVER Version 2.5.0. Contacting server on amanda_server_host ...
220 bugs AMANDA index server (2.5.0) ready.
200 Access OK
Setting restore date to today (2006-04-21)
200 Working date set to 2006-04-21.
200 Config set to DailySet1.
200 Dump host set to amanda_server_host.
Trying disk /restore ...
Trying disk //my-laptop/share ...
$CWD '/restore' is on disk '//my-laptop/share' mounted at '/restore'.
200 Disk set to //my-laptop/share.
/restore
amrecover> listdisk
200- List of disk for host amanda_server_host
201- //my-laptop/share
200 List of disk for host amanda_server_host
amrecover> setdisk //my-laptop/share
200 Disk set to //my-laptop/share.
amrecover> ls
2006-04-21 x-cart-4.0.18gold.tgz
2006-04-21 Sugar_Professional_User_Admin_Guide_v40.pdf
2006-04-21 Sugar_Professional_Release_Notes_v400.pdf
2006-04-21 SugarPro-4.0.0.zip
2006-04-21 SugarCRM10606.pdf
2006-04-21 Folder-createdby-testing/
amrecover> add *
Added /x-cart-4.0.18gold.tgz
Added /Sugar_Professional_User_Admin_Guide_v40.pdf
Added /Sugar_Professional_Release_Notes_v400.pdf
Added /SugarPro-4.0.0.zip
Added /SugarCRM10606.pdf
Added dir /Folder-createdby-testing at date 2006-04-21
amrecover> extract
amrecover: warning: using /dev/null as the tape device will not work
Extracting files using tape drive /dev/null on host amanda_server_host.
The following tapes are needed: Tape-15
Restoring files into directory /restore
Continue [?/Y/n]? y
Extracting files using tape drive /dev/null on host amanda_server_host.
Load tape Tape-15 now
Continue [?/Y/n/s/t]? y
./Folder-createdby-testing/
./SugarCRM10606.pdf
./SugarPro-4.0.0.zip
./Sugar_Professional_Release_Notes_v400.pdf
./Sugar_Professional_User_Admin_Guide_v40.pdf
./x-cart-4.0.18gold.tgz
amrecover> quit
200 Good bye.
Powered by MindTouch Deki v.8.08.2