use fsync and preallocation for rsync

This commit is contained in:
Daniel Micay 2023-07-26 04:46:39 -04:00
parent 6b7dff0c64
commit af04353d64
2 changed files with 6 additions and 6 deletions

View File

@ -25,14 +25,14 @@ echo target is $target
echo
ssh $remote "rm -rf $target && cp -a $active $target"
rsync -rpcv --fsync --chmod=D755,F644 --delete static-tmp/ $remote:$target
rsync -rpcv --chmod=D755,F644 --delete --fsync --preallocate static-tmp/ $remote:$target
ssh $remote "ln -snf $target /srv/element.grapheneos.org && sync /srv/element.grapheneos.org"
echo "root $target;" > nginx-tmp/root_element.grapheneos.org.conf
rsync -rptcv --fsync --chmod=D755,F644 --delete nginx-tmp/{nginx.conf,mime.types,root_element.grapheneos.org.conf,snippets} $remote:/etc/nginx/
rsync -ptcv --fsync --chmod=755 {local-backup,remote-backup} $remote:/usr/local/bin/
rsync -ptcv --fsync --chmod=644 systemd/system/remote-backup.timer $remote:/etc/systemd/system/remote-backup.timer
rsync -ptcv --fsync --chmod=644 systemd/system/remote-backup.service $remote:/etc/systemd/system/remote-backup.service
rsync -rptcv --chmod=D755,F644 --delete --fsync --preallocate nginx-tmp/{nginx.conf,mime.types,root_element.grapheneos.org.conf,snippets} $remote:/etc/nginx/
rsync -ptcv --chmod=755 --fsync --preallocate {local-backup,remote-backup} $remote:/usr/local/bin/
rsync -ptcv --chmod=644 --fsync --preallocate systemd/system/remote-backup.timer $remote:/etc/systemd/system/remote-backup.timer
rsync -ptcv --chmod=644 --fsync --preallocate systemd/system/remote-backup.service $remote:/etc/systemd/system/remote-backup.service
ssh $remote nginx -s reload
echo

View File

@ -12,6 +12,6 @@ ssh $remote "mkdir local-backup/$timestamp"
ssh $remote "pg_dumpall -U postgres > local-backup/$timestamp/all_databases.sql"
ssh $remote "cp -r /etc/synapse local-backup/$timestamp/synapse"
ssh $remote "tar -cC local-backup $timestamp | zstd -9 | age -r \$(cat backup-public-key.txt) -o local-backup/$timestamp.tar.zst.age"
rsync -v $remote:./local-backup/$timestamp.tar.zst.age backup/
rsync -v --fsync --preallocate $remote:./local-backup/$timestamp.tar.zst.age backup/
ssh $remote "rm -rf local-backup"