Hi guys!
I’m a newby in the list.
It’s a lot of time I’m tryng to make an incremental backup of some folders of my linux machine on a nfs partition created on wdSharespace, unsuccesfully. I’ve mounted the nfs partition
I’ve tried using rsync and tar. I’ve tried with different tools:
-
custom scripts for weekly incremental backup using rsync (I attach the scripts): they make a first full backupc, and then the next day the incremental backup results void and so the third incremental backup is a full backup again.
-
using backuppc, anc mounting the nfs partition on /var/lib/backuppc with the correct owner and group (backuppc). Launching “/usr/share/backuppc/bin/BackupPC_serverMesg backup all” or accessing to the web administration page it returns the error: “Can’t connect to server. (unix connect: Connection Refused)”
-
using backkup-manager with the options: BM_REPOSITORY_USER and BM_REPOSITORY_GROUP and with the owner and group of the mounted partition set to “root” I get the error “chown: changing ownership of `/mnt/nfsWDShareSpace/BackUpManager’: Operation not permitted”.
Can you give me any suggestion. Ask me if you need more informations.
_________________________________________
Custom script for backup
/etc/crontab: system-wide crontab
…
1 01 * * * root /home/user/bin/scriptBackup/a-daily-big-snapshot.x
…
_________________________________________________________
#!/bin/sh
/home/user/bin/a-daily-big-snapshot.x
BACKUP_INTERVAL=“Daily”
BACKUP_ROTATIONS=7
RSSCRIPTPATH=“/home/user/bin/rs-backup.x”
SOURCES=‘/var /etc /home /root /usr/local /boot’
BACKUPMOUNT=‘/mnt/nfsWDShareSpace’
TARGET=$BACKUPMOUNT"/Backup/daily"
INCLUDE=‘’
EXCLUDE=‘’
less /etc/mtab|grep $BACKUPMOUNT
if [$? -ne 0]
then
mount $BACKUPMOUNT
fi
echo "BACKUP DI SISTEMA "$BACKUP_INTERVAL
mcommand=“$RSSCRIPTPATH "$SOURCES" $TARGET $BACKUP_ROTATIONS $INCLUDE $EXCLUDE”
echo $mcommand
eval $mcommand
less /etc/mtab|grep $BACKUPMOUNT
if [$? -eq 0]
then
umount $BACKUPMOUNT
fi
_____________________________________________________________
#!/bin/sh
rs-backup.x – backup to a local drive using rsync.
# Uses hard-link rotation to keep multiple backups.
Comment out the following line to disable verbose output
VERBOSE=“-v”
SOURCES=$1
TARGET=$2
ROTATIONS=$3
INCLUDE_FILE=$4
EXCLUDE_FILE=$5
#######################################
########DO_NOT_EDIT_BELOW_THIS_POINT#########
#######################################
BACKUP_DATE=“date +%F_%H-%M
”
if [! -x “$TARGET”]; then
echo “Backup target does not exist or you don’t have permission!”
echo “Exiting…”
exit 2
fi
if [! $ROTATIONS -gt 1]; then
echo “You must set ROTATIONS to a number greater than 1!”
echo “Exiting…”
exit 2
fi
BEGIN ROTATION SECTION
BACKUP_NUMBER=1
incrementor used to determine current number of backups
list all backups in reverse (newest first) order, set name of oldest backup to $backup
if the retention number has been reached.
for backup in ls -dXr $TARGET/*/
; do
if [$BACKUP_NUMBER -eq 1]; then
NEWEST_BACKUP=“$backup”
fi
if [$BACKUP_NUMBER -eq $ROTATIONS]; then
OLDEST_BACKUP=“$backup”
break
fi
BACKUP_NUMBER=$((BACKUP_NUMBER+1))
done
Check if $OLDEST_BACKUP has been found. If so, rotate. If not, create new directory for this backup.
if [“$OLDEST_BACKUP”]; then
# Set oldest backup to current one
mv “$OLDEST_BACKUP” “$TARGET”“/”“$BACKUP_DATE”
else
mkdir “$TARGET”“/”“$BACKUP_DATE”
fi
Update current backup using hard links from the most recent backup
if [“$NEWEST_BACKUP”]; then
cp -al “$NEWEST_BACKUP”“.” “$TARGET”“/”“$BACKUP_DATE”
fi
END ROTATION SECTION
Check to see if rotation section created backup destination directory
if [! -d “$TARGET”“/”“$BACKUP_DATE”]; then
echo “Backup destination not available. Make sure you have write permission in TARGET!”
echo “Exiting…”
exit 2
fi
echo “Verifying Sources…”
for source in $SOURCES; do
echo “Checking “”$source”“…”
if [! -x “$source”]; then
echo “Error with “”$source”“!”
echo “Directory either does not exist, or you do not have proper permissions.”
exit 2
fi
done
if [-f $EXCLUDE_FILE]; then
EXCLUDE=“–exclude-from=$EXCLUDE_FILE”
echo “EXCLUDE FILE ESISTENTE=”“$EXCLUDE_FILE”
fi
if [-f $INCLUDE_FILE]; then
INCLUDE=“–include-from=$INCLUDE_FILE”
echo “INCLUDE FILE ESISTENTE=”“$INCLUDE_FILE”
fi
echo “Sources verified. Running rsync…”
for source in $SOURCES; do
# Create directories in $TARGET to mimick source directory hiearchy
if [! -d “$TARGET”“/”“$BACKUP_DATE”“/”“$source”]; then
mkdir -p “$TARGET”“/”“$BACKUP_DATE”“/”“$source”
fi
rsync $VERBOSE --exclude=“$TARGET/” “$EXCLUDE” “$INCLUDE” -rptz --delete --delete-excluded “$source”“/” “$TARGET”“/”“$BACKUP_DATE”“/”“$source”“/” # VIENE CREATO IL BACKUP CON RSYNC
#Delete empty directories
find “$TARGET”“/”“$BACKUP_DATE”“/”“$source” -type d | tac | while read; do rmdir “$REPLY”; done
done
exit 0