cloudrkt / lxdbackup Goto Github PK
View Code? Open in Web Editor NEWA script to backup lxc containers managed with LXD.
A script to backup lxc containers managed with LXD.
I got the following error while executing the script:
2021/05/02 10:18:37 NOTICE: Config file "/root/.config/rclone/rclone.conf" not found - using defaults
2021/05/02 10:18:37 Failed to create file system for ":lxdbackup": config name needs a trailing :
Target directory: Could not create the :lxdbackup directory
My rclone is in: /home/simon/.config/rclone/rclone.conf
In the script, I could not find where to change that directory. Can someone please help me to resolve this?
In rclone, I set a local path (external hdd) to save the backups.
Hi,
I'm trying to use this script, the content seems very straightforward. But unfortunately I'm getting an error while transferring the image to an object storage. I'm able to copy the archive manually with the rclone copy command. But the script seems to be having problems handling the rclone command.
Does anyone know how to solve this issue?
root@<LXD host>:/tmp/lxdbackup# /scripts/lxdbackup <servername>
Info: Container <servername> found, continuing..
Snapshot: Succesfully created snaphot 06-25-18-14-51 on container <servername>
Container published with fingerprint: 149b982c7b801b4618f8d07649abd2c94f9bd51e7d5845c32a11d7f621ff994c
Publish: Succesfully published an image of <servername>-BACKUP-06-25-18-14-51 to <servername>-BACKUP-06-25-18-14-51-IMAGE
Image exported successfully!
Image: Succesfully exported an image of <servername>-BACKUP-06-25-18-14-51-IMAGE to /tmp/lxdbackup/<servername>-BACKUP-06-25-18-14-51-IMAGE.tar.gz
Target directory: Succesfully created the <remote>:lxdbackup directory
2018/06/25 14:53:12 DEBUG : rclone: Version "v1.42-005-g56e1e820β" starting with parameters ["/usr/bin/rclone" "-vv" "copy" "/tmp/lxdbackup/<servername>-BACKUP-06-25-18-14-51-IMAGE.tar.gz" "<remote>:lxdbackup/<servername>/"]
2018/06/25 14:53:12 DEBUG : Using config file from "/root/.config/rclone/rclone.conf"
2018/06/25 14:53:12 ERROR : : error reading source directory: directory not found
2018/06/25 14:53:12 INFO : Swift container lxdbackup path <servername>/: Waiting for checks to finish
2018/06/25 14:53:12 INFO : Swift container lxdbackup path <servername>/: Waiting for transfers to finish
2018/06/25 14:53:12 ERROR : Attempt 1/3 failed with 1 errors
2018/06/25 14:53:12 ERROR : : error reading source directory: directory not found
2018/06/25 14:53:12 INFO : Swift container lxdbackup path <servername>/: Waiting for checks to finish
2018/06/25 14:53:12 INFO : Swift container lxdbackup path <servername>/: Waiting for transfers to finish
2018/06/25 14:53:12 ERROR : Attempt 2/3 failed with 1 errors
2018/06/25 14:53:12 ERROR : : error reading source directory: directory not found
2018/06/25 14:53:12 INFO : Swift container lxdbackup path <servername>/: Waiting for checks to finish
2018/06/25 14:53:12 INFO : Swift container lxdbackup path <servername>/: Waiting for transfers to finish
2018/06/25 14:53:12 ERROR : Attempt 3/3 failed with 1 errors
2018/06/25 14:53:12 INFO :
Transferred: 0 Bytes (0 Bytes/s)
Errors: 1
Checks: 0
Transferred: 0
Elapsed time: 900ms
2018/06/25 14:53:12 DEBUG : 6 go routines active
Could not create the <remote>:lxdbackup/<servername>/<servername>-BACKUP-06-25-18-14-51-IMAGE.tar.gz on <remote>:lxdbackup/<servername>/
Cleanup: Succesfully deleted snapshot <servername>/06-25-18-14-51 -
Fingerprint: 149b982c7b801b4618f8d07649abd2c94f9bd51e7d5845c32a11d7f621ff994c
Size: 561.12MB
Architecture: x86_64
Public: no
Timestamps:
Uploaded: 2018/06/25 13:53 UTC
Expires: never
Last used: never
Properties:
Aliases:
- <servername>-BACKUP-06-25-18-14-51-IMAGE
Cached: no
Auto update: disabled
Cleanup: Succesfully deleted copy <servername>-BACKUP-06-25-18-14-51-IMAGE
Hi. Thank you for this very helpful script!! As rsync.net does its own daily snapshots I want to override existing backups on rsync.net with this script. Maybe it is worth to add a hint in the README that for cloud stores with snapshots built in you may want to remove the date, something like:
139 # Export lxc image to image.tar.gz file.
140 if $LXC image export $LXCCONTAINER-BACKUP-$BACKUPDATE-IMAGE $LXCCONTAINER-BACKUP-IMAGE; then
141 lecho "Image: Succesfully exported an image of $LXCCONTAINER-BACKUP-IMAGE to $WORKDIR/$LXCCONTAINER-BACKUP-IMAGE.tar.gz"
142 else
143 lecho "Image: Could not publish image from $LXCCONTAINER-BACKUP-IMAGE to $WORKDIR/$LXCCONTAINER-BACKUP-IMAGE.tar.gz"
Also deleting the files from $WORKDIR immediately after upload to the cloud store may make sense if the containers are large and space is sparse:
161 lecho "Upload: Backup for $LXCCONTAINER uploaded succesfully to $RCLONETARGET." && rm $WORKDIR/$LXCCONTAINER-BACKUP-IMAGE.tar.gz
162 else
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.