From 1ad5f1b6275e3694051fd845a14dc18bce775181 Mon Sep 17 00:00:00 2001 From: vxrtns <151938151+vxrtns@users.noreply.github.com> Date: Mon, 10 Jun 2024 07:26:01 +0200 Subject: [PATCH] Add support for sparse files (#217) --- log2ram | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/log2ram b/log2ram index 307ad33..e141c64 100755 --- a/log2ram +++ b/log2ram @@ -46,10 +46,10 @@ sync_to_disk() { fi if [ -z "${NO_RSYNC}" ] && [ -x "$(command -v rsync)" ]; then - rsync -aXv --inplace --no-whole-file --delete-after "${optional_params[@]}" "$RAM_LOG"/ "$HDD_LOG"/ 2>&1 | + rsync -aXv --sparse --inplace --no-whole-file --delete-after "${optional_params[@]}" "$RAM_LOG"/ "$HDD_LOG"/ 2>&1 | tee -a "$LOG2RAM_LOG" else - cp -rfup "$RAM_LOG"/ -T "$HDD_LOG"/ 2>&1 | tee -a "$LOG2RAM_LOG" + cp -rfup --sparse=always "$RAM_LOG"/ -T "$HDD_LOG"/ 2>&1 | tee -a "$LOG2RAM_LOG" fi } @@ -75,9 +75,9 @@ sync_from_disk() { fi if [ -z "${NO_RSYNC}" ] && [ -x "$(command -v rsync)" ]; then - rsync -aXv --inplace --no-whole-file --delete-after "$HDD_LOG"/ "$RAM_LOG"/ 2>&1 | tee -a "$LOG2RAM_LOG" + rsync -aXv --sparse --inplace --no-whole-file --delete-after "$HDD_LOG"/ "$RAM_LOG"/ 2>&1 | tee -a "$LOG2RAM_LOG" else - cp -rfup "$HDD_LOG"/ -T "$RAM_LOG"/ 2>&1 | tee -a "$LOG2RAM_LOG" + cp -rfup --sparse=always "$HDD_LOG"/ -T "$RAM_LOG"/ 2>&1 | tee -a "$LOG2RAM_LOG" fi }