LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   I need recursive and careful rsync (https://www.linuxquestions.org/questions/linux-software-2/i-need-recursive-and-careful-rsync-4175555932/)

Garrett85 10-12-2015 10:59 AM

I need recursive and careful rsync
 
So I recently had a catastrophe with using the Mega cloud service with my Linux Mint desktop and I got my whole home directory wiped out. Everything got wiped out about an hour into syncing my 151 Gig home directory to the cloud so needless to say most of my data didn't get synced to the cloud. When it got deleted from the cloud the cloud then also deleted it all from my desktop so I lost everything. Upon further investigation I was able to find a small amount of data that did get synced to the cloud in the cloud's Rubbish Bin directory, I then found the rest of my files, (the majority of the 151 GB home directory) in a hidden folder set-up by the cloud service in my home directory named .debris. What I want to do is to use rsync to move all the file from /home/garrett/.debris to /home/garrett/
Here's the thing. Both directories (/home/garrett/ & /home/garrett/.debris/) have all the same top level directories in them (Music, Videos, Pictures, etc...) but the directory (/home/garrett/.debris/) has the minority of files within those top level directories, only the few that got synced before the sync got interrupted are in /home/garrett/ so /home/garrett/.debris/ has the majority of files under these top level directories that got deleted before the sync finished. So I want rsync to move all the files from /home/garrett/.debris/ to /home/garrett/ but I don't want files and directories under /home/garrett/ to get overwritten by the files and directories in /home/garrett/.debris, but instead want rsync to be recursive and only move a directory from the source if it's not already in the destination. And if a given directory is already in the destination to then look into that directory for other files and directories that are in the source that are not in the destination.

rsync [?options?] /home/garrett/.debris/* /home/garrett/

I'm sure I'll need a recursive option here but after looking at the man pages for rsync I'm pretty lost.

Also, since there is 151 Gigs give or take to move here should I be using the * wild card here or would it be better to write a bash script that loops the rsync command? I'm worried the number of files I have might be to many arguments for rsync to handle.

Habitual 10-12-2015 11:14 AM

continuation of https://www.linuxquestions.org/quest...ry-4175555824/ ?

Garrett85 10-12-2015 01:17 PM

Yes. The earlier thread was mainly about finding the deleted data but after getting over that hurdle I felt the new issue would be better served with a new thread all it's own.

Habitual 10-12-2015 01:27 PM

works for me. :)
Just sayin' ...

Garrett85 10-16-2015 05:24 PM

I seem to have recovered my lost data but oddly I now have an extra 7 Gigs give or take in my home directory than before everything got wiped out. Does anyone have any ideas on how I could have gotten an extra 7 Gigs of data when I was only recovering lost data and deleting the duplicates?

hortageno 10-18-2015 11:35 AM

Quote:

Originally Posted by Garrett85 (Post 5435769)
I seem to have recovered my lost data but oddly I now have an extra 7 Gigs give or take in my home directory than before everything got wiped out. Does anyone have any ideas on how I could have gotten an extra 7 Gigs of data when I was only recovering lost data and deleting the duplicates?

Maybe some files were hard linked before. Or somehow you duplicated files during the recovery. You could search for duplicates with "fslint" for instance.

debguy 10-19-2015 10:36 AM

> I lost everything

restore your backup. you did make a backup didn't you? your supposed to.

debguy 10-19-2015 10:42 AM

I use:

$ rsync --rsh=rsh -nuav host1:/dir1/ host2:/dir2/

(-n is for testing - you should do a test run)

however, rsync has options for updating !! -a may not be the rule you wish to update by.

obviously rsync(1) documentation fully explains how it works - and it seems to me you haven't read the full manpage

or perhaps you have a scripts which continues on even if when rsync(1) exists with error to warn you all was not successful ?

debguy 10-19-2015 10:48 AM

you need to know if your updating by Comparison, by Time, and etc

also you could transfer the directory to a new name, and later remove the old and rename the transfered if after checking you determine the transfer had completed safely

rcp(1) can be used if there are no "soft links" to restore (rsync is an extended version of rcp)

rsync(1) is an excellent piece of software i've never seen it loose a single file even once (that is, assuming it exits: true, ( rsync foo && echo true || echo "false" )

it's been a real time-saver for me once i got used to how to work it into synchronizing the way i needed it to, very reliable


All times are GMT -5. The time now is 09:48 PM.