This is my first attempt at a shell script. I'm simply trying to make incremental copies of certain folders from a server to another server using Rsync, but using the link-dest option to create hardlinks to unmodified files. When I check the folder structure file sizes as they exist in the folder 'Editshare_Backups' I see that they appear to be just as large as each other. I am using
du -sh * inside the 'Editshare_Backups' folder as I was under the impression that
du doesn't count a second hard link when calculating size.
stat -f %l on a specific file inside the first full backup and it shows only 1 hard link.
What other options are there for checking whether hard links have been made?
Code from my shell script is:
#!/opt/bin/bash #Rsync Editshare Database Backups Script #Todays date TODAY=`date -I` #Yesterdays date PREVIOUS_DAY=`date -I` #The source directory: SRC1="/RAIDS/RAID_2" SRC2="/etc" SRC3="/var/lib" #The target directory: TRG="/volume1/Editshare_Backups/$TODAY" #The link destination directory: LNK="/volume1/Editshare_Backups/$PREVIOUS_DAY" #The rsync options: OPT="-avh -e ssh --delete --progress --link-dest=$LNK" #Log file: LOG="/volume1/Editshare_Backups/Logs/Log_$TODAY.log" #Execute the backup rsync $OPT firstname.lastname@example.org:$SRC1 :$SRC2 :$SRC3 $TRG >> $LOG 2>&1