Michael Zimmermann
2002-Apr-02 02:14 UTC
Handling of backup files - two new features proposed
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Dear list members, there are two new rsync-features I made up and would like to discuss with you. If you think these new features might be useful for the whole rsync-community, please give me a note and I'll send you the patches (or post them here). 1.) Setting owner and/or group of backup files. In our servers I'm using rsync to backup to a hot standby machine. The users have access to this backup-server too, so that they can retrieve older versions of their files. At the same time the backup copies should not count in the user's quota (and/or should only be deletable by root or a special group-admin). To accomplish this, the backup files get their user and/or group set to a special user and/or group in our local version of rsync. Two new options control this behaviour --backup-owner=USER --backup-group=GROUP 2.) Adding a non-default suffix to backup-files in the backup-directory too I'm not sure, wether this might be really useful but it was one of the solutions for our backup-requirements which I was trying out. The idea was to put the backup-directory onto another disc (with different quotas and read-only access) and at the same time give the user access to more than one backup-version of his files within his subtree-structure. This would be done by setting --suffix to (say) the date and time of the backup. The behaviour change to rsync is: --suffix is added to the backup-files in the backup directory too, if both are given and the suffix is not equal to the default-suffix (or the --suffix option is specified after the --backup-dir option). Perhaps different environments need different solutions, hence I propose to implement both features. Highly interested in your comments. Greetings Michael - -- Michael Zimmermann (Vegaa Safety and Security for Internet Services) <zim@vegaa.de> phone +49 89 6283 7632 hotline +49 163 823 1195 Key fingerprint = 1E47 7B99 A9D3 698D 7E35 9BB5 EF6B EEDB 696D 5811 -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.6 (GNU/Linux) Comment: For info see http://www.gnupg.org iD8DBQE8qId972vu22ltWBERAtqcAJ4hFG1yuksnwitfyI54ipSbShYXUgCeNQAV XtLc9GQuDcYIoJdgUSnwbkE=P7uG -----END PGP SIGNATURE-----
On Mon, Apr 01, 2002 at 06:14:38PM +0200, Michael Zimmermann wrote:> Dear list members, > > there are two new rsync-features I made up and would like to discuss with you. > > If you think these new features might be useful for the whole rsync-community, > please give me a note and I'll send you the patches (or post them here). > > > > 1.) Setting owner and/or group of backup files. > > In our servers I'm using rsync to backup to a hot standby machine. > The users have access to this backup-server too, so that they > can retrieve older versions of their files. At the same time the backup > copies should not count in the user's quota (and/or should only > be deletable by root or a special group-admin). > > To accomplish this, the backup files get their user and/or group set to > a special user and/or group in our local version of rsync. > > Two new options control this behaviour > > --backup-owner=USER > --backup-group=GROUPI don't like that; I think it is too special purpose. Can't you follow up the rsync with a find/chown?> 2.) Adding a non-default suffix to backup-files in the backup-directory too > > I'm not sure, wether this might be really useful but it was one of the > solutions for our backup-requirements which I was trying out. > > The idea was to put the backup-directory onto another disc (with > different quotas and read-only access) and at the same time give > the user access to more than one backup-version of his files within > his subtree-structure. This would be done by setting --suffix to (say) > the date and time of the backup. > > The behaviour change to rsync is: > > --suffix is added to the backup-files in the backup directory too, > if both are given and the suffix is not equal to the default-suffix > (or the --suffix option is specified after the --backup-dir option).That sounds like a fine idea to me.> Perhaps different environments need different solutions, hence I > propose to implement both features. > > Highly interested in your comments.- Dave Dykstra
Why go through the trouble to nullify the --suffix option when --backup-dir is specified? I think it would be better to allow them to come in either order anyway. - Dave Dykstra On Fri, Apr 26, 2002 at 01:52:24AM +0200, Michael Zimmermann wrote:> -----BEGIN PGP SIGNED MESSAGE----- > Hash: SHA1 > > At Thursday 25 April 2002 23:47 Dave Dykstra wrote: > > > [about proposing two new options] > > > --backup-owner=USER > > > --backup-group=GROUP > > > > I don't like that; I think it is too special purpose. Can't you follow > > up the rsync with a find/chown? > > Yes, I agree. I was too fixed to the idea of preserving the user's > quotas all the time. > > > > > [about Adding a non-default suffix to backup-files in the backup-directory] > > > > That sounds like a fine idea to me. > > If you want to include it, I've added a patch against the current version - > just as I would do the changes. > > > Greetings > Michael > - -- > Michael Zimmermann (Vegaa Safety and Security for Internet Services) > <zim@vegaa.de> phone +49 89 6283 7632 hotline +49 163 823 1195 > Key fingerprint = 1E47 7B99 A9D3 698D 7E35 9BB5 EF6B EEDB 696D 5811 > > > > - --------------------------- snip ------------------------------- > diff -u rsync/backup.c rsync.dev/backup.c > - --- rsync/backup.c Fri Apr 26 00:51:18 2002 > +++ rsync.dev/backup.c Fri Apr 26 01:03:39 2002 > @@ -203,12 +203,12 @@ > if (!file) return 1; > > /* make a complete pathname for backup file */ > - - if (strlen(backup_dir) + strlen(fname) > (MAXPATHLEN - 1)) { > + if (strlen(backup_dir) + strlen(fname) + strlen(backup_suffix) > (MAXPATHLEN - 1)) { > rprintf (FERROR, "keep_backup filename too long\n"); > return 0; > } > > - - snprintf(keep_name, sizeof (keep_name), "%s/%s", backup_dir, fname); > + snprintf(keep_name, sizeof (keep_name), "%s/%s%s", backup_dir, fname, backup_suffix); > > > #ifdef HAVE_MKNOD > diff -u rsync/options.c rsync.dev/options.c > - --- rsync/options.c Fri Apr 26 00:52:15 2002 > +++ rsync.dev/options.c Fri Apr 26 01:37:09 2002 > @@ -361,7 +361,7 @@ > {"log-format", 0, POPT_ARG_STRING, &log_format , 0, 0, 0 }, > {"bwlimit", 0, POPT_ARG_INT, &bwlimit , 0, 0, 0 }, > {"address", 0, POPT_ARG_STRING, &bind_address, 0, 0, 0 }, > - - {"backup-dir", 0, POPT_ARG_STRING, &backup_dir , 0, 0, 0 }, > + {"backup-dir", 0, POPT_ARG_STRING, &backup_dir , OPT_BACKUP_DIR, 0, 0 }, > {"hard-links", 'H', POPT_ARG_NONE, &preserve_hard_links , 0, 0, 0 }, > {"read-batch", 0, POPT_ARG_STRING, &batch_prefix, OPT_READ_BATCH, 0, 0 }, > {"write-batch", 0, POPT_ARG_STRING, &batch_prefix, OPT_WRITE_BATCH, 0, 0 }, > @@ -470,6 +470,13 @@ > print_rsync_version(FINFO); > exit_cleanup(0); > > + case OPT_BACKUP_DIR: > + /* Using backup-directory nullifies > + a default backup-suffix */ > + if (strcmp(backup_suffix,BACKUP_SUFFIX) == 0) > + backup_suffix = ""; > + break; > + > case OPT_MODIFY_WINDOW: > /* The value has already been set by popt, but > * we need to remember that we're using a > diff -u rsync/rsync.1 rsync.dev/rsync.1 > - --- rsync/rsync.1 Fri Apr 26 00:52:44 2002 > +++ rsync.dev/rsync.1 Fri Apr 26 01:45:56 2002 > @@ -428,11 +428,18 @@ > .IP "\fB--backup-dir=DIR\fP" > In combination with the --backup option, this > tells rsync to store all backups in the specified directory\&. This is > - -very useful for incremental backups\&. > +very useful for incremental backups\&. You can additionally > +specify a backup suffix using the --suffix option > +(otherwise the files backed up in the specified directory > +will keep their original filenames)\&. If the default suffix should > +be used in this case, the --suffix=~ parameter must be given explicitly > +after the --backup-dir parameter on the command line\&. > .IP > .IP "\fB--suffix=SUFFIX\fP" > This option allows you to override the default > backup suffix used with the -b option\&. The default is a ~\&. > +If --backup-dir and --suffix are both specified, > +the SUFFIX is appended to the filename even in the backup directory. > .IP > .IP "\fB-u, --update\fP" > This forces rsync to skip any files for which the > - --------------------------- snip ------------------------------- > -----BEGIN PGP SIGNATURE----- > Version: GnuPG v1.0.6 (GNU/Linux) > Comment: For info see http://www.gnupg.org > > iD8DBQE8yJa472vu22ltWBERAvOIAJ9crT1Nt5qQWUJWMclVM2UVgghlqACfS/pK > Ya55fnKf2sA9mBctC32IDHA> =c9MR > -----END PGP SIGNATURE----- > >