[cs615asa] [git commit] CS615 EBS-BACKUP; backup a directory into Elastic Block Storage (EBS) branch main updated. 4a8ed3e0ab073ee057404a0dcb6665ce2929ea52

Jan Schaumann jschauma at stevens.edu
Wed Apr 14 21:24:31 EDT 2021


Git Owner <jschauma at stevens.edu> wrote:
> +
> +  # TODO: remove this when done w/ development
> +  parser.add_argument(
> +      '-i',
> +      metavar='instance-id',
> +      type=str,
> +      help='FOR DEBUGGING PURPOSES: Use this existing ec2 instance rather than creating a new one. \
> +           If set, will not shutdown/terminate afterwards.',

That seems to me like a reasonable extension of the
program.  If you like, you can make this a permanent
option if you add it to the manual page.

However, note that this introduces a number of
assumptions about the OS version and type, how the
disks are named, etc.

> +    subprocess.Popen('scp -v -o StrictHostKeyChecking=no {key} {dir}.tar {user}@{host}:/tmp/'.format(
> +        user=user, host=host, dir=_dir, key=KEY_FLAGS
>      ).split(' '))

Be careful here -- we do _not_ want to write a tar
file to the filesystem on the remote side at all. (The
data you need to write might be signifacntly larger
than the filesystem under /tmp on the instance, for
example.)

You also do not want to create a file on the local
filesystem: if you back up the entire file system
(i.e., "/"), you can't write data locally to that
directory while you're backing it up.

Rather than using

tar cf local.tar dir && scp local.tar remote:/tmp/file.tar

you really want

tar cf - dir | ssh remote "dd of=/dev/device"

-Jan


More information about the cs615asa mailing list