LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-13-2010, 08:13 AM   #1
djspits
LQ Newbie
 
Registered: Oct 2009
Location: The Hague, The Netherlands
Distribution: Ubuntu 10.04 LTS
Posts: 15

Rep: Reputation: 0
How to determine which disk contains the latest updates


Hello everyone,

Consider the following scenario: you have two disks that are kept synchronized by some method. Could be RAID, could be LVM snapshots, could be a script. However, something has gone wrong. The disks are out-of-sync and you don't know which disk received which updates. You want to manually re-sync the disks but how do you figure-out which file to copy where?

I'm thinking of saving recursive directory-listings of the entire disks to text-files. Sorting them on last-update and removing all identical entries from the files.

I have a feeling that this is something that can be done with just a few command's but I need some help to get me started.

Ideas anyone?

Cheers, DJ.
 
Old 12-14-2010, 05:35 PM   #2
kbp
Senior Member
 
Registered: Aug 2009
Posts: 3,790

Rep: Reputation: 650Reputation: 650Reputation: 650Reputation: 650Reputation: 650Reputation: 650
Chances are pretty high that one disk is the master copy and the other is the backup/secondary .. you should be able to determine the master going by the latest modified times and sync from that one to the other
 
Old 12-15-2010, 05:53 PM   #3
djspits
LQ Newbie
 
Registered: Oct 2009
Location: The Hague, The Netherlands
Distribution: Ubuntu 10.04 LTS
Posts: 15

Original Poster
Rep: Reputation: 0
I don't want to assume anything about primary or secondary disks. Things have gone wrong. 99% of the files are synchronized, but some are out-of-sync.

I'm writing a script that fixes things without losing any updates, whichever disk they were written to.

Perhaps you would be so kind and re-read my original question?

DJ
 
Old 12-15-2010, 06:26 PM   #4
onebuck
Moderator
 
Registered: Jan 2005
Location: Midwest USA, Central Illinois
Distribution: SlackwareŽ
Posts: 12,547
Blog Entries: 23

Rep: Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943Reputation: 1943
Hi,

You really need to provide to the forum more information if you expect help.
 
Old 12-15-2010, 07:03 PM   #5
impert
Member
 
Registered: Feb 2009
Posts: 282

Rep: Reputation: 54
As I see it, the problem with times is that files that have been backed up will obviuosly have a later timestamp than the originals, but if for some reason the backup has not been made, the original file will have a later time than its out-of date backup. If a backup has failed half-way through, and some files are backed up and others not, then you have a problem.
I don't see a solution other than deciding that backups live in a particular place.
 
Old 12-19-2010, 10:57 AM   #6
djspits
LQ Newbie
 
Registered: Oct 2009
Location: The Hague, The Netherlands
Distribution: Ubuntu 10.04 LTS
Posts: 15

Original Poster
Rep: Reputation: 0
Okay, last attempt.

As I wrote in my original post the disks/partitions are synchronized by some method like raid, lvm or a script. That means that file dates are preserved.

Further, the only fact given is that the copies are out-of-sync but no assumptions can be made about one disk/partition being primary or master or current and the other being older. Otherwise this would be a very trivial question. So, a small percentage of files need to be copied, both A -> B and B -> A.

Question: the fastest or shortest bash code that accomplishes this task.

Cheers,
DJ
 
Old 12-19-2010, 05:48 PM   #7
kbp
Senior Member
 
Registered: Aug 2009
Posts: 3,790

Rep: Reputation: 650Reputation: 650Reputation: 650Reputation: 650Reputation: 650Reputation: 650
Perform an rsync both ways, as long as you don't use '--delete' you'll end with all the latest files in both places.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

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
Latest sudo updates Feanor Slackware 2 09-21-2010 03:57 AM
Latest Sabayon Updates! (COMPRESSED) talalpro Sabayon 1 08-10-2010 09:18 AM
Latest Updates from Distros? linuxunix Linux - Newbie 2 04-05-2010 08:04 AM
Problems with latest Updates jchorn SUSE / openSUSE 2 01-19-2008 12:06 PM
Sax2 now broken after latest updates The PIT SUSE / openSUSE 5 09-10-2007 02:59 PM


All times are GMT -5. The time now is 02:15 AM.

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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration