[OpenAFS] 'vos backup' would create a file bigger than 2Gb

Charles Clancy security@xauth.net
Fri, 24 May 2002 00:56:37 -0500 (CDT)


> I'm runing Debian GNU/Linux on a  i386, and when backing up MY volume,
> vos fails to create the full backup, because there's a 2Gb limit...
>
> Is there any way to specify that we should write the dump in chunks?

You can't dump in chunks, but you might try something like:
To Backup:
$ vos dump root.cell | gzip > root-cell-backup.gz
To Restore:
$ gunzip -c root-cell-backup.gz | vos restore server vicepX root.cell

Or try using the little C program (see below) I whipped up that saves
STDIN into multiple files with a maximum size:
To Backup:
$ vos dump root.cell | ./break root-cell-backup
To Restore:
$ ls root-cell-backup.* | cut -f 2 -d "." | sort -n | xargs -i[] cat \
  root-cell-backup.[] | vos restore server vicepX root.cell

[  t charles clancy  ]-[  tclancy@uiuc.edu  ]-[  uiuc.edu/~tclancy  ]


----- break.c -----
#include<stdio.h>

/* This program was written in about 5 minutes
   and probably sucks.  You might want to add
   some very basic error and bounds checking.  */

#define MAXSIZE 2000000000

int main(int argc, char **argv) {

        long c=0, e=1;
        FILE *f;
        char fn[200], t;

        if (argc!=2) {
                printf("usage: %s outfile-base\n",argv[0]);
                exit(1);
        }

        sprintf(fn,"%s.%d",argv[1],e);
        f=fopen(fn,"wb");
        while (!feof(stdin)) {
                if (c++ > MAXSIZE) {
                        c=0; e++;
                        fclose(f);
                        sprintf(fn,"%s.%d",argv[1],e);
                        f=fopen(fn,"wb");
                }
                t=fgetc(stdin);
                if (!feof(stdin)) fprintf(f,"%c",t);
        }
        fclose(f);
	return 0;
}