Scheduled Maintenance: We are aware of an issue with Google, AOL, and Yahoo services as email providers which are blocking new registrations. We are trying to fix the issue and we have several internal and external support tickets in process to resolve the issue. Please see: viewtopic.php?t=158230

 

 

 

[Solved] rsync --link-dest (hard link backup files)?

If none of the specific sub-forums seem right for your thread, ask here.
Post Reply
Message
Author
User avatar
bester69
Posts: 2072
Joined: 2015-04-02 13:15
Has thanked: 24 times
Been thanked: 14 times

[Solved] rsync --link-dest (hard link backup files)?

#1 Post by bester69 »

Hi,

I found out some importat/big files deleted accidentally, and its not first time it happens to me,

I would like to do a mirror target backup , mirroring all files as hard links so I can prevent accidental file deletions (hardlinks backup) within some specific folders ..That way, when I find out some missing deleted files, I can go to "backup mirrored hardlinks folder" and restore the structure/files deleted.

How can I do it??, Can rsync do that?

Thanks.
Last edited by bester69 on 2018-06-21 10:48, edited 2 times in total.
bester69 wrote:STOP 2030 globalists demons, keep the fight for humanity freedom against NWO...

User avatar
bester69
Posts: 2072
Joined: 2015-04-02 13:15
Has thanked: 24 times
Been thanked: 14 times

Re: rsync mirroring as hard links files?

#2 Post by bester69 »

Ive searched in internet and gave into
rsync --link-dest

I dont understand how this works, Im doing something like this.:
rsync -av --delete --link-dest=../linkedbackup/ source/ target/

I want a mirrored source backup in "--link-dest=../linkedbackup/" folder, where all files but directories should be hardlinks.. :? :?
bester69 wrote:STOP 2030 globalists demons, keep the fight for humanity freedom against NWO...

User avatar
bester69
Posts: 2072
Joined: 2015-04-02 13:15
Has thanked: 24 times
Been thanked: 14 times

Re: rsync --link-dest (hard link backup files)?

#3 Post by bester69 »

I think I will use "cp -l" + find.:

Code: Select all

find -maxdepth 1 -type d  -iname "*" -exec cp -larv "{}" hardlinkbacks/ \;
I made a tested backup script with 3 date rotation retentions.:
hardback.sh

Code: Select all

################################
HLBACK=/media/sda1/.DDD
HLSOURCE=/media/sda1
HLNAME=`date +%Y%m%d_%H:%M:%S`
################################
touch $HLBACK/.1.dt $HLBACK/.2.dt
HL1=$(cat  $HLBACK/.1.dt)
HL2=$(cat  $HLBACK/.2.dt)

sleep 2
rm -rf $HLBACK/1-*
mv $HLBACK/2-$HL1 $HLBACK/1-$HL1
rm -rf $HLBACK/2-*
mv $HLBACK/3-$HL2 $HLBACK/2-$HL2
rm -rf $HLBACK/3-*
mkdir  $HLBACK/3-$HLNAME
###########
clear
echo "Directorios:"
find $HLSOURCE -maxdepth 1 -type d  -iname "*"  -not -path "$HLBACK" -not -path "$HLSOURCE" 
echo "Archivos:"
find $HLSOURCE -maxdepth 1 -type f -iname "*"  -not -path "$HLBACK" -not -path "$HLSOURCE"
 #-not -path '*/\.*' 
sleep 5
find $HLSOURCE -maxdepth 1 -type d  -iname "*"  -not -path "$HLBACK" -not -path "$HLSOURCE" -exec cp -larv "{}" $HLBACK/3-$HLNAME  \;
find $HLSOURCE -maxdepth 1 -type f -iname "*"  -not -path "$HLBACK" -not -path "$HLSOURCE" -exec cp -larv "{}" $HLBACK/3-$HLNAME  \;

###########
cat  $HLBACK/.2.dt >  $HLBACK/.1.dt
echo "$HLNAME" > $HLBACK/.2.dt
bester69 wrote:STOP 2030 globalists demons, keep the fight for humanity freedom against NWO...

User avatar
bester69
Posts: 2072
Joined: 2015-04-02 13:15
Has thanked: 24 times
Been thanked: 14 times

Re: rsync mirroring as hard links files?

#4 Post by bester69 »

bester69 wrote:Ive searched in internet and gave into
rsync --link-dest

I dont understand how this works, Im doing something like this.:
rsync -av --delete --link-dest=../linkedbackup/ source/ target/

I want a mirrored source backup in "--link-dest=../linkedbackup/" folder, where all files but directories should be hardlinks.. :? :?
Ok, Here a good explanation
https://blog.interlinked.org/tutorials/ ... chine.html

So in resume:
Step 0: rsync -aP $HOME/YourSource $HOME/Backups/current
>> Create a copy in folder "current"
Step 1: rsync -aP --link-dest=$HOME/Backups/current /$HOME/YourSource $HOME/Backups/back-2
>> Create a newCopy in folder "back-2" with hard linking destinity folder "current".
bester69 wrote:STOP 2030 globalists demons, keep the fight for humanity freedom against NWO...

Post Reply