DSM-G600, DNS-3xx and NSA-220 Hack Forum

Unfortunately no one can be told what fun_plug is - you have to see it for yourself.

You are not logged in.

Announcement

#1 2010-10-20 01:47:41

mtlmaks
Member
Registered: 2010-10-19
Posts: 7

DNS-323 rsync backup problems

Hi there!

I recently got a DNS-323 with the latest firmware, and with the help of the wiki howto backup page (http://dns323.kood.org/howto:backup) I'm trying to set up a snapshop backup from drive B to drive A. Drive B is my 500GB data drive and drive A is my 1TB backup drive, both configured as independant ext3 drives. I initially installed fun_plug 0.4 along with rsync and followed the steps in the tutorial. The initial editcron.sh scheduled incremental backup from Step 3 worked fine. Then I went on and created the snapshot.sh backup script and edited editcron.sh accordingly. The problem here was, that the backup created the differently timed folders fine, but each of them contained a full backup, and no current timestamp was created, therefore no real snapshots.
Then I deleted fun_plug 0.4 and installed 0.5. I edited the scripts accordingly via Telnet, made sure that the permissions were set fine, but neither the basic incremental backup, nor the snapshot backup works now... With 0.4 I could see the scheduled backup with "crontab -l", but with 0.5 there's no schedule listed. I checked and double checked my scripts, the permissions, also tried adding the " export PATH=/ffp/sbin:/ffp/bin:$PATH " line, but still nothing happens. I'm doing all this with a test folder to backup, that only has a couple of MBs.
Here are the two scripts in their current incarnation:


===================== cronedit.sh start========================
#!/bin/sh

CRONTXT=/mnt/HD_a2/crontab.txt

/bin/crontab -1 > $CRONTXT

/bin/echo "01 23 * * * /ffp/bin/rsync -rlptDv --delete /mnt/HD_b2/Test /mnt/HD_a2/Backup_NAS_test >/ffp/log/rsync.log 2>&1" >> CRONTXT

/bin/crontab $CRONTXT

/bin/rm $CRONTXT
===================== cronedit.sh end========================




===================== snapshot.sh end========================
#!/bin/sh

srcpath=/mnt/HD_b2/Test

dstpath=/mnt/HD_a2/Backup_NAS_test

ffppath=/ffp

date=`date "+%Y%m%d_%H%M%S"`
mkdir $dstpath/$date

$ffppath/bin/rsync -avx --link-dest=$dstpath/current $srcpath $dstpath/$date > $ffppath/log/snapshot.log 2>&1

var=`ls -1A $dstpath/$date | wc -l`

if [ $var -ne 0 ]
then
  rm $dstpath/current
  ln -s $date $dstpath/current
fi
===================== snapshot.sh end========================


Any help would be greatly appreciated!
Thanks,
Marek

Offline

 

#2 2010-10-20 01:51:06

mtlmaks
Member
Registered: 2010-10-19
Posts: 7

Re: DNS-323 rsync backup problems

Also, here's the fun_plug log from the last time the system started:

==========================================================
**** fun_plug script for DNS-323 (2008-08-11 tp@fonz.de) ****
Tue Oct 19 07:41:35 DST 2010
ln -snf /mnt/HD_a2/ffp /ffp
* Running /ffp/etc/fun_plug.init ...
* Running /ffp/etc/rc ...
* /ffp/start/syslogd.sh inactive
* /ffp/start/SERVERS.sh inactive
* /ffp/start/portmap.sh inactive
* /ffp/start/unfsd.sh inactive
* /ffp/start/nfsd.sh inactive
* /ffp/start/ntpd.sh inactive
* /ffp/start/LOGIN.sh inactive
* /ffp/start/telnetd.sh ...
Starting /ffp/sbin/telnetd -l /ffp/bin/sh
* /ffp/start/sshd.sh inactive
* /ffp/start/rsyncd.sh inactive
* /ffp/start/mediatomb.sh inactive
* /ffp/start/kickwebs.sh inactive
* /ffp/start/lighttpd.sh inactive
* /ffp/start/inetd.sh inactive
* /ffp/start/editcron.sh ...
BusyBox v1.00-pre1 (2009.05.07-06:36+0000) multi-call binary

Usage: crontab crontab [-c dir] {file|-}|[-u|-l|-e|-d user]

*  OK
==========================================================

Offline

 

#3 2010-10-20 04:16:24

FunFiler
Member
Registered: 2010-05-23
Posts: 577

Re: DNS-323 rsync backup problems

As mentioned in many threads, it is very likely that you just need to put in a short delay on startup before adding/editing the crontab list. Just add "/ffp/bin/sleep 5s" to you script before making changes to the list.


3 * (DNS-323 with 2 * 2TB) = 12TB Running FW v1.08 & FFP v0.5
Useful Links: Transmission, Transmission Remote, Automatic

Offline

 

#4 2010-10-20 04:32:01

bound4h
Member
Registered: 2010-04-12
Posts: 209

Re: DNS-323 rsync backup problems

Is the editcron.sh excecutable? chmod +x /ffp/start/editcron.sh

I have the same exact scripts.  Here are both of them and they work fine for me:

#!/bin/sh
##############################################################################
# ----[ editcron.sh ]----
# script to keep cronjobs persistent (e.g. after reboot)
# NOTE:  put this in /mnt/HD_a2/ffp/start/ and make it executable.
# w 22/10/08 horto
# ref/credit: http://tinyurl.com/5m2349 - thanks chumby!
#############################################################################
FFP=/mnt/HD_a2/ffp
CRONTXT=$FFP/etc/crontab.txt
DATE=`date +"%m-%d-%Y_%H:%M:%S"`

# start with existing crontab
# note:  on a fresh reboot, this will always have been reset to standard
/bin/crontab -l > $CRONTXT

# add cronjobs here preceeded by /bin/echo. 
# don't forget to enclose them in double quotes.
/bin/echo "30 * * * * /ffp/var/scripts/torrentwatchdog.sh >> /mnt/HD_a2/logs/torrentwd.log 2>&1" >> $CRONTXT
/bin/echo "30 3 * * * /ffp/var/scripts/unpacker.sh >> /mnt/HD_a2/logs/unpack.log 2>&1" >> $CRONTXT
/bin/echo "0 2 * * 1 /ffp/var/scripts/snapshot.sh >> /mnt/HD_a2/logs/snapshot.log 2>&1" >> $CRONTXT


# install the new crontab
/bin/crontab $CRONTXT

# clean up
/bin/rm $CRONTXT

and

srcpath='/mnt/HD_a2/Media /mnt/HD_a2/External_Backup'
export PATH=/ffp/sbin:/ffp/bin:$PATH
dstpath=/mnt/HD_b2/Backup

ffppath=/ffp

date=`date +"%m-%d-%Y_%H:%M:%S"`
mkdir $dstpath/$date

$ffppath/bin/rsync -avx --link-dest=$dstpath/current $srcpath $dstpath/$date > /mnt/HD_a2/logs/snapshot.log 2>&1

var=`ls -lA $dstpath/$date | wc -l`

if [ $var -ne 0 ]
then
        rm $dstpath/current
        ln -s $date $dstpath/current
fi

Offline

 

#5 2010-10-20 05:08:52

mtlmaks
Member
Registered: 2010-10-19
Posts: 7

Re: DNS-323 rsync backup problems

Hi!

Thanks for your reply smile
I actually sorted it out: somehow the editcron.sh wasn't in /ffp/start, although I am sure I created it... Anyway, I just recreated it, and now things seem to work fine after some test backups. The "current" link/folder is now created, which wasn't the case under fun_plug 0.4. On thing that's a bit confusing though is, that when i check the different folder sizes under windows, they all show the full backup size (around 102MB) each. Is this normal? How can I see the correct folder sizes in the telnet terminal? When I use ls -l, it shows the attached results, but I can't see anything that ressembles the real backup size (sorry, I am new to Linux)... Thanks.


Attachments:
Attachment Icon putty.JPG, Size: 34,011 bytes, Downloads: 92

Offline

 

#6 2010-10-20 06:06:09

bound4h
Member
Registered: 2010-04-12
Posts: 209

Re: DNS-323 rsync backup problems

Each snapshot (date folder) will show the full backup size because rsync is using hard-links (as opposed to soft-links).  Assume your source A is /mnt/HD_a2/test and your destination B is /mnt/HD_b2/backup_of_test then just compare these two outputs:

$: du -hs /mnt/HD_a2/test

and

$: du -hs /mnt/HD_b2/backup_of_test (use the root of all the date folders, not /mnt/HD_b2/backup_of_test/20101019_115342, etc)

They should be VERY close.  The destination will be a bit larger over time because the hard-links take up space, but we're only talking MBs, nothing noticeable.  I have 2 500GB HDDs and 1 mirrors the other with no problems.

Last edited by bound4h (2010-10-20 06:09:11)

Offline

 

#7 2010-10-24 06:33:23

mtlmaks
Member
Registered: 2010-10-19
Posts: 7

Re: DNS-323 rsync backup problems

Hi,

sorry for the late reply. Everytings works smoothly now, thanks for your help! smile
I have another problem now though, while trying to set up a similar rsync driven backup from my PC to the NAS, as can be seen here: http://dns323.kood.org/forum/viewtopic.php?id=6045
Any idea maybe...? wink

Last edited by mtlmaks (2010-10-24 06:40:00)

Offline

 

Board footer

Powered by PunBB
© Copyright 2002–2010 PunBB