Recovered from the older tannerjc.net wiki snapshot dated January 23, 2016.

General Info

  • Fastest and most useful rsync options for just copying data from one drive to another
rsync -rlvh --progress source destination

where the flags mean:

  -r, --recursive             recurse into directories
  -l, --links                 copy symlinks as symlinks
  -v, --verbose               increase verbosity
  -h, --human-readable        output numbers in a human-readable format

Backup Windows 7 share

Share Windows folder

  • Right click on folder to be shared
  • Share with
  • Homegroup (read)

Win7 share

Identify available shares

[root@digweed ~]# smbclient -L //ac-asus/ --user anonymous
Enter anonymous's password:
Domain=[AC-ASUS] OS=[Windows 7 Ultimate 7601 Service Pack 1] Server=[Windows 7 Ultimate 6.1]

	Sharename       Type      Comment
	---------       ----      -------
	ADMIN$          Disk      Remote Admin
	Audio           Disk
	C$              Disk      Default share
	D$              Disk      Default share
	Dbackup         Disk
	HP Officejet 6500 E709n Series Printer   HP Officejet 6500 E709n Series
	HP Photosmart C3100 series Printer   HP Photosmart C3100 series
	IPC$            IPC       Remote IPC
	print$          Disk      Printer Drivers
Domain=[AC-ASUS] OS=[Windows 7 Ultimate 7601 Service Pack 1] Server=[Windows 7 Ultimate 6.1]

	Server               Comment
	---------            -------

	Workgroup            Master
	---------            -------

Browse relevant share

[root@digweed ~]# smbclient  //ac-asus/Dbackup --user nonono --password nonono
Domain=[AC-ASUS] OS=[Windows 7 Ultimate 7601 Service Pack 1] Server=[Windows 7 Ultimate 6.1]
smb: \ ls
  $RECYCLE.BIN                      DHS        0  Sat Feb 27 01:26:38 2010
  Audio                               D        0  Sun Apr  4 13:43:50 2010
  edu_video_local                     D        0  Fri May 13 01:09:30 2011
  Photos                              D        0  Wed Apr 20 16:08:36 2011
  Software                            D        0  Mon Dec 27 00:06:05 2010
  System Volume Information         DHS        0  Wed Sep  8 22:32:54 2010
  Video                               D        0  Mon Dec 27 00:34:03 2010

		35655 blocks of size 4194304. 9982 blocks available
smb: \

Mount the windows share

[root@digweed ~]# mount.cifs //192.168.2.12/Dbackup -o user=nonono,password=nonono /mnt/ac-asus/
[root@digweed ~]# mount | grep cifs
//192.168.2.12/Dbackup on /mnt/ac-asus type cifs (rw)
[root@digweed ~]# df /mnt/ac-asus/ -h
Filesystem            Size  Used Avail Use% Mounted on
//192.168.2.12/Dbackup
                      140G  101G   39G  73% /mnt/ac-asus

rsync the share to backup dir

[john@digweed ~]$ screen -A -S backup rsync -av --delete /mnt/ac-asus/Audio/ /efserv/Backups/awcrosby/Audio/

script to automate process

#$/bin/bash
if ping -c 3 192.168.2.12
   then
        if /sbin/mount.cifs //192.168.2.12/Dbackup -o user=digweed,password=blahblah /mnt/ac-asus
          then
               echo rsync started at `date +%F_%H%M%S`
               /usr/bin/rsync --recursive --no-compress --delete --verbose /mnt/ac-asus/ /efserv/Backups/awcrosby/Dbackup/
               echo rsync completed at `date +%F_%H%M%S`
               /bin/umount /mnt/ac-asus
         else
               echo failed to mount share
         fi
   else
        echo can't ping 192.168.2.12, vandyk.dj.edm is not connectable
fi

Troubleshooting

script didn’t run because relative paths for commands were in use.. see mail from cron daemon:

/root/ac-asus-backup-2.sh: line 4: mount.cifs: command not found
failed to mount share

Backup Audio from home to work

Script

[root@jb ~]# ls -l AudioBackup.sh
-rwxr-xr-x. 1 root root 423 Aug 21 15:42 AudioBackup.sh
#$/bin/bash
if /bin/ping -c 3 edm.homelinux.net
   then
               echo rsync started at `date +%F_%H%M%S`
               /usr/bin/rsync --recursive --no-compress --delete --bwlimit=300 --progress --size-only --max-delete=250 -p -o -g -t john@edm.homelinux.net:/efserv/Audio/ /jbod/Audio/
               echo rsync completed at `date +%F_%H%M%S`
   else
        echo can't ping edm.homelinux.net, trainwreck is not connectable
fi

Note: I had to add –size-only above or it would check every file before doing any transfers.. or so it seemed. Much faster now.

cronjob

‘crontab -e’ edited to start script at 3:20 am every monday, tuesday, wednesday, thursday, friday morning

20 03 * * 1,2,3,4,5 /root/AudioBackup.sh