LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 10-12-2015, 10:59 AM   #1
Garrett85
Member
 
Registered: Jan 2011
Posts: 332

Rep: Reputation: 6
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.
 
Old 10-12-2015, 11:14 AM   #2
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
continuation of https://www.linuxquestions.org/quest...ry-4175555824/ ?
 
Old 10-12-2015, 01:17 PM   #3
Garrett85
Member
 
Registered: Jan 2011
Posts: 332

Original Poster
Rep: Reputation: 6
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.
 
Old 10-12-2015, 01:27 PM   #4
Habitual
LQ Veteran
 
Registered: Jan 2011
Location: Abingdon, VA
Distribution: Catalina
Posts: 9,374
Blog Entries: 37

Rep: Reputation: Disabled
works for me.
Just sayin' ...
 
Old 10-16-2015, 05:24 PM   #5
Garrett85
Member
 
Registered: Jan 2011
Posts: 332

Original Poster
Rep: Reputation: 6
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?
 
Old 10-18-2015, 11:35 AM   #6
hortageno
Member
 
Registered: Aug 2015
Distribution: Ubuntu 22.04 LTS
Posts: 240

Rep: Reputation: 67
Quote:
Originally Posted by Garrett85 View Post
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.
 
Old 10-19-2015, 10:36 AM   #7
debguy
Member
 
Registered: Oct 2014
Location: U.S.A.
Distribution: mixed, mostly debian slackare today
Posts: 207

Rep: Reputation: 19
> I lost everything

restore your backup. you did make a backup didn't you? your supposed to.
 
Old 10-19-2015, 10:42 AM   #8
debguy
Member
 
Registered: Oct 2014
Location: U.S.A.
Distribution: mixed, mostly debian slackare today
Posts: 207

Rep: Reputation: 19
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 ?
 
Old 10-19-2015, 10:48 AM   #9
debguy
Member
 
Registered: Oct 2014
Location: U.S.A.
Distribution: mixed, mostly debian slackare today
Posts: 207

Rep: Reputation: 19
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
 
  


Reply

Tags
linux, rsync, sync, syncing



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Be careful with kernel 4.1 or later. ReaperX7 Slackware 7 07-03-2015 05:41 AM
Sync files not folders with rsync (non recursive) ehlers Linux - Software 7 03-11-2009 09:53 AM
10.1, Be careful what you update...I was not!!! jolphil SUSE / openSUSE 6 09-29-2006 07:23 AM
be careful of zeroconf mp55 Debian 3 02-16-2006 01:13 PM
when they say be careful doin something its a good idea to be careful lol eagle0669 Linux - Newbie 3 08-10-2001 08:43 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 10:15 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration