Hardlinks as Undelete Solution

If it doesn't relate to Debian, but you still want to share it, please do it here

Hardlinks as Undelete Solution

Postby bester69 » 2018-06-21 22:21

Hi,

Ive got the idea of using a FIFO hardlinks backups in a target root hidden folder for each ntfs partition, with a scheduled retention of some weeks/days, so we can undelete missed/lost accidentally files/folders that usually happends from time to time. As we're only backing up hardlinks, most of time we wont spare space disk, and at the same time, we will be able to recover typical important files ocassionally we delete accidentally. Last day I deleted by accidentally a 2Gb wine botle and couldnt recover it cos I cant backup all files and partitions; Now, with theses hardlinks copies I will be able to workaround this matter, if it happens again. :o

Here, a tested script (with 6 retentions) Im using in crontab.weekly for each NTFS partition:

bak_sda1.sh
Code: Select all
#########COPIA SDA1 BACKUP HARDLINKS#######################
################################
HLBACK=/media/sda1/.SDA1
HLSOURCE=/media/sda1
HLNAME=`date +%Y%m%d_%H:%M:%S`
################################
HL1=$(cat  $HLBACK/.1.dt)
HL2=$(cat  $HLBACK/.2.dt)
HL3=$(cat  $HLBACK/.3.dt)
HL4=$(cat  $HLBACK/.4.dt)
HL5=$(cat  $HLBACK/.5.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-*
mv $HLBACK/4-$HL3 $HLBACK/3-$HL3
rm -rf $HLBACK/4-*
mv $HLBACK/5-$HL4 $HLBACK/4-$HL4
rm -rf $HLBACK/5-*
mv $HLBACK/6-$HL5 $HLBACK/5-$HL5

rm -rf $HLBACK/6-*
mkdir  $HLBACK/6-$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"
sleep 5
find $HLSOURCE -maxdepth 1 -type d  -iname "*"  -not -path "$HLBACK" -not -path "$HLSOURCE" -exec cp -larv "{}" $HLBACK/6-$HLNAME  \;
find $HLSOURCE -maxdepth 1 -type f -iname "*"  -not -path "$HLBACK" -not -path "$HLSOURCE" -exec cp -larv "{}" $HLBACK/6-$HLNAME  \;
###########

cat  $HLBACK/.2.dt >  $HLBACK/.1.dt
cat  $HLBACK/.3.dt >  $HLBACK/.2.dt
cat  $HLBACK/.4.dt >  $HLBACK/.3.dt
cat  $HLBACK/.5.dt >  $HLBACK/.4.dt
echo "$HLNAME" > $HLBACK/.5.dt
bester69 wrote:There is nothing to install in linux, from time to time i go to google searching for something fresh to install in linux, but, there is nothing
User avatar
bester69
 
Posts: 1160
Joined: 2015-04-02 13:15

Return to Offtopic

Who is online

Users browsing this forum: No registered users and 8 guests

fashionable