yadayada / acd_cli

An unmaintained command line interface and FUSE filesystem for Amazon (Cloud) Drive
Other
1.35k stars 166 forks source link

borgbackup on acd_cli #377

Open ink0gnito opened 8 years ago

ink0gnito commented 8 years ago

I want to use borgbackup in connection with acd_cli. acd is mounted. When i do an "borg init /mnt/acd/borg" i got this error:

borg init /mnt/acd/borg/ Enter new passphrase: Enter same passphrase again: Do you want your passphrase to be displayed for verification? [yN]: N Local Exception. Traceback (most recent call last): File "borg/archiver.py", line 1660, in main File "borg/archiver.py", line 1597, in run File "borg/archiver.py", line 85, in wrapper File "borg/archiver.py", line 132, in do_init File "borg/repository.py", line 200, in commit File "borg/repository.py", line 251, in write_index TypeError: %d format: a number is required, not NoneType

Platform: Linux hubic 3.16.0-4-amd64 #1 SMP Debian 3.16.7-ckt25-2+deb8u3 (2016-07-02) x86_64 Linux: debian 8.5 Borg: 1.0.7rc1 Python: CPython 3.5.2 PID: 1628 CWD: /mnt/acd sys.argv: ['borg', 'init', '/mnt/acd/borg/'] SSH_ORIGINAL_COMMAND: None

I can not create an backup on the mounted acd.

ThomasWaldmann commented 8 years ago

Hi (borgbackup developer here) - I am adding some more details:

The TypeError due to "None" encountered there usually can not happen (in more recent code, we emit an AssertionError if the value is None and not an integer number).

It is None for acd FUSE because borg has written a commit tag into the repository (and even fsynced the file - we make very sure that stuff hits the disk in right order so our transactional system works) and short afterwards wanted to read it back, but it was not there!

So, we have a consistency problem here. acd FUSE is not letting the application see data that was written by it short before.

bgemmill commented 8 years ago

I just pushed a fix to #374 that addressed this same issue for duplicity.

henfri commented 8 years ago

So, is borg Backup running Well for you after that fix?

michaelotto commented 8 years ago

That fix is not pushed to 0.3.2, is it? (I'm interested, too)

bgemmill commented 8 years ago

@henfri @michaelotto I'm pretty sure that my changes didn't make it into 3.2 yet; it looks like @yadayada has them in a dev branch at the moment.

I just committed another change that allows borg to work on my master branch.

michaelotto commented 8 years ago

@bgemmill I cloned your fork, but without success ("Mammut" is the hostname of my server):

borg init -e keyfile /mnt/amzn/Borg-Backup
Enter new passphrase: 
Enter same passphrase again: 
Do you want your passphrase to be displayed for verification? [yN]: n
Exception ignored in: <bound method Repository.__del__ of <Repository /mnt/amzn/Borg-Backup>>
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/borg/repository.py", line 70, in __del__
    self.close()
  File "/usr/lib/python3/dist-packages/borg/repository.py", line 179, in close
    self.lock.release()
  File "/usr/lib/python3/dist-packages/borg/locking.py", line 291, in release
    self._roster.modify(EXCLUSIVE, REMOVE)
  File "/usr/lib/python3/dist-packages/borg/locking.py", line 211, in modify
    elements.remove(self.id)
KeyError: (('Mammut', 5839, 0),)
Local Exception.
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/borg/archiver.py", line 1498, in main
    exit_code = archiver.run(args)
  File "/usr/lib/python3/dist-packages/borg/archiver.py", line 1452, in run
    return args.func(args)
  File "/usr/lib/python3/dist-packages/borg/archiver.py", line 80, in wrapper
    return method(self, args, repository=repository, **kwargs)
  File "/usr/lib/python3/dist-packages/borg/repository.py", line 86, in __exit__
    self.close()
  File "/usr/lib/python3/dist-packages/borg/repository.py", line 179, in close
    self.lock.release()
  File "/usr/lib/python3/dist-packages/borg/locking.py", line 291, in release
    self._roster.modify(EXCLUSIVE, REMOVE)
  File "/usr/lib/python3/dist-packages/borg/locking.py", line 215, in modify
    self.save(roster)
  File "/usr/lib/python3/dist-packages/borg/locking.py", line 189, in save
    with open(self.path, "w") as f:
OSError: [Errno 14] Bad address: '/mnt/amzn/Borg-Backup/lock.roster'

(I cannot open Issues on your fork, so I put it here)

bgemmill commented 8 years ago

@michaelotto This works for me with borg 1.07, a clean acd root, and all acdcli caches deleted before beginning.

The part about nodes.db is because there's not yet a good migration for the properties table that my branch introduced; bgemmill/acdcli needs to have a fresh sync to get that started.

Is that what you're doing?

michaelotto commented 8 years ago

Ok, clearing the stuff under ~/.cache/acd_cli did it for me. Will check it out, thanks very much!

bgemmill commented 8 years ago

After the retry work on my branch, I can get borg to work overnight most of the time. Sometimes I'll wake up and it'll be hung on something, although 'borg --debug' doesn't always reveal what happened.

@ThomasWaldmann is there an even more verbose setting lurking somewhere? I'd be happy tuning up acdcli on this end to make borg just work.

ThomasWaldmann commented 8 years ago

@bgemmill no, borg ... --debug is the most verbose it gets. In 1.0, there isn't much debug output additionally to what you get for --info. You can also use strace in some cases maybe.

alexreg commented 8 years ago

Any progress on this yet, from people testing out acd_cli with borg?

bgemmill commented 8 years ago

@alexreg it runs and finishes with my branch, but I haven't tested data integrity or completeness yet.

michaelotto commented 8 years ago

It works in principle, but network problems make the backup process break, so I'm uncertain about the consistency of the backup created.

The method I'm using now is to backup to an external drive and rclone the repository to ACD.

If you want to restore, you can mount the remote ACD repository with acd_cli, so you don't have to download the complete backup from ACD! As this only reads from ACD, I don't see any consistency problems. Works fine for me!

bgemmill commented 8 years ago

@michaelotto do you still see these network problems when you're on my branch? I've added a number of retry codes for when amazon gets grumpy, and if I'm missing any I'd be interested in what you found.

michaelotto commented 8 years ago

I will try again in a week or so (I'm currently uploading a couple hundred gigabytes to ACD :-))

michaelotto commented 8 years ago

So, now I tried again and it failed after 13 minutes. I have the current version of bgemmill's fork.

Local Exception.
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/borg/archiver.py", line 1684, in main
    exit_code = archiver.run(args)
  File "/usr/lib/python3/dist-packages/borg/archiver.py", line 1621, in run
    return args.func(args)
  File "/usr/lib/python3/dist-packages/borg/archiver.py", line 85, in wrapper
    return method(self, args, repository=repository, **kwargs)
  File "/usr/lib/python3/dist-packages/borg/archiver.py", line 249, in do_create
    create_inner(archive, cache)
  File "/usr/lib/python3/dist-packages/borg/archiver.py", line 223, in create_inner
    read_special=args.read_special, dry_run=dry_run)
  File "/usr/lib/python3/dist-packages/borg/archiver.py", line 303, in _process
    read_special=read_special, dry_run=dry_run)
  File "/usr/lib/python3/dist-packages/borg/archiver.py", line 277, in _process
    status = archive.process_file(path, st, cache, self.ignore_inode)
  File "/usr/lib/python3/dist-packages/borg/archive.py", line 683, in process_file
    chunks.append(cache.add_chunk(self.key.id_hash(chunk), chunk, self.stats))
  File "/usr/lib/python3/dist-packages/borg/cache.py", line 371, in add_chunk
    self.repository.put(id, data, wait=False)
  File "/usr/lib/python3/dist-packages/borg/repository.py", line 535, in put
    segment, offset = self.io.write_put(id, data)
  File "/usr/lib/python3/dist-packages/borg/repository.py", line 784, in write_put
    fd = self.get_write_fd(raise_full=raise_full)
  File "/usr/lib/python3/dist-packages/borg/repository.py", line 669, in get_write_fd
    self._write_fd = open(self.segment_filename(self.segment), 'ab')
TimeoutError: [Errno 110] Connection timed out: '/mnt/amzn/Borg-Test/data/0/59'

Platform: Linux Mammut 4.4.0-38-generic #57-Ubuntu SMP Tue Sep 6 15:42:33 UTC 2016 x86_64 x86_64
Linux: Ubuntu 16.04 xenial
Borg: 1.0.7  Python: CPython 3.5.2
PID: 49734  CWD: ...
sys.argv: ['/usr/bin/borg', 'create', '-v', '--list', '--filter', 'AME', '--stats', '/mnt/amzn/Borg-Test::Test1', '...']
SSH_ORIGINAL_COMMAND: None
bgemmill commented 8 years ago

What did the acd log say?

michaelotto commented 8 years ago

It looks like the usual blah blah, no messages on ERROR, WARNING or CRITICAL level. The last lines are

16-10-04 21:36:58.952 [INFO] [requests.packages.urllib3.connectionpool] - Starting new HTTPS connection (1): cdws.us-east-1.amazonaws.com
16-10-04 21:36:59.492 [DEBUG] [requests.packages.urllib3.connectionpool] - "POST /drive/v1/changes HTTP/1.1" 200 None
16-10-04 21:36:59.493 [DEBUG] [acdcli.api.backoff_req] - x-amzn-RequestId: ...
16-10-04 21:36:59.494 [DEBUG] [acdcli.api.metadata] - Checkpoint: ...
16-10-04 21:36:59.506 [INFO] [acdcli.cache.sync] - Inserted/updated 2 folder(s).
16-10-04 21:36:59.541 [INFO] [acdcli.cache.sync] - Parented 2 node(s).
16-10-04 21:36:59.541 [INFO] [acdcli.cache.sync] - Applied properties to 2 node(s).
16-10-04 21:36:59.551 [INFO] [acdcli.api.metadata] - 1 page(s) in changes.