Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > alt.os.linux > #54449 > unrolled thread
| Started by | Dan Purgert <dan@djph.net> |
|---|---|
| First post | 2019-03-15 18:19 +0000 |
| Last post | 2019-03-20 12:53 +0100 |
| Articles | 20 on this page of 100 — 16 participants |
Back to article view | Back to alt.os.linux
Remote backups with rsync - discussion / tutorial, I guess. Dan Purgert <dan@djph.net> - 2019-03-15 18:19 +0000
Re: Remote backups with rsync - discussion / tutorial, I guess. William Unruh <unruh@invalid.ca> - 2019-03-15 19:06 +0000
Re: Remote backups with rsync - discussion / tutorial, I guess. Dan Purgert <dan@djph.net> - 2019-03-18 11:13 +0000
Re: Remote backups with rsync - discussion / tutorial, I guess. William Unruh <unruh@invalid.ca> - 2019-03-18 16:40 +0000
Re: Remote backups with rsync - discussion / tutorial, I guess. Dan Purgert <dan@djph.net> - 2019-03-19 10:24 +0000
Re: Remote backups with rsync - discussion / tutorial, I guess. Mike Easter <MikeE@ster.invalid> - 2019-03-15 16:17 -0700
Re: Remote backups with rsync - discussion / tutorial, I guess. jjb <invalid@invalid.nl> - 2019-03-16 10:14 +0100
Re: Remote backups with rsync - discussion / tutorial, I guess. Chris Elvidge <chris@mshome.net> - 2019-03-16 09:26 +0000
Re: Remote backups with rsync - discussion / tutorial, I guess. William Unruh <unruh@invalid.ca> - 2019-03-16 16:54 +0000
Re: Remote backups with rsync - discussion / tutorial, I guess. Richard Kettlewell <invalid@invalid.invalid> - 2019-03-16 16:57 +0000
Re: Remote backups with rsync - discussion / tutorial, I guess. Richard Kettlewell <invalid@invalid.invalid> - 2019-03-16 11:06 +0000
Re: Remote backups with rsync - discussion / tutorial, I guess. gazelle@shell.xmission.com (Kenny McCormack) - 2019-03-17 12:52 +0000
Re: Remote backups with rsync - discussion / tutorial, I guess. Allodoxaphobia <trepidation@example.net> - 2019-03-17 17:32 +0000
Re: Remote backups with rsync - discussion / tutorial, I guess. Java Jive <java@evij.com.invalid> - 2019-03-18 12:29 +0000
DOS/Windows "COPY" command (Was: Remote backups with rsync - discussion / tutorial, I guess.) gazelle@shell.xmission.com (Kenny McCormack) - 2019-03-18 16:32 +0000
Re: DOS/Windows "COPY" command (Was: Remote backups with rsync - discussion / tutorial, I guess.) Java Jive <java@evij.com.invalid> - 2019-03-18 16:40 +0000
Re: DOS/Windows "COPY" command (Was: Remote backups with rsync - discussion / tutorial, I guess.) "R.Wieser" <address@not.available> - 2019-03-18 17:59 +0100
Re: DOS/Windows "COPY" command (Was: Remote backups with rsync - discussion / tutorial, I guess.) Adrian Caspersz <email@here.invalid> - 2019-03-18 17:51 +0000
Re: DOS/Windows "COPY" command (Was: Remote backups with rsync - discussion / tutorial, I guess.) "R.Wieser" <address@not.available> - 2019-03-18 19:00 +0100
Re: DOS/Windows "COPY" command (Was: Remote backups with rsync - discussion / tutorial, I guess.) "Carlos E.R." <robin_listas@es.invalid> - 2019-03-18 20:16 +0100
Re: DOS/Windows "COPY" command (Was: Remote backups with rsync - discussion / tutorial, I guess.) Dan Purgert <dan@djph.net> - 2019-03-19 10:19 +0000
Re: DOS/Windows "COPY" command (Was: Remote backups with rsync - discussion / tutorial, I guess.) "Carlos E.R." <robin_listas@es.invalid> - 2019-03-19 12:06 +0100
Re: DOS/Windows "COPY" command (Was: Remote backups with rsync - discussion / tutorial, I guess.) Dan Purgert <dan@djph.net> - 2019-03-19 12:42 +0000
Re: DOS/Windows "COPY" command (Was: Remote backups with rsync - discussion / tutorial, I guess.) "Carlos E.R." <robin_listas@es.invalid> - 2019-03-19 19:36 +0100
Re: DOS/Windows "COPY" command (Was: Remote backups with rsync - discussion / tutorial, I guess.) Dan Purgert <dan@djph.net> - 2019-03-20 10:17 +0000
Re: DOS/Windows "COPY" command (Was: Remote backups with rsync - discussion / tutorial, I guess.) Java Jive <java@evij.com.invalid> - 2019-03-19 13:24 +0000
Re: DOS/Windows "COPY" command (Was: Remote backups with rsync - discussion / tutorial, I guess.) "Carlos E.R." <robin_listas@es.invalid> - 2019-03-19 19:38 +0100
Re: Remote backups with rsync - discussion / tutorial, I guess. Adrian Caspersz <email@here.invalid> - 2019-03-18 17:47 +0000
Re: Remote backups with rsync - discussion / tutorial, I guess. William Unruh <unruh@invalid.ca> - 2019-03-19 00:29 +0000
Re: Remote backups with rsync - discussion / tutorial, I guess. Chris Elvidge <chris@mshome.net> - 2019-03-19 09:02 +0000
Re: Remote backups with rsync - discussion / tutorial, I guess. "Carlos E.R." <robin_listas@es.invalid> - 2019-03-19 12:07 +0100
Re: Remote backups with rsync - discussion / tutorial, I guess. gazelle@shell.xmission.com (Kenny McCormack) - 2019-03-19 13:57 +0000
Re: Remote backups with rsync - discussion / tutorial, I guess. "Carlos E.R." <robin_listas@es.invalid> - 2019-03-19 19:45 +0100
Re: Remote backups with rsync - discussion / tutorial, I guess. Richard Kettlewell <invalid@invalid.invalid> - 2019-03-20 08:52 +0000
Re: Remote backups with rsync - discussion / tutorial, I guess. "Carlos E.R." <robin_listas@es.invalid> - 2019-03-20 11:24 +0100
Re: Remote backups with rsync - discussion / tutorial, I guess. gazelle@shell.xmission.com (Kenny McCormack) - 2019-03-20 11:31 +0000
Re: Remote backups with rsync - discussion / tutorial, I guess. William Unruh <unruh@invalid.ca> - 2019-03-20 15:03 +0000
Re: Remote backups with rsync - discussion / tutorial, I guess. gazelle@shell.xmission.com (Kenny McCormack) - 2019-03-20 17:05 +0000
Why I don't like "rsync"... (Was: Remote backups with rsync - discussion / tutorial, I guess.) gazelle@shell.xmission.com (Kenny McCormack) - 2019-03-20 12:08 +0000
Re: Why I don't like "rsync"... (Was: Remote backups with rsync - discussion / tutorial, I guess.) Chris Elvidge <chris@mshome.net> - 2019-03-20 13:04 +0000
Re: Why I don't like "rsync"... Richard Kettlewell <invalid@invalid.invalid> - 2019-03-20 13:47 +0000
Re: Why I don't like "rsync"... "Carlos E.R." <robin_listas@es.invalid> - 2019-03-22 19:41 +0100
Re: Why I don't like "rsync"... gazelle@shell.xmission.com (Kenny McCormack) - 2019-03-24 09:36 +0000
Re: Why I don't like "rsync"... Richard Kettlewell <invalid@invalid.invalid> - 2019-03-24 09:59 +0000
Re: Why I don't like "rsync"... gazelle@shell.xmission.com (Kenny McCormack) - 2019-03-24 10:36 +0000
Re: Why I don't like "rsync"... Richard Kettlewell <invalid@invalid.invalid> - 2019-03-24 11:12 +0000
Re: Why I don't like "rsync"... gazelle@shell.xmission.com (Kenny McCormack) - 2019-03-24 11:29 +0000
Re: Why I don't like "rsync"... Richard Kettlewell <invalid@invalid.invalid> - 2019-03-24 13:04 +0000
Re: Why I don't like "rsync"... gazelle@shell.xmission.com (Kenny McCormack) - 2019-03-24 13:16 +0000
Re: Why I don't like "rsync"... Dan Purgert <dan@djph.net> - 2019-03-25 10:37 +0000
Re: Why I don't like "rsync"... (Was: Remote backups with rsync - discussion / tutorial, I guess.) William Unruh <unruh@invalid.ca> - 2019-03-20 15:19 +0000
Re: Remote backups with rsync - discussion / tutorial, I guess. Dan Purgert <dan@djph.net> - 2019-03-20 12:44 +0000
Re: Remote backups with rsync - discussion / tutorial, I guess. Richard Kettlewell <invalid@invalid.invalid> - 2019-03-20 13:58 +0000
Re: Remote backups with rsync - discussion / tutorial, I guess. Dan Purgert <dan@djph.net> - 2019-03-20 15:00 +0000
Re: Remote backups with rsync - discussion / tutorial, I guess. Richard Kettlewell <invalid@invalid.invalid> - 2019-03-20 15:49 +0000
Re: Remote backups with rsync - discussion / tutorial, I guess. William Unruh <unruh@invalid.ca> - 2019-03-20 17:57 +0000
Re: Remote backups with rsync - discussion / tutorial, I guess. Richard Kettlewell <invalid@invalid.invalid> - 2019-03-20 23:39 +0000
Re: Remote backups with rsync - discussion / tutorial, I guess. Jasen Betts <jasen@xnet.co.nz> - 2019-03-21 08:15 +0000
Re: Remote backups with rsync - discussion / tutorial, I guess. Richard Kettlewell <invalid@invalid.invalid> - 2019-03-21 09:00 +0000
Re: Remote backups with rsync - discussion / tutorial, I guess. gazelle@shell.xmission.com (Kenny McCormack) - 2019-03-21 13:11 +0000
Re: Remote backups with rsync - discussion / tutorial, I guess. Dan Purgert <dan@djph.net> - 2019-03-21 14:03 +0000
rsync --archive Ivan Shmakov <ivan@siamics.net> - 2019-03-21 18:10 +0000
Re: rsync --archive Richard Kettlewell <invalid@invalid.invalid> - 2019-03-21 21:42 +0000
Re: rsync --archive "Carlos E.R." <robin_listas@es.invalid> - 2019-03-22 19:54 +0100
Re: rsync --archive Ivan Shmakov <ivan@miko.siamics.net> - 2019-03-23 04:32 +0000
Re: Remote backups with rsync - discussion / tutorial, I guess. William Unruh <unruh@invalid.ca> - 2019-03-21 18:54 +0000
Re: Remote backups with rsync - discussion / tutorial, I guess. Jasen Betts <jasen@xnet.co.nz> - 2019-03-22 10:03 +0000
Re: Remote backups with rsync - discussion / tutorial, I guess. William Unruh <unruh@invalid.ca> - 2019-03-21 18:50 +0000
Re: Remote backups with rsync - discussion / tutorial, I guess. Richard Kettlewell <invalid@invalid.invalid> - 2019-03-21 21:31 +0000
Re: Remote backups with rsync - discussion / tutorial, I guess. "Carlos E.R." <robin_listas@es.invalid> - 2019-03-22 19:48 +0100
Re: Remote backups with rsync - discussion / tutorial, I guess. William Unruh <unruh@invalid.ca> - 2019-03-20 15:07 +0000
Re: Remote backups with rsync - discussion / tutorial, I guess. William Unruh <unruh@invalid.ca> - 2019-03-20 14:57 +0000
Re: Remote backups with rsync - discussion / tutorial, I guess. Richard Kettlewell <invalid@invalid.invalid> - 2019-03-20 15:54 +0000
Re: Remote backups with rsync - discussion / tutorial, I guess. William Unruh <unruh@invalid.ca> - 2019-03-20 17:49 +0000
Re: Remote backups with rsync - discussion / tutorial, I guess. Jasen Betts <jasen@xnet.co.nz> - 2019-03-21 08:21 +0000
Re: Remote backups with rsync - discussion / tutorial, I guess. Jasen Betts <jasen@xnet.co.nz> - 2019-03-19 20:50 +0000
Re: Remote backups with rsync - discussion / tutorial, I guess. William Unruh <unruh@invalid.ca> - 2019-03-20 02:40 +0000
Re: Remote backups with rsync - discussion / tutorial, I guess. gazelle@shell.xmission.com (Kenny McCormack) - 2019-03-20 08:19 +0000
Re: Remote backups with rsync - discussion / tutorial, I guess. William Unruh <unruh@invalid.ca> - 2019-03-20 02:37 +0000
Re: Remote backups with rsync - discussion / tutorial, I guess. Jasen Betts <jasen@xnet.co.nz> - 2019-03-19 19:53 +0000
Re: Remote backups with rsync - discussion / tutorial, I guess. "Carlos E.R." <robin_listas@es.invalid> - 2019-03-19 21:25 +0100
Re: Remote backups with rsync - discussion / tutorial, I guess. Java Jive <java@evij.com.invalid> - 2019-03-19 22:04 +0000
Re: Remote backups with rsync - discussion / tutorial, I guess. Dan Purgert <dan@djph.net> - 2019-03-18 11:20 +0000
Re: Remote backups with rsync - discussion / tutorial, I guess. "Carlos E.R." <robin_listas@es.invalid> - 2019-03-18 13:07 +0100
Re: Remote backups with rsync - discussion / tutorial, I guess. Dan Purgert <dan@djph.net> - 2019-03-18 12:43 +0000
Re: Remote backups with rsync - discussion / tutorial, I guess. "Carlos E.R." <robin_listas@es.invalid> - 2019-03-18 14:32 +0100
Re: Remote backups with rsync - discussion / tutorial, I guess. William Unruh <unruh@invalid.ca> - 2019-03-18 16:44 +0000
Re: Remote backups with rsync - discussion / tutorial, I guess. Daniel60 <daniel47@eternal-september.org> - 2019-03-16 23:52 +1100
Re: Remote backups with rsync - discussion / tutorial, I guess. Dan Purgert <dan@djph.net> - 2019-03-18 11:49 +0000
Re: Remote backups with rsync - discussion / tutorial, I guess. "Carlos E.R." <robin_listas@es.invalid> - 2019-03-18 13:11 +0100
Re: Remote backups with rsync - discussion / tutorial, I guess. Dan Purgert <dan@djph.net> - 2019-03-18 12:45 +0000
Re: Remote backups with rsync - discussion / tutorial, I guess. William Unruh <unruh@invalid.ca> - 2019-03-18 18:12 +0000
Re: Remote backups with rsync - discussion / tutorial, I guess. Chris Elvidge <chris@mshome.net> - 2019-03-18 19:12 +0000
Re: Remote backups with rsync - discussion / tutorial, I guess. Chris Elvidge <chris@mshome.net> - 2019-03-18 19:19 +0000
Re: Remote backups with rsync - discussion / tutorial, I guess. Daniel60 <daniel47@eternal-september.org> - 2019-04-02 22:37 +1100
Re: Remote backups with rsync - discussion / tutorial, I guess. jjb <invalid@invalid.nl> - 2019-03-19 12:49 +0100
Re: Remote backups with rsync - discussion / tutorial, I guess. Jasen Betts <jasen@xnet.co.nz> - 2019-03-19 21:08 +0000
Re: Remote backups with rsync - discussion / tutorial, I guess. jjb <invalid@invalid.nl> - 2019-03-20 12:51 +0100
Re: Remote backups with rsync - discussion / tutorial, I guess. jjb <invalid@invalid.nl> - 2019-03-20 10:37 +0100
Re: Remote backups with rsync - discussion / tutorial, I guess. jjb <invalid@invalid.nl> - 2019-03-20 12:53 +0100
Page 1 of 5 [1] 2 3 4 5 Next page →
| From | Dan Purgert <dan@djph.net> |
|---|---|
| Date | 2019-03-15 18:19 +0000 |
| Subject | Remote backups with rsync - discussion / tutorial, I guess. |
| Message-ID | <slrnq8nr52.n0k.dan@djph.net> |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
I know this comes up from time to time, and there are a bazillion
tutorials about it spread across the web, but it's been quiet in here
lately, and I just went through revamping my setup a few weeks ago.
Maybe someone will find it helpful.
In my case, I'm running rsync v 3.1.1, protocol version 31 (Devuan
Jessie) on my backup server, and rsync v. 3.1.2 protocol version 31 on
the clients (MX Linux & Mint 18 in a VM for testing). As such, this'll
have a definite "Debian" slant to it, apologies in advance for any
RH-specific stuff wrong.
NOTE -- for the bulk of this, we're going to assume that "source" and
"destination" are two directories on the same physical machine. The
final section will cover connecting to remote hosts.
=== Getting rsync: ===
In my experience, Debian-based distros don't tend to ship with rsync
installed; so we're just going to assume that no one ships with it.
To install, Debian style (as root):
apt-get install rsync
To install, RH style (as root):
yum install rsync
Your package manager will do its thing, and install the program for you.
=== Basic rsync operation: ===
Now that rsync is installed, we can start using it to create backups of
our stuff. Here is where things _may_ get a little annoying, especially
if you've used other methods to create backups in the past. This is
mainly caused by rsync mainly using mtime to determine whether files
have changed.
The other thing that I've seen trip people up is the syntax necessary
for getting things to work. These two commands operate slightly
differently:
rsync source destination
AND
rsync source/ destination
In the first instance, "source" will become a subdirectory under
"destination". That is, "source/file.xyz" will be saved as
"destination/source/myfile.xyz".
The second instance, only the contents of "source" will be transferred.
That is "source/file.xyz" will be saved as "destination/file.xyz".
Whether you use "source" or "source/" is up to you and how you want your
backup hierarchy to look. I use both approaches - "source" for $HOME
directories (so I get destination/myhome/[files]), and "source/" for
system things (mainly /usr/local/{,s}bin; so the backup just has
"dest/[files]".
In nearly every case, writing "source/*" is the wrong approach -- as
this'll miss dotfiles (and directories); which means potentially not
having backups of our important configs (.bashrc, .gnupg, and so on).
=== Option switches: ===
This is always the part that trips me up -- there are just so many of
them. What I have found is that for my needs, the quick and somewhat
dirty command
rsync -avP
is good for interactive mode, and I like seeing the progress indicators
(as some of the files are large, and just sitting at "/path/to/something
[...]" for 10 minutes is a bit tedious. But that's me.
In my backup scripts, I simply remove the "-P" switch, as I just like to
see the filenames being transferred (and even that's probably a bit
much)
So, what do these switches mean?
-v -> verbose. Prints the filenames as it's going, as well as some
transfer details when the process is completed.
-P -> same as "--progress". Prints progress of the transfer
-a -> "archive" mode. Same as -rlptgoD
-r -> recursively traverse directories
-l -> copy symlinks as symlinks
-p -> preserve permissions
-t -> preserve mtime
-g -> preserve group
-o -> preserve owner (only works if remote rsync is running as
super-user)
-D -> same as --devices --specials
--devices -> recreates block-devices at the remote end (only
works if remote rsync is running as super-user)
--specials -> recreates special files, such as named pipes and
fifos.
Now, in my case, my backup server isn't running rsync as root, so I lose
out on the -o and -D options as part of the archival process; but "-a"
is a lot less typing than "-rlptg".
Another option that can be extremely useful is "--exclude". However, I
tend to not use this option, as my local LAN is faster than the
internet; so better to have ~150GB of stuff locally than waiting on
steam. But that's just me.
=== Automating our backups: ===
Okay, so now we have a basic understanding of rsync, and can kick it off
at will. But, well, computers are supposed to make our lives easier,
right?
Good news, we have a scheduler on our system -- the cron daemon.
There are two ways to set up a cronjob for our backups:
1. Directly in crontab OR
2. in a script that we'll call from crontab.
Either approach is equally good here, since the backup job is pretty
much a one liner:
rsync -avP /home/youruser /backup/drive/directory
NOTE -- crontab has no concept of line breaks or line wrapping, like we
can do in bash scripts. So if you're going to need that, best to use
the second approach and do all the breaks in there.
In order to convert this to a cronjob, we should first determine when we
want the job to run, and then convert that statement into cron's syntax.
For example, let's say we want to run our backups weekly (on Sunday) at
00:30. See the next section for a quick primer on cron.
Here's our potential cronjob:
30 0 * * 0 ( rsync -avP /home/youruser /backup/drive/directory )
NOTE -> the parenthesis aren't a requirement, it's force of habit from
when I got taught how to write cronjobs.
We can add it to our user's crontab with the command "crontab -e". If
it's the first time running crontab, you'll be presented with a menu
that allows you to select your editor. Options will vary, based on your
installed editors, but will likely look like
Select an editor:
1. /bin/nano <- easiest
2. /usr/bin/vim
3. [...]
your choice[1]:
In the event you don't like your choice, you can run the "select-editor"
tool to pick another option.
=== Cron Sidebar: ===
Skip ahead if you like.
Cron uses a 5-position whitespace-delimeted time/date syntax,
corresponding to these categories:
1. Minute (0-59)
2. Hour (0-23)
3. Day of Month (i.e. 1-31)
4. Month (i.e. 1-12, or short-name - Jan,feb,mar,apr, and so on)
5. Day of Week (i.e. 0-6 --> note 1-7 also works, where 0=7=Sunday;
short names - mon,tue, etc. - work here too)
In all fields, ranges (1-n), lists (1,2,3), and combinations (1,2-6,9)
are allowed for numerical restrictions. For fields that allow text
input, you can only use lists (i.e. a range such as "mon-fri" is not
allowed).
In any field, you can use an asterisk (*) to indicate the full range.
In the event that BOTH "Day of Week" and "Day of Month" are restricted
(i.e. non-*), when EITHER "Day of Week" OR "Day of Month" is true, the
cronjob will be triggered. So, if you have for example,
30 0 15 * 5 somejob
It'll fire on every Friday AND the 15th of every month at 00:30.
=== Rsync to remote hosts: ===
Running rsync between two directories on the same local machine is great
and all, but ... well, not much of a backup. Good news though, rsync
can transport the files to a remote host with little fuss.
The easiest (and my preferred) route is to use SSH. It's as simple as
changing our basic command
rsync -avP source destination
to
rsync -avP source user@host:/path/to/destination
We can even use ssh keys
rsync -avP -e 'ssh -i /path/to/ssh/key' source user@host:/path/dest
Now, the only real downside of using ssh is that it makes the rsync
command a fair bit longer, such that it's probably not going to fit in
our "one line" crontab entry. You can, of course, let the crontab line
wrap around, but that can be ugly (and break in fun and interesting
ways).
My preferred approach is to just write a shell script, and then call
that, for example:
==== backup-etc ===
#backup /etc
name=$(hostname)
rsync -avP -e 'ssh -i /path/to/ssh_key' /etc \
user@remote:/srv/share/backups/$name/
====
and our crontab is then just something like this:
30 0 * * 0 ( /usr/local/bin/backup-etc )
Well, since you made it this far, HTH, HAND.
-----BEGIN PGP SIGNATURE-----
iQEzBAEBCAAdFiEEBcqaUD8uEzVNxUrujhHd8xJ5ooEFAlyL7KAACgkQjhHd8xJ5
ooEO5gf+KEIruTne7d+r6Gd3a8wY7k4Sf1lqQiDVFr26Ouf4VWFwEdN1jXSf3wYm
4+C8lW+6Ce/UFKT9eLK01eTXAcUGfVSzR7gfCj5kcDVfKc0C19JqfUdCjm4P8VT8
vKiwuoI9f00b2rC4CqG5fC5PWxXqZP+aR+3ixmDWR6rVkR8pRA9YL1ZBCBYyFFkE
2tmxBx1hpNLGM610tCT3OFcdsMZnQMqurEJs4SuPG1B1pxnusDpHiq7rnTs39/we
EQdunGrU1g2L60FLY1ux1Nyt/OnJ7lZitKizkFvkHqwtt8CkqLSaSYJuSnbzyTyn
sTdjGFGtxMk5RM98LqeUPAzl3fhJyg==
=jNAQ
-----END PGP SIGNATURE-----
--
|_|O|_|
|_|_|O| Github: https://github.com/dpurgert
|O|O|O| PGP: 05CA 9A50 3F2E 1335 4DC5 4AEE 8E11 DDF3 1279 A281
[toc] | [next] | [standalone]
| From | William Unruh <unruh@invalid.ca> |
|---|---|
| Date | 2019-03-15 19:06 +0000 |
| Message-ID | <q6gt2q$6su$1@dont-email.me> |
| In reply to | #54449 |
On 2019-03-15, Dan Purgert <dan@djph.net> wrote: > > > rsync -avP You might also want to use -H which preserves hard links. Say you have two files current sequence-10 hard linked together. And say that file is 10GB long. If you use your flags, you will have two copies, one in backup/.../current and one in backup/.../sequence-10. But if you use -H, then there will only be one copy and it will be hard linked in the backup to both backup/.../current and backup/..../sequence-10. YOu might also want to look at the sequential backup options. Thus if you make backups every night, and that 10GB file mentioned above does not change in weeks or months, then having a separate copy in each backup is pretty wasteful Look at the --link-dest=DIR Thus if tonights file is in backup6 and lastnights in backup5, rsync -avPH --link-dest=backup5 source backup6 will check in backup5 and if the file has not changed (mtime and size are the same in backup5 and in source) then it will hardlink backup6 u unchanged files to those in backup5 > > is good for interactive mode, and I like seeing the progress indicators > (as some of the files are large, and just sitting at "/path/to/something > [...]" for 10 minutes is a bit tedious. But that's me. -P also includes --partial, so if you interupt the transfer, the partially transfered file ( a . file) will be left If you just want to see the trasferes, do --progress instead of -P > > In my backup scripts, I simply remove the "-P" switch, as I just like to > see the filenames being transferred (and even that's probably a bit > much) > > > So, what do these switches mean? > > -v -> verbose. Prints the filenames as it's going, as well as some > transfer details when the process is completed. > -P -> same as "--progress". Prints progress of the transfer And also --partial -> keep partially transfered files. > -a -> "archive" mode. Same as -rlptgoD > > -r -> recursively traverse directories > -l -> copy symlinks as symlinks > -p -> preserve permissions > -t -> preserve mtime > -g -> preserve group > -o -> preserve owner (only works if remote rsync is running as > super-user) > -D -> same as --devices --specials > > --devices -> recreates block-devices at the remote end (only > works if remote rsync is running as super-user) > --specials -> recreates special files, such as named pipes and > fifos. > > Now, in my case, my backup server isn't running rsync as root, so I lose > out on the -o and -D options as part of the archival process; but "-a" > is a lot less typing than "-rlptg". Why is it not as root? ....
[toc] | [prev] | [next] | [standalone]
| From | Dan Purgert <dan@djph.net> |
|---|---|
| Date | 2019-03-18 11:13 +0000 |
| Message-ID | <slrnq8uval.n0k.dan@djph.net> |
| In reply to | #54450 |
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 William Unruh wrote: > On 2019-03-15, Dan Purgert <dan@djph.net> wrote: >> >> >> rsync -avP > > You might also want to use -H which preserves hard links. Say you have > two files > current > sequence-10 > hard linked together. And say that file is 10GB long. > If you use your flags, you will have two copies, one in > backup/.../current and one in backup/.../sequence-10. > But if you use -H, then there will only be one copy and it will be hard > linked in the backup to both backup/.../current and > backup/..../sequence-10. Very good point. I don't have any hard-links in $HOME, so it's not something that I've thought about. > > YOu might also want to look at the sequential backup options. Thus if > you make backups every night, and that 10GB file mentioned above does > not change in weeks or months, then having a separate copy in each > backup is pretty wasteful That's what the options I use do -- after the first run, only new / changed things are transferred. However, I do admittedly "waste" a lot of space on external drives with my monthly tarballs. > Look at the > --link-dest=DIR > Thus if tonights file is in backup6 and lastnights in backup5, > rsync -avPH --link-dest=backup5 source backup6 > will check in backup5 and if the file has not changed (mtime and size > are the same in backup5 and in source) then it will hardlink backup6 u > unchanged files to those in backup5 I obviously have a lot of reading ahead, to make things "better". > > > >> >> is good for interactive mode, and I like seeing the progress indicators >> (as some of the files are large, and just sitting at "/path/to/something >> [...]" for 10 minutes is a bit tedious. But that's me. > > -P also includes --partial, so if you interupt the transfer, the > partially transfered file ( a . file) will be left > If you just want to see the trasferes, do --progress instead of -P I completely misread that it did both. However, some of my source hosts are wifi, so the --partial is a nice thing I didn't even realize I had :) >> [...] >> Now, in my case, my backup server isn't running rsync as root, so I lose >> out on the -o and -D options as part of the archival process; but "-a" >> is a lot less typing than "-rlptg". > > Why is it not as root? Double checked, and it's not running the rsync daemon, it's just an SSH transfer. Unless, of course, I'm misinterpreting what the manpage means. -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEBcqaUD8uEzVNxUrujhHd8xJ5ooEFAlyPfVQACgkQjhHd8xJ5 ooF1SQf/QZiBSxLG4f3MVKBwwYEPhUg/FbfguvCSpsA3rIzytMmEJ8jln+Jl853U nysn2G3ugy8lDN6K/O2qkQBFlahOMk+S3dozYYvgEAIooTWg3s8vhjV+bPm1bNVU JDj3nkTkFSKF2XvD0GJTE9gEjQYseOj5z+XjTWPlJoO0MuZrROHOceOw2ppHCIQY FeTo5YyyVBI2x54P6EpYRZeWbRS6p6+gWdvI2KGUj2seSon4Y5L/xW2Fd4sZP+iQ 5bcGwVfK2O5t28UR+pfFwZ3TYSKifG24HXNqXETPhxptmwEqblZ8Lu91w5vQf3t9 tJYVOpLcVIg3JBDq2IQLg5EJFffXKA== =i8Rl -----END PGP SIGNATURE----- -- |_|O|_| |_|_|O| Github: https://github.com/dpurgert |O|O|O| PGP: 05CA 9A50 3F2E 1335 4DC5 4AEE 8E11 DDF3 1279 A281
[toc] | [prev] | [next] | [standalone]
| From | William Unruh <unruh@invalid.ca> |
|---|---|
| Date | 2019-03-18 16:40 +0000 |
| Message-ID | <q6ohl8$d92$1@dont-email.me> |
| In reply to | #54464 |
On 2019-03-18, Dan Purgert <dan@djph.net> wrote: > > William Unruh wrote: >> On 2019-03-15, Dan Purgert <dan@djph.net> wrote: >>> >>> >>> rsync -avP >> >> You might also want to use -H which preserves hard links. Say you have >> two files >> current >> sequence-10 >> hard linked together. And say that file is 10GB long. >> If you use your flags, you will have two copies, one in >> backup/.../current and one in backup/.../sequence-10. >> But if you use -H, then there will only be one copy and it will be hard >> linked in the backup to both backup/.../current and >> backup/..../sequence-10. > > Very good point. I don't have any hard-links in $HOME, so it's not > something that I've thought about. > >> >> YOu might also want to look at the sequential backup options. Thus if >> you make backups every night, and that 10GB file mentioned above does >> not change in weeks or months, then having a separate copy in each >> backup is pretty wasteful > > That's what the options I use do -- after the first run, only new / > changed things are transferred. However, I do admittedly "waste" a lot > of space on external drives with my monthly tarballs. > >> Look at the >> --link-dest=DIR >> Thus if tonights file is in backup6 and lastnights in backup5, >> rsync -avPH --link-dest=backup5 source backup6 >> will check in backup5 and if the file has not changed (mtime and size >> are the same in backup5 and in source) then it will hardlink backup6 u >> unchanged files to those in backup5 > > I obviously have a lot of reading ahead, to make things "better". You might want to look at rsnapshot which automates all that. > >> >> >> >>> >>> is good for interactive mode, and I like seeing the progress indicators >>> (as some of the files are large, and just sitting at "/path/to/something >>> [...]" for 10 minutes is a bit tedious. But that's me. >> >> -P also includes --partial, so if you interupt the transfer, the >> partially transfered file ( a . file) will be left >> If you just want to see the trasferes, do --progress instead of -P > > I completely misread that it did both. However, some of my source hosts > are wifi, so the --partial is a nice thing I didn't even realize I had >:) > >>> [...] >>> Now, in my case, my backup server isn't running rsync as root, so I lose >>> out on the -o and -D options as part of the archival process; but "-a" >>> is a lot less typing than "-rlptg". >> >> Why is it not as root? > > Double checked, and it's not running the rsync daemon, it's just an SSH > transfer. Unless, of course, I'm misinterpreting what the manpage > means. > > > >
[toc] | [prev] | [next] | [standalone]
| From | Dan Purgert <dan@djph.net> |
|---|---|
| Date | 2019-03-19 10:24 +0000 |
| Message-ID | <slrnq91gq7.n0k.dan@djph.net> |
| In reply to | #54475 |
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 William Unruh wrote: > On 2019-03-18, Dan Purgert <dan@djph.net> wrote: >> [...] >> I obviously have a lot of reading ahead, to make things "better". > > You might want to look at rsnapshot which automates all that. I might consider it -- but I already use rsync on everything, so it'd just be "revise the scripts". -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEBcqaUD8uEzVNxUrujhHd8xJ5ooEFAlyQw0cACgkQjhHd8xJ5 ooHg3Af/drgzKS1i4Gu2qBWXxNwszaQHHMKps9hHNY0J58DezPL4VrFbCioOZhRZ IwDBEx7yqL7ehjiQfRzvawCs9l7YrHrqTgDHbRSr+O7CmOwFFujurZ9I5CuAC++s 6N4Lp5eqz+10oeO5EyHQpkUge82a8et2oqKHvDpHXG2YePVzGw/g0kNpwrk/CS8Y EX1RTmux5QwHd+CQgg841HWoRb9VNuNaXgvVjhiqhaMyGUseoFNoO7czvH+r7rOp kH/0OE6WPIiuf8jyusrutNHVZXy05MMoGU4nw60I/OAHoAHSXpVRWbZAOjnvhADo 0VGbZcgHQy63GvtMNqarEYDrk7BFCg== =5HZO -----END PGP SIGNATURE----- -- |_|O|_| |_|_|O| Github: https://github.com/dpurgert |O|O|O| PGP: 05CA 9A50 3F2E 1335 4DC5 4AEE 8E11 DDF3 1279 A281
[toc] | [prev] | [next] | [standalone]
| From | Mike Easter <MikeE@ster.invalid> |
|---|---|
| Date | 2019-03-15 16:17 -0700 |
| Message-ID | <gf2q3gFfb54U1@mid.individual.net> |
| In reply to | #54449 |
Dan Purgert wrote: > In my experience, Debian-based distros don't tend to ship with rsync > installed; so we're just going to assume that no one ships with it. Very helpful tutorial. Mint 19 Cinnamon and MX 18 (xfce) live boot have rsync in the repos and installed by default. I think Timeshift uses rsync under the hood. -- Mike Easter
[toc] | [prev] | [next] | [standalone]
| From | jjb <invalid@invalid.nl> |
|---|---|
| Date | 2019-03-16 10:14 +0100 |
| Message-ID | <Oa-dnTXH9ZwUIxHBnZ2dnUU78eXNnZ2d@supernews.com> |
| In reply to | #54449 |
On 15.03.19 19:19, Dan Purgert wrote: > I know this comes up from time to time, and there are a bazillion > tutorials about it spread across the web, but it's been quiet in here > lately, and I just went through revamping my setup a few weeks ago. > Maybe someone will find it helpful. > > In my case, I'm running rsync v 3.1.1, protocol version 31 (Devuan > Jessie) on my backup server, and rsync v. 3.1.2 protocol version 31 on > the clients (MX Linux & Mint 18 in a VM for testing). As such, this'll > have a definite "Debian" slant to it, apologies in advance for any > RH-specific stuff wrong. ...snipped lots... I have a separate drive to put my backups on, and a perl script to (among other things) start the backup. My command: rsync -aAHXS --numeric-ids --exclude-from=/root/.backup/exclude.lst --link-dest=/dev/sdxn/regular/<yesterdays_date> / /dev/sdxn/regular/<todays_date>/ The exclude list contains things like /dev/***, /proc/***, /tmp/*** and such. Executes fast and takes little space after the first backup.
[toc] | [prev] | [next] | [standalone]
| From | Chris Elvidge <chris@mshome.net> |
|---|---|
| Date | 2019-03-16 09:26 +0000 |
| Message-ID | <q6ifgo$to9$1@dont-email.me> |
| In reply to | #54453 |
On 16/03/2019 09:14, jjb wrote: > On 15.03.19 19:19, Dan Purgert wrote: >> I know this comes up from time to time, and there are a bazillion >> tutorials about it spread across the web, but it's been quiet in here >> lately, and I just went through revamping my setup a few weeks ago. >> Maybe someone will find it helpful. >> >> In my case, I'm running rsync v 3.1.1, protocol version 31 (Devuan >> Jessie) on my backup server, and rsync v. 3.1.2 protocol version 31 on >> the clients (MX Linux & Mint 18 in a VM for testing). As such, this'll >> have a definite "Debian" slant to it, apologies in advance for any >> RH-specific stuff wrong. > ....snipped lots... > > I have a separate drive to put my backups on, and a perl script to > (among other things) start the backup. My command: > rsync -aAHXS --numeric-ids --exclude-from=/root/.backup/exclude.lst > --link-dest=/dev/sdxn/regular/<yesterdays_date> / > /dev/sdxn/regular/<todays_date>/ > > The exclude list contains things like /dev/***, /proc/***, /tmp/*** and > such. > Executes fast and takes little space after the first backup. > If you want to exclude things like /dev, /proc etc. try -x (--one-file-system). Also you don't need to specify /dev/***, just dev will work. -- Chris Elvidge, England
[toc] | [prev] | [next] | [standalone]
| From | William Unruh <unruh@invalid.ca> |
|---|---|
| Date | 2019-03-16 16:54 +0000 |
| Message-ID | <q6j9o1$8un$1@dont-email.me> |
| In reply to | #54453 |
On 2019-03-16, jjb <invalid@invalid.nl> wrote: > On 15.03.19 19:19, Dan Purgert wrote: >> I know this comes up from time to time, and there are a bazillion >> tutorials about it spread across the web, but it's been quiet in here >> lately, and I just went through revamping my setup a few weeks ago. >> Maybe someone will find it helpful. >> >> In my case, I'm running rsync v 3.1.1, protocol version 31 (Devuan >> Jessie) on my backup server, and rsync v. 3.1.2 protocol version 31 on >> the clients (MX Linux & Mint 18 in a VM for testing). As such, this'll >> have a definite "Debian" slant to it, apologies in advance for any >> RH-specific stuff wrong. > ...snipped lots... > > I have a separate drive to put my backups on, and a perl script to > (among other things) start the backup. My command: > rsync -aAHXS --numeric-ids --exclude-from=/root/.backup/exclude.lst > --link-dest=/dev/sdxn/regular/<yesterdays_date> / > /dev/sdxn/regular/<todays_date>/ The problem is that <yesterdays-date> may not exist, because for example, your computer went down during the time the backup was supposed to take place. That would mean there is no such directory and you will be transfering everything over again. Note that your idea is essentially what rsnapshot does. Iit simply numbers the backups, moves the backups up in number and copies from backup 1 to backup 0. > > The exclude list contains things like /dev/***, /proc/***, /tmp/*** and > such. > Executes fast and takes little space after the first backup.
[toc] | [prev] | [next] | [standalone]
| From | Richard Kettlewell <invalid@invalid.invalid> |
|---|---|
| Date | 2019-03-16 16:57 +0000 |
| Message-ID | <8736nmvjsu.fsf@LkoBDZeT.terraraq.uk> |
| In reply to | #54457 |
William Unruh <unruh@invalid.ca> writes: > On 2019-03-16, jjb <invalid@invalid.nl> wrote: >> I have a separate drive to put my backups on, and a perl script to >> (among other things) start the backup. My command: >> rsync -aAHXS --numeric-ids --exclude-from=/root/.backup/exclude.lst >> --link-dest=/dev/sdxn/regular/<yesterdays_date> / >> /dev/sdxn/regular/<todays_date>/ > > The problem is that <yesterdays-date> may not exist, because for > example, your computer went down during the time the backup was supposed > to take place. That would mean there is no such directory and you will > be transfering everything over again. Obviously you use the most recent complete backup as the --link-dest argument, rather than giving up if there happened not to be one yesterday. -- https://www.greenend.org.uk/rjk/
[toc] | [prev] | [next] | [standalone]
| From | Richard Kettlewell <invalid@invalid.invalid> |
|---|---|
| Date | 2019-03-16 11:06 +0000 |
| Message-ID | <87bm2bulia.fsf@LkoBDZeT.terraraq.uk> |
| In reply to | #54449 |
Dan Purgert <dan@djph.net> writes:
> === Option switches: ===
>
> This is always the part that trips me up -- there are just so many of
> them. What I have found is that for my needs, the quick and somewhat
> dirty command
>
> rsync -avP
>
> is good for interactive mode, and I like seeing the progress indicators
> (as some of the files are large, and just sitting at "/path/to/something
> [...]" for 10 minutes is a bit tedious. But that's me.
>
> In my backup scripts, I simply remove the "-P" switch, as I just like to
> see the filenames being transferred (and even that's probably a bit
> much)
>
>
> So, what do these switches mean?
>
> -v -> verbose. Prints the filenames as it's going, as well as some
> transfer details when the process is completed.
> -P -> same as "--progress". Prints progress of the transfer
> -a -> "archive" mode. Same as -rlptgoD
>
> -r -> recursively traverse directories
> -l -> copy symlinks as symlinks
> -p -> preserve permissions
> -t -> preserve mtime
> -g -> preserve group
> -o -> preserve owner (only works if remote rsync is running as
> super-user)
> -D -> same as --devices --specials
>
> --devices -> recreates block-devices at the remote end (only
> works if remote rsync is running as super-user)
> --specials -> recreates special files, such as named pipes and
> fifos.
You surely want at least the following as well:
-X, --xattrs preserve extended attributes
-A, --acls preserve ACLs (implies --perms)
...but watch out for some issues with Apple’s custom rsync, if you are
backing up macOS hosts.
For performance reasons you may want:
-S, --sparse handle sparse files efficiently
-z, --compress compress file data during the transfer
A slightly trickier question is:
--delete delete extraneous files from destination dirs
If you omit it, your backup will be inaccurate in the sense that it will
have extra files. But if you include it then your backup won’t keep
accidentally deleted files for long enough to recover, unless you notice
quickly.
The solution is to use --delete and make each backup to a separate,
timestamped directory, in which case you probably want:
-y, --fuzzy find similar file for basis if no dest file
--link-dest=DIR hardlink to files in DIR when unchanged
...with a recent complete backup as the link-dest directory.
This means you also need a strategy for pruning old backups.
My solution to all this is https://www.greenend.org.uk/rjk/rsbackup/.
--
https://www.greenend.org.uk/rjk/
[toc] | [prev] | [next] | [standalone]
| From | gazelle@shell.xmission.com (Kenny McCormack) |
|---|---|
| Date | 2019-03-17 12:52 +0000 |
| Message-ID | <q6lfu7$tfp$1@news.xmission.com> |
| In reply to | #54455 |
In article <87bm2bulia.fsf@LkoBDZeT.terraraq.uk>,
Richard Kettlewell <invalid@invalid.invalid> wrote:
...
>You surely want at least the following as well:
> -X, --xattrs preserve extended attributes
> -A, --acls preserve ACLs (implies --perms)
etc, etc, etc, etc...
This is why I don't like rsync. You have to have about a dozen (and that's
not much of an exaggeration!) command line options on it in order for it to
do anything useful. That, and the "directory name ending with / vs not
ending with a /" thingie (which always seems to trip me up) makes it
unusable for any kind of ad hoc use. Sure, you can figure it all out,
through lots of costly trial-and-error, and embed the command in a script,
and that's probably how most people use it, but that's not a good sign for
a program. Common under Unix, yes, I understand, but still not good.
I understand, of course, why it has to have 50 million options and why a
lot of them are needed for any kind of sensible day-to-day usage, but it
just shouldn't be that way. A program *should* be usable out-of-the-box,
with no (or almost no) options needing to be set (i.e., it should have
sensible defaults), but rsync just isn't like that.
For one just example, but probably the clearest: The fact that none of the
Unix "copy" commands default to preserving file access time/date. cp, scp,
rsync, etc - that all require you to specify an option (usually something
like "-p") to do this obvious and always-the-right-thing thing. This is
one thing that DOS/Windows got right - right from the start.
I've gotten to like "unison" for this sort of thing. It's still kind of a
bear to setup - but it makes more internal sense than rsync. It seems more
dedicated to doing the right thing without needing to be told every little
thing.
--
Nov 4, 2008 - the day when everything went
from being Clinton's fault to being Obama's fault.
[toc] | [prev] | [next] | [standalone]
| From | Allodoxaphobia <trepidation@example.net> |
|---|---|
| Date | 2019-03-17 17:32 +0000 |
| Message-ID | <slrnq8t14u.14ot.trepidation@vps.jonz.net> |
| In reply to | #54462 |
On Sun, 17 Mar 2019 12:52:24 -0000 (UTC), Kenny McCormack wrote: > In article <87bm2bulia.fsf@LkoBDZeT.terraraq.uk>, > Richard Kettlewell <invalid@invalid.invalid> wrote: > ... >>You surely want at least the following as well: >> -X, --xattrs preserve extended attributes >> -A, --acls preserve ACLs (implies --perms) > > etc, etc, etc, etc... > > This is why I don't like rsync. You have to have about a dozen (and that's > not much of an exaggeration!) command line options on it in order for it to > do anything useful. That, and the "directory name ending with / vs not > ending with a /" thingie (which always seems to trip me up) makes it > unusable for any kind of ad hoc use. Sure, you can figure it all out, > through lots of costly trial-and-error, and embed the command in a script, > and that's probably how most people use it, but that's not a good sign for > a program. Common under Unix, yes, I understand, but still not good. > > I understand, of course, why it has to have 50 million options and why a > lot of them are needed for any kind of sensible day-to-day usage, but it > just shouldn't be that way. A program *should* be usable out-of-the-box, > with no (or almost no) options needing to be set (i.e., it should have > sensible defaults), but rsync just isn't like that. man alias
[toc] | [prev] | [next] | [standalone]
| From | Java Jive <java@evij.com.invalid> |
|---|---|
| Date | 2019-03-18 12:29 +0000 |
| Message-ID | <q6o2vc$ieb$1@gioia.aioe.org> |
| In reply to | #54462 |
On 17/03/2019 12:52, Kenny McCormack wrote:
> In article <87bm2bulia.fsf@LkoBDZeT.terraraq.uk>,
> Richard Kettlewell <invalid@invalid.invalid> wrote:
> ...
>> You surely want at least the following as well:
>> -X, --xattrs preserve extended attributes
>> -A, --acls preserve ACLs (implies --perms)
>
> etc, etc, etc, etc...
>
> This is why I don't like rsync. You have to have about a dozen (and that's
> not much of an exaggeration!) command line options on it in order for it to
> do anything useful. That, and the "directory name ending with / vs not
> ending with a /" thingie (which always seems to trip me up) makes it
> unusable for any kind of ad hoc use. Sure, you can figure it all out,
> through lots of costly trial-and-error, and embed the command in a script,
> and that's probably how most people use it, but that's not a good sign for
> a program. Common under Unix, yes, I understand, but still not good.
The point you make is valid, the defaults aren't very sensible. The way
I get over that is to create an environment variable on every Linux
machine that I have:
RSYNC_OPTS='-Drltuogpv'
Then it's just ...
rsync ${RSYNC_OPTS} <source-dir>/ <dest-dir>/
... and you can add extra options such as -n (dummy run) in the normal
way ...
rsync ${RSYNC_OPTS}n <source-dir>/ <dest-dir>/
... or ...
rsync ${RSYNC_OPTS} -n <source-dir>/ <dest-dir>/
> I understand, of course, why it has to have 50 million options and why a
> lot of them are needed for any kind of sensible day-to-day usage, but it
> just shouldn't be that way. A program *should* be usable out-of-the-box,
> with no (or almost no) options needing to be set (i.e., it should have
> sensible defaults), but rsync just isn't like that.
>
> For one just example, but probably the clearest: The fact that none of the
> Unix "copy" commands default to preserving file access time/date. cp, scp,
> rsync, etc - that all require you to specify an option (usually something
> like "-p") to do this obvious and always-the-right-thing thing. This is
> one thing that DOS/Windows got right - right from the start.
Well, not really, as anyone who ever tried to copy a binary file without
remembering to use the /B switch will tell you. The default mode of
COPY was ASCII or text mode, as if the /A switch had been specified, so
if the binary file happened to contain a byte value 0x1A - <ctrl-Z>,
commonly used as to mark the end of a text file - the copy would be
truncated at that point. I've been caught out by this comparatively
recently, copying an audio file using a command prompt in W7.
[toc] | [prev] | [next] | [standalone]
| From | gazelle@shell.xmission.com (Kenny McCormack) |
|---|---|
| Date | 2019-03-18 16:32 +0000 |
| Subject | DOS/Windows "COPY" command (Was: Remote backups with rsync - discussion / tutorial, I guess.) |
| Message-ID | <q6oh6k$icd$1@news.xmission.com> |
| In reply to | #54469 |
In article <q6o2vc$ieb$1@gioia.aioe.org>, Java Jive <java@evij.com.invalid> wrote: ... >The point you make is valid, the defaults aren't very sensible. Thanks for that. >The way I get over that is to create an environment variable on every >Linux machine that I have: > RSYNC_OPTS='-Drltuogpv' Yeah, but that's just confirming my point. The fact that you needed to figure all of those options out confirms exactly the point - which is that you need to learn a lot in order to use rsync outside of scripts. As I said, "unison" has more internal logic. It's a lot more designed on the basis of "This is how it should work; and by default it does", rather than "Here's a million possible ways to use this tool; every user is given the freedom to work out which 2 or 3 of those million possibilities is actually useful for himself". >> For one just example, but probably the clearest: The fact that none of the >> Unix "copy" commands default to preserving file access time/date. cp, scp, >> rsync, etc - that all require you to specify an option (usually something >> like "-p") to do this obvious and always-the-right-thing thing. This is >> one thing that DOS/Windows got right - right from the start. > >Well, not really, as anyone who ever tried to copy a binary file without >remembering to use the /B switch will tell you. The default mode of >COPY was ASCII or text mode, as if the /A switch had been specified, so >if the binary file happened to contain a byte value 0x1A - <ctrl-Z>, >commonly used as to mark the end of a text file - the copy would be >truncated at that point. I've been caught out by this comparatively >recently, copying an audio file using a command prompt in W7. Totally off-topic. I was talking specifically about preserving file timestamps. That's the part that they clearly got right, vs. their Unix counterparts. But what you say isn't true anyway - for the most part. COPY has always defaulted to binary mode except in certain, obscure cases. The problem, of course, is that every once in a while you get bitten by one of these obscure cases. The one that always got me was that COPY has a mode that can be used to append files together (using a list of filenames separated by + characters). The problem was that, for some reason, using this functionality pushed it into ASCII mode - with the expected catastrophic results. The way it should have been designed is that it is *always* binary unless there is an explicit /A switch present. This problem (with concatenating files) led me to write my own CONCAT program for DOS (a few million years ago). -- A pervert, a racist, and a con man walk into a bar... Bartender says, "What will you have, Donald!"
[toc] | [prev] | [next] | [standalone]
| From | Java Jive <java@evij.com.invalid> |
|---|---|
| Date | 2019-03-18 16:40 +0000 |
| Subject | Re: DOS/Windows "COPY" command (Was: Remote backups with rsync - discussion / tutorial, I guess.) |
| Message-ID | <q6ohl4$pi9$1@gioia.aioe.org> |
| In reply to | #54473 |
On 18/03/2019 16:32, Kenny McCormack wrote: > In article <q6o2vc$ieb$1@gioia.aioe.org>, > Java Jive <java@evij.com.invalid> wrote: > ... >> The point you make is valid, the defaults aren't very sensible. > > Thanks for that. > >> The way I get over that is to create an environment variable on every >> Linux machine that I have: >> RSYNC_OPTS='-Drltuogpv' > > Yeah, but that's just confirming my point. Having just agreed with your point, I wasn't trying to dispute it, I was merely pointing out a way to get around the problem. If you don't want to use it, you don't have to, but someone reading the thread might find the idea useful. >>> For one just example, but probably the clearest: The fact that none of the >>> Unix "copy" commands default to preserving file access time/date. cp, scp, >>> rsync, etc - that all require you to specify an option (usually something >>> like "-p") to do this obvious and always-the-right-thing thing. This is >>> one thing that DOS/Windows got right - right from the start. >> >> Well, not really, as anyone who ever tried to copy a binary file without >> remembering to use the /B switch will tell you. The default mode of >> COPY was ASCII or text mode, as if the /A switch had been specified, so >> if the binary file happened to contain a byte value 0x1A - <ctrl-Z>, >> commonly used as to mark the end of a text file - the copy would be >> truncated at that point. I've been caught out by this comparatively >> recently, copying an audio file using a command prompt in W7. > > Totally off-topic. I was talking specifically about preserving file > timestamps. But also more generally about the commands having useful defaults. My example showed that the latter is not true. > But what you say isn't true anyway - for the most part. COPY has always > defaulted to binary mode except in certain, obscure cases. The problem, of > course, is that every once in a while you get bitten by one of these obscure > cases. The one that always got me was that COPY has a mode that can be > used to append files together (using a list of filenames separated by + > characters). The problem was that, for some reason, using this functionality > pushed it into ASCII mode - with the expected catastrophic results. Thank you for proving my point, while pretending to disprove it! > The way it should have been designed is that it is *always* binary unless > there is an explicit /A switch present. Agreed, but my point was that is not what happened.
[toc] | [prev] | [next] | [standalone]
| From | "R.Wieser" <address@not.available> |
|---|---|
| Date | 2019-03-18 17:59 +0100 |
| Subject | Re: DOS/Windows "COPY" command (Was: Remote backups with rsync - discussion / tutorial, I guess.) |
| Message-ID | <q6oipg$us3$1@gioia.aioe.org> |
| In reply to | #54473 |
Keny, > The way it should have been designed is that it is *always* > binary unless there is an explicit /A switch present. :-) You are looking at it from just your POV: there are not many circumstances where you c|would append two binaries and get a usefull result. Combining a number of DOS textfiles into a single one however /always/ gives a readable result. By the way, did you know that you can also wildcard the sourcefiles copying to a single one and get the same (ASCII) addition result ? > This problem (with concatenating files) led me to write my own > CONCAT program for DOS (a few million years ago). My own pet peve was switching to a directory on another partition always needing two seperate commands. So I made GD (GoDirectory). It shows a 1994 date. Still have and use it by the way. :-) Regards, Rudy Wieser
[toc] | [prev] | [next] | [standalone]
| From | Adrian Caspersz <email@here.invalid> |
|---|---|
| Date | 2019-03-18 17:51 +0000 |
| Subject | Re: DOS/Windows "COPY" command (Was: Remote backups with rsync - discussion / tutorial, I guess.) |
| Message-ID | <gfa45dF332nU1@mid.individual.net> |
| In reply to | #54477 |
On 18/03/2019 16:59, R.Wieser wrote: > > My own pet peve was switching to a directory on another partition always > needing two seperate commands. So I made GD (GoDirectory). It shows a 1994 > date. Still have and use it by the way. :-) > cd /D d:\somewhere -- Adrian C
[toc] | [prev] | [next] | [standalone]
| From | "R.Wieser" <address@not.available> |
|---|---|
| Date | 2019-03-18 19:00 +0100 |
| Subject | Re: DOS/Windows "COPY" command (Was: Remote backups with rsync - discussion / tutorial, I guess.) |
| Message-ID | <q6ome0$1gjl$1@gioia.aioe.org> |
| In reply to | #54479 |
Adrian, > cd /D d:\somewhere That might work now, but surely didn't when I wrote that "gd" . :-) Regards, Rudy Wieser
[toc] | [prev] | [next] | [standalone]
| From | "Carlos E.R." <robin_listas@es.invalid> |
|---|---|
| Date | 2019-03-18 20:16 +0100 |
| Subject | Re: DOS/Windows "COPY" command (Was: Remote backups with rsync - discussion / tutorial, I guess.) |
| Message-ID | <id75mf-5cs.ln1@Telcontar.valinor> |
| In reply to | #54473 |
On 18/03/2019 17.32, Kenny McCormack wrote: > In article <q6o2vc$ieb$1@gioia.aioe.org>, > Java Jive <java@evij.com.invalid> wrote: > ... >> The point you make is valid, the defaults aren't very sensible. > > Thanks for that. > >> The way I get over that is to create an environment variable on every >> Linux machine that I have: >> RSYNC_OPTS='-Drltuogpv' > > Yeah, but that's just confirming my point. The fact that you needed to > figure all of those options out confirms exactly the point - which is that > you need to learn a lot in order to use rsync outside of scripts. > > As I said, "unison" has more internal logic. It's a lot more designed on > the basis of "This is how it should work; and by default it does", rather > than "Here's a million possible ways to use this tool; every user is given > the freedom to work out which 2 or 3 of those million possibilities is > actually useful for himself". But "unison" is a GUI, while "rsync" is a "CLI". The assumptions are different. Also, "unison" purpose is different. It does not copy always from source to destination: depending, it will copy in reverse direction. It is not intended for backup. Finally, if you read its documentation, it also has tons of switches plus a configuration file. -- Cheers, Carlos.
[toc] | [prev] | [next] | [standalone]
Page 1 of 5 [1] 2 3 4 5 Next page →
Back to top | Article view | alt.os.linux
csiph-web