Archiver#
Archiver is a bash script that helps you backup whatever you want, however you want.
Usage#
For example:
archive.json
[
{
"name": "Wallpapers",
"target": "~/Media/Pictures/Wallpapers",
"archive": {
"name": "walls",
"destination": "~/OneDrive/Wallpapers"
},
"timestamps": {
"last_archive": 1712438594,
"last_upload": 1712438693
},
"sync_command": "onedrive --synchronize --single-directory 'Wallpapers'",
"md5sum": "6de26f11ad638fd145f3d1412e0bf1c6"
},
{
"name": "Books",
"target": "~/Documents/Books",
"archive": {
"name": "books",
"destination": "~/OneDrive/Books"
},
"timestamps": {
"last_archive": 1712439022,
"last_upload": 1712439638
},
"sync_command": "onedrive --synchronize --single-directory 'Books'",
"md5sum": "b4ae6185bb5a20d19c0b30f9778a10cb"
}
]
You specify list of attribute sets with three key parts:
target: the target directory you wish to backuparchive: the name of the archive and where you want to store the archivesync_command: the command you wish to use to back up this specific directory
Other details like timestamps and name are useful for other purposes if you
wish to climb under the hood to use them.
The MD5-Sum is also useful if you wish to verify the legitimacy of your files after retrieving them.
PS: an example archives.json is provided.
Methodology#
- Your
targetgets converted into a tarball. - That tarball is compressed into an
xzarchive.- This format was chosen because of its excellent compression ratio.
- Though in the future I would like to implement multiple formats for this.
- A parity archive is created from that compressed tarball.
- Uses the
par2cmdlineutilities. - A single block file with 30% redundancy is created.
- Additionally, you can use the index file that's created but
par2doesn't really need it.
- Uses the
- A unix timestamp and MD5-Sum is taken from the archived tarball.
- Your
sync_commandhook is run at the end and a secondary timestamp is taken at the end of this. - Your
archives.jsonfile is updated with all of the fresh timestamps and MD5-Sum.
dependencies#
tarxzstatpar2create(frompar2cmdlinepackage)md5sumduawkjq
TODO#
- Multiple archiving formats.
- Store
archives.jsonin a user-specified directory. - Multiple block file parity archive.
- Multi-threaded archiving.