SYNC of backup drive and main backup

How do sync my main backup drive with my flash backup. I’v found a ‘sync’ command.

Main backup new file → flash backup old file

Main backup old file ← flash backup new file

Copy files <–> to fill in any new files.

Main backup new file → flash backup

Main backup ← flash backup new file

Can someone how to make the command do this? Thanks.

Not sure what you want but sync is not that it is rsync

sync just forces a write of all pending buffers. rsync is a complex command to copy and sync files from various locations even across networks. I like luckybackup as a GUI front end

You could also take a look at unison, it is much simpler to use as rsync and also allows more than two partners. Like having two pcs (work and home) and a portable usb harddisk,
and no matter where you change files and which ones, unison keeps track of the changes.

I do not know where you found it, but did you check what it does do:

man sync

I don’t really understand the question. But we need a scenario to work from. So let’s suppose “flash” refers to a usb drive. And let’s suppose you are copying files sometimes from a Linux filesystem to the usb drive and sometimes the other direction. [pardon me if I’m right off track, I didn’t have much to go on].

First you have to format the USB drive to a Linux format so that the time stamps, permissions and ownership/s can be carried faithfully back and forth.

Now suppose the origin folder resides at “/path1/origin” and the target resides at “/path2/target” and suppose you wish to make the contents of directory “target” to mirror the contents of directory “origin”, then run this:

rsync =azv --delete /path1/origin/  /path2/target

Perhaps you try that out with dummy files and see what happens.

That’s just one scenario. You need to do a bit of research (with man rsync) to create other scenarios.

I’ll stop at this point to see whether you respond.

I’ll explain again.

system <–> backup flash drive

new → old (overwrite)

old (overwrite) ← new

system File1 → backup flash

system ← backup flash file2

Matching both directory trees.

If can’t find something, I’ll just write a script to do it. I’ll keep that in mind.

Hi
I use fwbackups, then there is also duply frontend to duplicity

Easiest with Unison, very, very, very simple.:wink:

This might work for me. Sometimes I take the backup drive to a high speed connection. Sometimes I download directly into the system backup partition.

I need the new/updated files to go both ways. This is the website I found.

http://www.cis.upenn.edu/~bcpierce/unison/

Thanks to all for the help. I enough information to solve my problem.

Thanks, can you give some examples?

flash drive - backup root backup. unison /dir1/ /dir2/

Okay, I think I know what you want with this question, but not certain, as you left out some more crucial details.

Do you want to synchronize your entire root home (ie: /root/*** ?)

Or, do you want to synchronize your User data?

In either case, if you are synchronizing a Linux file system (such as ext4 or BTRFS, for example) you need to make certain you format the flash drive to a Linux file system format.

If you want to synchronize files for NTFS, you could do that either to a Linux file system on the flash or to exFat, or the standard formatting that USB flash drives are shipped with. But, if you do synchronize an NTFS to a non-Linux file system on the flash drive, you must add the Fat option when creating your sync profile and set it to true. Actually, it should all be very simple by following the instructions in the wizard when you choose to create a Sync profile.

If you want to synchronize files belonging to or that can only be accessed by root, you need to launch Unison from a root console, simply:

unison

If you are backing up your User data, you simply launch Unison as you launch any other Desktop app, since it will have permissions to access and synchronize your User data.

As mentioned, it should be quite self-explanatory when you add or create a new profile after launching Unison, very straightforward.

But, if you need any further help at that point, just post back here.

In mswin (and soon linux), I have a primary backup (ntfs) on a separate partition from mswin. My secondary backup is a flash drive (ntfs). Sometimes, I download updated files to primary backup. Sometimes at a high speed connection to my flash drive. I need to sync the two drives. The backup on the flashdrive and partition need to be sync’ed.

unison /Main_backup1/ /flash_drive_backup/

In either case, if you are synchronizing a Linux file system (such as ext4 or BTRFS, for example) you need to make certain you format the flash drive to a Linux file system format.

If you want to synchronize files for NTFS, you could do that either to a Linux file system on the flash or to exFat, or the standard formatting that USB flash drives are shipped with. But, if you do synchronize an NTFS to a non-Linux file system on the flash drive, you must add the Fat option when creating your sync profile and set it to true. Actually, it should all be very simple by following the instructions in the wizard when you choose to create a Sync profile.

If you want to synchronize files belonging to or that can only be accessed by root, you need to launch Unison from a root console, simply:

unison

If you are backing up your User data, you simply launch Unison as you launch any other Desktop app, since it will have permissions to access and synchronize your User data.

As mentioned, it should be quite self-explanatory when you add or create a new profile after launching Unison, very straightforward.

But, if you need any further help at that point, just post back here.

Unison includes a GUI? How do you compile it?

No need to compile it. In the case of openSUSE, you just install it with the Yast software manager, it is in the openSUSE repositories.

Have you checked Unison out online?

It is a program/app for file synchronizing that has a Linux, Windows, and OSX version, so you can run it from within Windows or within Linux.

You can go here to get the Windows (or OSX) version:http://www.cis.upenn.edu/~bcpierce/unison/index.html

You can read the description at that location to better understand.

The actual downloadable binaries (for all the OS platforms it works in) are here:http://unison-binaries.inria.fr/

Just install it & run it. It is quite intuitive and straightforward.

PS: I actually only use the Linux version, now, but was using two versions a couple years ago, one on the Linux machines and the other version on the Windows machines (Vista & Win7). I do not have any pure Windows machines, anymore. Any existing Windows machines are as dual boot with Linux, so I just use the Linux side to run Unison. As you know, the NTFS partitions can be mounted by Linux, and Unison works with it just fine.

In fact, if you know how & understand what takes place in the differences between NTFS permissions and Linux permissions, I have successfully used it to synchronize the same files between an NTFS partition to an ext4 Linux partition. That is where the fat setting in the Unison profile is usefull.

Thanks for the info. I have unison installed. I tried to use unison and it greyed out the system back partition. It wouldn’t work. Later, I figured out I need to mount the drive first. :slight_smile:

rotfl!

Yep, definitely need to do that!

If I delete files and or folders on one side, are the files on the other side deleted? Delete on/off by default?

What are you using? For rsync there are options to keep or remove I believe

Still with Unison? Have you actually tried it yet? Probably not, I think, because if you open the profile and scan, and check the menu, it should clearly explain itself to you.

When you run the scan (it runs when you open the profile), it lists whether files have changed and which side they were changed on, if there are new files on one side or the other they are listed, and if a file is deleted on one side or the other. You scan that list before applying the actions. If you apply without changing anything, the two sides will be synchronized (ie: new files will now be on both sides, changed files will now both be the latest version on both sides, and files deleted on one side will be deleted on the other): Complete Synchronization.

You can make decisions on individual files. If you want a file deleted on one side, but not the other, you can mark that file to be permanently ignored when synchronizing.

If you decide you want the older version instead of the changed one, you can reverse the arrow (which shows the direction the synch will be performed) on an individual file.

If it is a new file, but you do not want it (say, a junk file), you can reverse the arrow so it is deleted on both sides instead of copied to both sides.

If you want to keep the new file on one side, but not on the other, you can – again – decide to permanently ignore that file. The dialogue says “permanently ignore this path”, and since the full path is to that unique file, it is that file only. Do not get confused thinking that means the entire directory. Other files in the same directory will still be synchronized, unless you decide to permanently ignore them individually, or unless you decide to ignore the Folder instead of the files.

All quite straightforward.

Run it, let it scan, then check the list and check the options in the menu. If you are unsure, or change your mind about synchronizing before you hit the “Apply” button, nothing will be changed and you can just exit. And, nothing will change … until you hit the Apply button.

It is actually very straightforward, and self-explanatory.