“If your laptop computer is a complement to your desktop machine, you’re probably well aware of the need to synchronize data between the two. When you’re in the middle of a big project and know you’re going to be spending the afternoon in a doctor’s waiting room or on an airplane, it’s nice to be able to quickly transfer your project files – and maybe your email and contacts – to the laptop, then vice-versa when you return to your desk. This article will show you two ways to accomplish this on GNU/Linux-based machines.”
NAS Shared drive perhaps?
I use SyncToy on Windows with my external drive, It would be nice if this worked in REAL TIME though for every file change.
.. really I sat in the cinema once with their large woofers and nobody had a clue I was farting like an Elephant.
“How to Synchronize Your Desktop and Laptop” ??? spc, rsync ???
What do laptop and desktop have to do with scp and rsync? In case of synchronizing laptop and desktop one would expect some iFolder article not console utilities.
I would understand if article would mention cron job synchronizing of servers not laptop and desktop.
He was talking about people who have project files on their computer… I think they’re bright enough to type a command.
Rsync is a great tool to keep your desktop and laptop synchronized. And scp is something I see users use everyday to transfer files.
This concept that you cannot use CLI on a desktop is completely ignorant.. Maybe those who don’t wish to learn but point and click their way through life will be content; but I doubt they’ll be working on their project files in the doctor’s waiting room. For the rest of us, well, we sometimes employ the power of a good text based interface to get work done.
Yes, this article should rather be called “How to copy files from one machine to another”.
Rsync is super easy to use once you understand it and it is the most reliably sync tool I have ever used.
Put this in your .bashrc file:
alias my-sync=’rsync -av –delete network/Documents/ /home/joe/Documents/’
The first is your source directory, the second is your target one.
This allows you to sync any two directories easily by typing my-sync at a prompt.
You may think this is hard, but it is the easiest thing to set up and it works all the time, every time. You can even script it so that you don’t forget it and anyone can do this.
Please stop thinking so highly of yourselves and demoralizing others with your elitist attitude. Anyone can learn how to use rsync!
Have to agree with you on that. I have found RSYNC to be a fantastic tool for backing up and transfering data. Made my life as a linux server admin much easier. It’s reliable, powerful and easy enough to use if you do a bit of reading.
I think I would actually feel rather out-of-control in a GUI after using the command line tools so mucb.
Mac OSX has rsync included too. I’ve been using this script to
1. Create a 128-Bit AES ecrypted password protected volume (if it doesn’t exist)
2. mount the volume automatically
3. Sync the source folder into the volume
4. unmount the volume
5. Compact the volume to remove padded space
#BEGIN
VOLUME=”$USER””_Backup”
DISKIMAGE=”$VOLUME”.sparseimage
hdiutil create -encryption -fs HFS+J -type SPARSE -size 60g -volname “$VOLUME” “$DISKIMAGE”
DESTINATION=”/Volumes/$VOLUME”
DEVICE=$(hdiutil attach “$DISKIMAGE” | awk “$0~/$VOLUME/ {print $1}”)
sudo rsync -E -a -x -S –delete
–exclude-from backup_excludes.txt $*
/source/folder/ $DESTINATION
hdiutil detach “$DEVICE”
hdiutil compact “$DISKIMAGE”
#END
backup_excludes.txt just contains a list of folders/files to ingore.
This works swimmingly except that sudo asks for me to enter my password, is there anyway I can provide my password to sudo in my script so that I can run the script silently?
You *should* be able to setup your sudoers file to allow that command to run w/o asking for password:
man sudoers
/NOPASSWD
It’s not a case of it being hard to use rsync, the problem is that it one extra thing to think about out of the one million others things we have to do. It is certainly not a case of being elitist, it is about getting a housekeeping job done with the least amount of effort, and if I can find something to avoid using magical spells on the console I would prefer to use it.
One extra thing to think about?
Well, if you have more than one computer, and want to keep all your files synced up on each of them, rsync appears to me to be ONLY ONE thing that you need to remember to accomplish it
I dunno about unison though, will take a look at that
Unison is a bidirectional rsync over a ssh channel, it works pretty good for more than two machines. You just have to choose a ring or star topology.
I have a fairly complex setup: full home dir kept on a central server, synced with desktop, laptop (ppc, iow: the software is portable) and some parts with other servers or even mp3 player. The windows version is slower, and I’d need two copies on the same machine, so I use a samba share or the ext2 driver for windows.
I don’t care very much for space, it’d be the perfect piece of software if it could retrieve older versions of previously synced files, but I guess it’d be hard to add such a feature.
> Unison is a bidirectional rsync over a ssh channel,
> it works pretty good for more than two machines.
Unison barely works for two machines, and using it for more than two machines is worse than awful (although still magnitudes better than rsync, of course).
Unison doesn’t handle exclusions well. You can’t set it up so that one host only gets certain files in a dir while some other host gets all the files in the same dir. (E.g., I don’t want to keep all my photos on my laptops, since they have small HDDs.)
Unison is also very bad at handling conflicts (i.e. the same file has changed on more than one server), with no support for merge-plugins or whatever.
Unison is bad at handling live file systems where files might change or move around while the sync is happening.
Unison’s website states: “Unison is resilient to failure. It is careful to leave the replicas and its own private structures in a sensible state at all times, even in case of abnormal termination or communication failures.” This is utter BS. I’ve been forced to rebuild the databases many times due to more or less random crashes.
The GUI as awful! If you want to click a button two times in a row you first have to move the pointer outside the button borders and then back. Absurd! And you can’t even multiselect entries in the file list! It’s like version 0.0.0.1 or MyVeryFirstGUIProgram or something.
When unison doesn’t work it usually crashes without any error messages or anything, it just disappears. When it provides error messages they are completely unhelpful.
Unfortunately I haven’t found anything better than unison. (The only alternative I’ve found, iFolder, seems to require a “master server” to store all files, which I find unacceptable.)
> Unison barely works for two machines, and using it for
> more than two machines is worse than awful
I’m not sure why you say that. I keep 4 hosts in sync using Unison in a star topology. It’s complicated because I need different sets of files synchronized on different hosts, but that’s inherent in the problem, it’s not Unison’s fault.
> Unison doesn’t handle exclusions well. You can’t set it
> up so that one host only gets certain files in a dir
> while some other host gets all the files in the same
> dir.
Untrue, I do exactly that with Unison. The Fine Manual tells how.
> Unison is also very bad at handling conflicts (i.e.
> the same file has changed on more than one server),
Conflicts inherently require a decision from the user. It can be given manually for each case, or automatically by an overall “always prefer host X” rule. Unison supports both methods.
> with no support for merge-plugins or whatever.
Untrue, I had Unison set up for a while to automatically invoke winmerge for every conflict.
> I’ve been forced to rebuild the databases many times
> due to more or less random crashes.
I’ve used Unison for years and have never had to do that.
> The GUI is awful!
You’re right about that! I stopped bothering with it years ago.
> > Unison doesn’t handle exclusions well. You can’t set it
> > up so that one host only gets certain files in a dir
> > while some other host gets all the files in the same
> > dir.
>
> Untrue, I do exactly that with Unison. The Fine Manual
> tells how.
Not so. Unison “ignores” are:
– based on profiles, not on hosts (e.g. if I want to perform the sync from any host I’ll have to have the same ignore list on all hosts and keep them all in sync), which wouldn’t actually be so hard if inclusions weren’t:
– based solely on paths (e.g. no way to sync “the 1000 newest files”)
However, it’s better than I’ve previously realized. Since I’ve mostly used the GUI version I hadn’t previously noticed the “include” profile command which seem to make common ignore lists easier to maintain.
> > with no support for merge-plugins or whatever.
>
> Untrue.
I stand corrected. I have no idea how I hadn’t noticed this. As I’ve mostly used the GUI it might be because it’s so bad, but I can’t check it right now since the PoS unison-gtk2 refuses to display its main window, just throwing “uncaught exception” and “fatal error” messages at me.
And one other thing that’s wrong with unison is that it requires the same version to be available on all hosts. That’s insane, considering it’s meant to be multi-platform. The current debian stable version is 2.9.1, but that version isn’t even available as a win-gtk2 executable! On a debian unstable it’s 2.13.16 and on ubuntu breezy it’s 2.10.2.
An even remotely sane developer would differ between db/protocol versions (which change less often) and client implementation versions (which change much, much more often), but not the user-ignoring unison developers, no sir!
There’s a GUI wrapper for rsync: Grsync http://www.opbyte.it/grsync/. I haven’t tried it (yet) though, so I can say nothing about its quality.
rehdon
The author apparently doesn’t know about Unison: http://www.cis.upenn.edu/~bcpierce/unison/.
I almost agreed with you, until you added “to avoid using magical spells on the console”…basically, what you’re saying is that you want a GUI front-end. That’s fine, but there’s no reason to make the console method sound harder than it really is. In fact, one of the advantages of the console method is that it is relatively easy for someone to write scripts and/or a GUI front-end to use it, so that people like you and me who prefer graphical tools can be happy.
This is OSNews, a site for geeks and people who are not afraid of technical stuff, such as the command line. If the site was called NewbieNews then your criticism might have been warranted, but as it stands now I think it’s a bit exaggerated.
Tomahawk Desktop (http://www.tomahawkcomputers.com/) comes with built-in FTP server plus client and Zeroconf (Apple Bonjour).
That is, when you install Tomahawk Desktop on a desktop machine named desktop, you can transfer data from your laptop using any FTP client to the desktop by typing the desktop.local as the url, provided your laptop supports zeroconf, if not, you have to find the IP address of the desktop machine.
If you install Tomahawk Desktop on the laptop named laptop, you can transfer data from your desktop using any FTP client to the laptop by typing the laptop.local as the url, provided your desktop supports zeroconf, if not, you have to find the IP address of the laptop.
If you install Tomahawk Desktop on both the laptop and the desktop, you don’t have to source any FTP client, you do not need to know their IP addresses, just transfer either way buy typing either desktop.local or laptop.local.
What about ifolder. Havn’t used it myself, but isn’t that the sort of idea to always keep your machines in sync with the latest files?
Yes, iFolder can keep your files in sync across multiple PCs. You can even share files with others, if you wish. See http://www.ifolder.com for more info.
I use Unison for this sort of job! It synchronize bidirectionel and does a very good job.
I’ve been using MS SyncToy to sync up some pcs. It’s free and seems to do the job. You’ve got various options echo, combine and subscribe. I’m sure it’s not the most feature rich app around, but it’s free and does everything I need to.
>This is OSNews, a site for geeks and people who are not >afraid of technical stuff, such as the command line. If >the site was called NewbieNews then your criticism might >have been warranted, but as it stands now I think it’s a >bit exaggerated.
You’re right of course, this site is not meant for the general user but for specialists. I take back what I said with regard to readers of this site, the console is the perfect interface for them. However for the general user and with the aim of making Linux more applicable to the ‘masses’ there is always room for ‘easier to remember’ tools.
I was however dissappointed at some of the other remarks from the specialists on this site. The testosterone that comes with some Linux users is the bane of the community and I believe they should recongnise that Linux today is not just for the specialist but also for the general user who has no time for console syntax or semantics. I assume we’re on the same book with regard to wishing Linuxs’ success.
Try grsync then and stop whining. It has a nice and easy to use GUI for rsync.
>Try grsync then and stop whining. It has a nice and easy
>to use GUI for rsync.
It’s not whining you idiot, it’s trying to balance the two world that Linux is serving.