Backing up *cough**gag*Windows*gag**cough*

Forum: LXer Meta ForumTotal Replies: 8
Author Content
techiem2

Nov 01, 2007
2:48 PM EDT
Yeah so, my dad recently got (i.e. I ordered and he paid for) a nice external drive bay and drive to back up his home and work comps. The home one is no problem cuz it's XP and I found a nice backup prog to do proper incremental/differential/whatever you feel like backups. At work however, his comp is still running 98, which the box doesn't work with (like that's a surprise).

So, my current plan is to burn a custom SystemRescueCD with a script to backup his important dirs to the disk. The problem is, I need a copy method that will only copy changed stuff and not EVERYTHING every time. Rsync doesn't seem to do that when copying to a fat32 partition - it copies everything every time (I've seen this copying directly from fat32 to fat32 and copying across ssh from an ext3 fileserver to a local fat32 partition). So, does anyone know a simple way to do a sync of directories with only the changed stuff instead of recopying several GB every time? Is there a way to make rsync behave properly when copying to fat32?

Thanks!

Mark II
azerthoth

Nov 01, 2007
3:23 PM EDT
Why no use tar?
tuxchick

Nov 01, 2007
4:05 PM EDT
Why use tar? rsync copies only the changes, while tar has to copy everything every time.

Try this incantation:

rsync -rvt --modify-window=1 [sourcefile] [backupfile]

This explains why: http://mandrivausers.org/lofiversion/index.php/t42887.html

FAT32 gags on certain characters in filenames, like | and > and : and others. It won't preserve ownership or permissions, either. But rsync will work.
azerthoth

Nov 01, 2007
4:52 PM EDT
TC,

- u Update. The named files are written at the end of the tarfile if they are not already in the tarfile, or if they have been modified since last written to that tarfile.
techiem2

Nov 01, 2007
9:34 PM EDT
Tar would be great if we wanted it compressed, but I just want a mirror on the disk so if something fries we can just dump it all (or just what he wants) back over. I'll try out the rsync line later when I have a chance.

Thanks as always!
jacog

Nov 01, 2007
10:59 PM EDT
Tar does not compress anything, as far as I know... just packages it... this is why you add gzip or bzip2 compression afterwards usually...

Er... or do I have it all wrong?
rijelkentaurus

Nov 02, 2007
4:04 AM EDT
Quoting: Er... or do I have it all wrong?


No, I think you have it right, but it's "tarred" up and not accessible without untarring it, so a mere copy over the network or to an external drive is more convenient for random access by a user.
hkwint

Nov 02, 2007
5:06 AM EDT
If you don't want to have your copy tarred, why not just use the 'cp' command?

From the man page of cp:

Quoting: -u, --update copy only when the SOURCE file is newer than the destination file or when the destination file is missing


In combination with -r, this should do the job.

So, it would look something like:

cp -uvr /dir-to-be-backed-up/* /destination/

BTW tar zipping or not depends on arguments:

$tar -c means create a tar archive, without zipping it; which concatenates all 'binary data' of your dir. $tar -cz means create a tar archive and gzip it, $tar -cj means create a tar archive and bzip2 it.

Normally, one would add the -v switch, and the -f switch immediately followed by the filename the archive should be mentioned, like: $tar -cvzf my_backup.tgz /dir-to-be-backed-up

than you could ahh the -u switch to prevent overwriting of files which already are in the archive;

$tar -cvuzf my_backup.tgz /dir-to-be-backed-up
tuxchick

Nov 02, 2007
7:35 AM EDT
rsync give you the best of all worlds: efficient backups that copy only changes, and you can copy files out of your rsync archive in the usual way, without have to jump through extra hoops. If you use rsync for simple mirroring you won't end up with masses of different versions of the same file. Just nice mirror where it's easy to find and copy what you want.

Yes, you can save space with compression, but if that's not an issue rsync is a lot easier than tar. Another advantage of rysnc over tar is a tar archive is a single file, so if it gets corrupted you could lose everything. There are ways to recover borked tar archives, but why do it if you don't have to?

Posting in this forum is limited to members of the group: [Editors, MEMBERS, SITEADMINS.]

Becoming a member of LXer is easy and free. Join Us!