0% found this document useful (0 votes)
42 views2 pages

Rsync Link-Dest - Unsure If Its Creating Hard Links: Favorite

The user is trying to use rsync with the link-dest option to create hard links between incremental backups of folders on a server. When checking folder sizes after running the backup script, the sizes appear the same rather than one being much smaller, as would be expected if hard links were created. Stat shows only one hard link for a test file. The user asks for suggestions on how to check if hard links were successfully made.

Uploaded by

mateigeorgescu80
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
42 views2 pages

Rsync Link-Dest - Unsure If Its Creating Hard Links: Favorite

The user is trying to use rsync with the link-dest option to create hard links between incremental backups of folders on a server. When checking folder sizes after running the backup script, the sizes appear the same rather than one being much smaller, as would be expected if hard links were created. Stat shows only one hard link for a test file. The user asks for suggestions on how to check if hard links were successfully made.

Uploaded by

mateigeorgescu80
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 2

Rsync link-dest - unsure if its creating hard

links
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.
I used 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`

up vote 1
#Yesterdays date
down
PREVIOUS_DAY=`date -I`
vote
favorite #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 [email protected]:$SRC1 :$SRC2 :$SRC3 $TRG >> $LOG 2>&1

rsync hard-link
shareimprove this question edited Jul 19 at 2:02 asked Jul 19 at 1:38

KM. C. Ricker
1,0711019 62
Your link-dest PREVIOUS_DAY is the same as TODAY, so no links can be made.
meuh Jul 19 at 9:15
aha! thankyou! Still finding after making this change though that du -sh * shows
the folders as being both large, i.e the second one hasnt copied only incremental
changes and hard linked to the first. The LOG though shows only 9GB was
transferred which makes me believe it did hard link? C. Ricker Jul 21 at 3:31
Looks like it should work, assuming the filesystem type allows hard links. I would
try copying the script and paring it down to backup a single small directory,
setting literally TODAY=today and PREVIOUS_DAY=yesterday. Run the script, then
mv today yesterday, and run again. On a separate point I can recommend
adding -R so that your backup tree represents exactly the source tree, eg rsync
-aR /a/b/c /x will create /x/a/b/c. This also avoids differences when the
source dir does or does not end in /. meuh Jul 21 at 7:16

You might also like