Jump to content

Automatic backup from unRAID to unRAID


EdgarWallace

Recommended Posts

I'm having 2 unRAID server to backup my data and used a lot of advise from Weebotech and others. Here is what I did:

 

Receiving server

Create /boot/custom/rsyncd.conf:

uid             = root                                                                                                              
gid             = root                                                                                                              
use chroot      = no                                                                                                                
max connections = 4                                                                                                                 
pid file        = /var/run/rsyncd.pid                                                                                               
timeout         = 600                                                                                                               
                                                                                                                                    
[mnt]                                                                                                                               
    path = /mnt                                                                                                                     
    comment = /mnt files                                                                                                            
    read only = FALSE

 

Place the following lines of code into your go file:

1.) the rsync command will be added to /etc/inetd

2.) rsyncd.conf will be copied into /etc on every boot:

if ! grep ^rsync /etc/inetd.conf > /dev/null ; then 
cat <<-EOF >> /etc/inetd.conf
rsync   stream  tcp     nowait  root    /usr/sbin/tcpd  /usr/bin/rsync --daemon 
EOF
killall -HUP inetd
fi

cp /boot/custom/rsyncd.conf /etc

 

Check your installation...ps -ef | grep inetd should show:

root      1295     1  0 09:51 ?        00:00:00 /usr/sbin/inetd
root      3365  2348  0 15:22 pts/0    00:00:00 grep inetd

 

Sending side:

#!/bin/bash                                                                                                                                      
#=======================================================================================                                                         
#  Name:        rsync_backup.sh                                                                                                                  
#=======================================================================================                                                         
#  Description:                                                                                                                                  
#                                                                                                                                                
#  A simple script to copy directory and files from tower ---> tower2 as remote backup                                                           
#                                                                                                                                                
#  How to invoke in your "go" script (copy to /boot/scripts):                                                                                    
#  chmod +x /boot/scripts/rsync_backup.sh                                                                                                        
#=======================================================================================                                                         
#                                                                                                                                                
#                                                                                                                                                
# Waking up unRAID2 Test & Backup Server                                                                                                         
etherwake e0:cb:4e:c1:a6:3d                                                                                                                      
echo "waking up unRAID2..."                                                                                                                      
#                                                                                                                                                
# Shutdown Docker & VMs                                                                                                                          
/etc/rc.d/rc.docker stop                                                                                                                         
#                                                                                                                                                              
rsync -avH --stats --progress --delete-after --ignore-existing /mnt/user/Daten/       rsync://tower2/mnt/user/backup/Daten/          
rsync -avH --stats --progress --delete-after --ignore-existing /mnt/user/Fotos/      rsync://tower2/mnt/user/backup/Fotos/                   
rsync -avH --stats --progress --delete-after --ignore-existing /mnt/user/HDX/       rsync://tower2/mnt/user/backup/HDX/                           
rsync -avH --stats --progress --delete-after --ignore-existing /mnt/user/appdata/      rsync://tower2/mnt/user/backup/appdata/                 
rsync -avH --stats --progress --delete-after --ignore-existing /mnt/user/iTunes/       rsync://tower2/mnt/user/backup/iTunes/                  
rsync -avH --stats --progress --delete-after --ignore-existing /mnt/cache/.Docker/       rsync://tower2/mnt/user/backup/Docker/                  
rsync -avH --stats --progress --delete-after --ignore-existing /mnt/cache/.VMs/       rsync://tower2/mnt/user/backup/VMs/                     
#                                                                                                                                                
# Restart Docker & VMs                                                                                                                           
/etc/rc.d/rc.docker start                                                                                                                        
echo "DONE"                                                                                                                                      
exit 0                                                                                                                                           
;;  

 

I have some issues though, so here are my questions:

 

1.) how to gracefully shutdown the VM's and start them after the backup? This is working for Docker but I haven't figured out how to implement this for all my VM's

2.) Etherwake is not waking up the server (it is waking up with WakeOnLan, a Mac OS X tool)

3.) Even id both servers are on, the automatic backup isn't running (rsyncd.conf is present in /etc)

 

Where to start investigating?

Link to comment

Here you are:

#!/bin/bash
# Start the Management Utility
/usr/local/sbin/emhttp &

cp /boot/scripts/rsync_backup.sh /etc/cron.daily
installpkg /boot/packages/etherwake-1.09-x86_64-4cf.txz

# Sensors: chip drivers
modprobe coretemp
modprobe nct6775
/usr/bin/sensors -s

 

Check if rsync.backup.sh has been copied:

root@Tower:/etc/cron.daily# v
total 16
-rwxr-xr-x 1 root root 4100 Oct 15 18:54 certwatch*
-rwxr-xr-x 1 root root  129 Oct 10  2013 logrotate*
-rwxrwxrwx 1 root root 2042 Dec  9 09:27 rsync_backup.sh*

 

crontab -l

# Run daily cron jobs at 4:40 every day:
40 4 * * * /usr/bin/run-parts /etc/cron.daily 1> /dev/null

Link to comment

Here is an interesting thread that I have just discovered: http://lime-technology.com/forum/index.php?topic=33099.0

 

  1. [*]Shutting down/starting the VM's (similar to Docker that is already working)

 

"virish help" doesn't show anything similar to "xl pause myVM" and "xl resume myVM"

 

Does this mean that "virsh shutdown myVM" and "virsh shutdown myVM" are the correct options?

 

#!/bin/bash                                                                                                                                      
#=======================================================================================                                                         
#  Name:        rsync_backup.sh                                                                                                                  
#=======================================================================================                                                         
#  Description:                                                                                                                                                                                                                                                                            
#  A simple script to copy directory and files from tower ---> tower2 as remote backup                                                           
#                                                                                                                                                
#  How to invoke in your "go" script (copy to /boot/scripts):                                                                                    
#  chmod +x /boot/scripts/rsync_backup.sh                                                                                                        
#=======================================================================================                                                         
#                                                                                                                                                
# Waking up unRAID2 Test & Backup Server                                                                                                         
etherwake e0:cb:4e:c1:a6:3d                                                                                                                      
echo "waking up unRAID2..."                                                                                                                      
#                                                                                                                                                
# Shutdown Docker & VMs
virsh shutdown archVM
virsh shutdown win7
/etc/rc.d/rc.docker stop                                                                                                                         
#                                                                                                                                                              
rsync -avH --stats --progress --delete-after --ignore-existing /mnt/user/Data/       rsync://tower2/mnt/user/backup/Data/
rsync -avH --stats --progress --delete-after --ignore-existing /mnt/user/appdata/      rsync://tower2/mnt/user/backup/appdata/                 
rsync -avH --stats --progress --delete-after --ignore-existing /mnt/user/iTunes/       rsync://tower2/mnt/user/backup/iTunes/                  
rsync -avH --stats --progress --delete-after --ignore-existing /mnt/cache/.Docker/       rsync://tower2/mnt/user/backup/Docker/                  
rsync -avH --stats --progress --delete-after --ignore-existing /mnt/cache/.VMs/       rsync://tower2/mnt/user/backup/VMs/                     
#                                                                                                                                                
# Restart Docker & VMs
virsh start archVM
virsh start win7                                                                                                                          
/etc/rc.d/rc.docker start                                                                                                                        
echo "DONE"                                                                                                                                      
exit 0                                                                                                                                           
;; 

Link to comment

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...