rsync differential backup move files
Clash Royale CLAN TAG#URR8PPP
up vote
1
down vote
favorite
root@server1:/ - remote server
/backup1/12/fullbackup - local backup server with data from server1
first i rsync all data from remote server to local backup server (script1.sh):
rsync -avrh -e "ssh -p 123456 -o StrictHostKeyChecking=no"
--progress
root@server1:/ /backup1/12/fullbackup/
Second i create simple differential backup script (script2.sh):
today=15
rsync -avrh -e "ssh -p 123456 -o StrictHostKeyChecking=no"
--progress
--link-dest=/backup1/12/fullbackup/
root@$ip:/ /backup1/12/backupday/$today/
After run first script (script1.sh) in directory 12:
# du -sh /backup1/12/*
8.0K /backup1/12/backupday
4.1G /backup1/12/fullbackup
After run second script (script2.sh) all data from fullbackup move to backupday/15
# du -sh /backup1/12/*
3.9G /backup1/12/backupday
386M /backup1/12/fullbackup
After move today=15 to today=16 and run second script again (script2.sh) in backupday:
# du -sh /backup1/12/backupday/*
4.1G /backup1/12/backupday/15
104M /backup1/12/backupday/16
I don't understand why first run script2.sh move all data to backupday/15, and second,third and next run script create correct differential backup.
What needs to change to always have a full copy in /backup1/12/fullbackup, and different in backupday/$today ?
rsync
add a comment |Â
up vote
1
down vote
favorite
root@server1:/ - remote server
/backup1/12/fullbackup - local backup server with data from server1
first i rsync all data from remote server to local backup server (script1.sh):
rsync -avrh -e "ssh -p 123456 -o StrictHostKeyChecking=no"
--progress
root@server1:/ /backup1/12/fullbackup/
Second i create simple differential backup script (script2.sh):
today=15
rsync -avrh -e "ssh -p 123456 -o StrictHostKeyChecking=no"
--progress
--link-dest=/backup1/12/fullbackup/
root@$ip:/ /backup1/12/backupday/$today/
After run first script (script1.sh) in directory 12:
# du -sh /backup1/12/*
8.0K /backup1/12/backupday
4.1G /backup1/12/fullbackup
After run second script (script2.sh) all data from fullbackup move to backupday/15
# du -sh /backup1/12/*
3.9G /backup1/12/backupday
386M /backup1/12/fullbackup
After move today=15 to today=16 and run second script again (script2.sh) in backupday:
# du -sh /backup1/12/backupday/*
4.1G /backup1/12/backupday/15
104M /backup1/12/backupday/16
I don't understand why first run script2.sh move all data to backupday/15, and second,third and next run script create correct differential backup.
What needs to change to always have a full copy in /backup1/12/fullbackup, and different in backupday/$today ?
rsync
add a comment |Â
up vote
1
down vote
favorite
up vote
1
down vote
favorite
root@server1:/ - remote server
/backup1/12/fullbackup - local backup server with data from server1
first i rsync all data from remote server to local backup server (script1.sh):
rsync -avrh -e "ssh -p 123456 -o StrictHostKeyChecking=no"
--progress
root@server1:/ /backup1/12/fullbackup/
Second i create simple differential backup script (script2.sh):
today=15
rsync -avrh -e "ssh -p 123456 -o StrictHostKeyChecking=no"
--progress
--link-dest=/backup1/12/fullbackup/
root@$ip:/ /backup1/12/backupday/$today/
After run first script (script1.sh) in directory 12:
# du -sh /backup1/12/*
8.0K /backup1/12/backupday
4.1G /backup1/12/fullbackup
After run second script (script2.sh) all data from fullbackup move to backupday/15
# du -sh /backup1/12/*
3.9G /backup1/12/backupday
386M /backup1/12/fullbackup
After move today=15 to today=16 and run second script again (script2.sh) in backupday:
# du -sh /backup1/12/backupday/*
4.1G /backup1/12/backupday/15
104M /backup1/12/backupday/16
I don't understand why first run script2.sh move all data to backupday/15, and second,third and next run script create correct differential backup.
What needs to change to always have a full copy in /backup1/12/fullbackup, and different in backupday/$today ?
rsync
root@server1:/ - remote server
/backup1/12/fullbackup - local backup server with data from server1
first i rsync all data from remote server to local backup server (script1.sh):
rsync -avrh -e "ssh -p 123456 -o StrictHostKeyChecking=no"
--progress
root@server1:/ /backup1/12/fullbackup/
Second i create simple differential backup script (script2.sh):
today=15
rsync -avrh -e "ssh -p 123456 -o StrictHostKeyChecking=no"
--progress
--link-dest=/backup1/12/fullbackup/
root@$ip:/ /backup1/12/backupday/$today/
After run first script (script1.sh) in directory 12:
# du -sh /backup1/12/*
8.0K /backup1/12/backupday
4.1G /backup1/12/fullbackup
After run second script (script2.sh) all data from fullbackup move to backupday/15
# du -sh /backup1/12/*
3.9G /backup1/12/backupday
386M /backup1/12/fullbackup
After move today=15 to today=16 and run second script again (script2.sh) in backupday:
# du -sh /backup1/12/backupday/*
4.1G /backup1/12/backupday/15
104M /backup1/12/backupday/16
I don't understand why first run script2.sh move all data to backupday/15, and second,third and next run script create correct differential backup.
What needs to change to always have a full copy in /backup1/12/fullbackup, and different in backupday/$today ?
rsync
edited Oct 16 '17 at 12:23
Jeff Schaller
32.1k849109
32.1k849109
asked Oct 16 '17 at 11:11
MMa
61
61
add a comment |Â
add a comment |Â
1 Answer
1
active
oldest
votes
up vote
1
down vote
What you are seeing is an artifact of du
. When you hard-link files, du
keeps a note of the disk usage that has already been accounted for when it comes across the second file. Eg
$ mkdir a b
$ dd count=1000 </dev/zero >a/x
$ ln a/x b/x
$ du -s a b
500 a
0 b
$ du -s b a
500 b
0 a
You see how the first directory gets all the space apparently used.
add a comment |Â
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
1
down vote
What you are seeing is an artifact of du
. When you hard-link files, du
keeps a note of the disk usage that has already been accounted for when it comes across the second file. Eg
$ mkdir a b
$ dd count=1000 </dev/zero >a/x
$ ln a/x b/x
$ du -s a b
500 a
0 b
$ du -s b a
500 b
0 a
You see how the first directory gets all the space apparently used.
add a comment |Â
up vote
1
down vote
What you are seeing is an artifact of du
. When you hard-link files, du
keeps a note of the disk usage that has already been accounted for when it comes across the second file. Eg
$ mkdir a b
$ dd count=1000 </dev/zero >a/x
$ ln a/x b/x
$ du -s a b
500 a
0 b
$ du -s b a
500 b
0 a
You see how the first directory gets all the space apparently used.
add a comment |Â
up vote
1
down vote
up vote
1
down vote
What you are seeing is an artifact of du
. When you hard-link files, du
keeps a note of the disk usage that has already been accounted for when it comes across the second file. Eg
$ mkdir a b
$ dd count=1000 </dev/zero >a/x
$ ln a/x b/x
$ du -s a b
500 a
0 b
$ du -s b a
500 b
0 a
You see how the first directory gets all the space apparently used.
What you are seeing is an artifact of du
. When you hard-link files, du
keeps a note of the disk usage that has already been accounted for when it comes across the second file. Eg
$ mkdir a b
$ dd count=1000 </dev/zero >a/x
$ ln a/x b/x
$ du -s a b
500 a
0 b
$ du -s b a
500 b
0 a
You see how the first directory gets all the space apparently used.
answered Oct 16 '17 at 11:39
meuh
29.8k11751
29.8k11751
add a comment |Â
add a comment |Â
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f398383%2frsync-differential-backup-move-files%23new-answer', 'question_page');
);
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password