try with extra RAM
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
|
|
||||||
VERSION="20250214"
|
VERSION="20250225"
|
||||||
|
|
||||||
function helpexit() {
|
function helpexit() {
|
||||||
BS=$( basename "$0" )
|
BS=$( basename "$0" )
|
||||||
@@ -13,6 +13,7 @@ function helpexit() {
|
|||||||
echo " --nl Do not store a separate file list."
|
echo " --nl Do not store a separate file list."
|
||||||
echo " --rm Remove source folders after archival."
|
echo " --rm Remove source folders after archival."
|
||||||
echo " --split SIZE Split archive to SIZE. ex. 500G"
|
echo " --split SIZE Split archive to SIZE. ex. 500G"
|
||||||
|
echo " --chunk SIZE Buffer data in RAM to reduce simultaneous read/write. default: $CHUNKSIZE"
|
||||||
echo " folder name: If given, archive only the named folder(s)."
|
echo " folder name: If given, archive only the named folder(s)."
|
||||||
echo " If not, for loop over all folders in the current directory."
|
echo " If not, for loop over all folders in the current directory."
|
||||||
|
|
||||||
@@ -76,6 +77,7 @@ REMOVE=0
|
|||||||
KEEP_LIST=1
|
KEEP_LIST=1
|
||||||
YES=0
|
YES=0
|
||||||
SPLIT=""
|
SPLIT=""
|
||||||
|
CHUNKSIZE=100M
|
||||||
for ((i=1; i<=${#@}; i++)) {
|
for ((i=1; i<=${#@}; i++)) {
|
||||||
[[ "${!i}" = "-h" ]] && helpexit
|
[[ "${!i}" = "-h" ]] && helpexit
|
||||||
[[ "${!i}" = "--help" ]] && helpexit
|
[[ "${!i}" = "--help" ]] && helpexit
|
||||||
@@ -85,6 +87,7 @@ for ((i=1; i<=${#@}; i++)) {
|
|||||||
[[ "${!i}" = "--nl" ]] && { KEEP_LIST=0; continue; }
|
[[ "${!i}" = "--nl" ]] && { KEEP_LIST=0; continue; }
|
||||||
[[ "${!i}" = "--rm" ]] && { REMOVE=1; continue; }
|
[[ "${!i}" = "--rm" ]] && { REMOVE=1; continue; }
|
||||||
[[ "${!i}" = "--split" ]] && { i=$(( i + 1 )); SPLIT="${!i}"; continue; }
|
[[ "${!i}" = "--split" ]] && { i=$(( i + 1 )); SPLIT="${!i}"; continue; }
|
||||||
|
[[ "${!i}" = "--chunk" ]] && { i=$(( i + 1 )); CHUNKSIZE="${!i}"; continue; }
|
||||||
[[ "${!i}" = "-"* ]] && helpexit
|
[[ "${!i}" = "-"* ]] && helpexit
|
||||||
FOLDERS+=( "${!i%/}" )
|
FOLDERS+=( "${!i%/}" )
|
||||||
DEPTH=0
|
DEPTH=0
|
||||||
@@ -100,6 +103,13 @@ if [[ -n "$SPLIT" ]]; then
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
if [[ "$CHUNKSIZE" =~ ^[0-9]+$ ]] || [[ "$CHUNKSIZE" =~ ^[0-9]+[KMGTPEZ]$ ]] || [[ "$CHUNKSIZE" =~ ^[0-9]+[KMGTPEZ]B$ ]]; then
|
||||||
|
true
|
||||||
|
else
|
||||||
|
echo "Cannot parse: $CHUNKSIZE. use ex. 256M. valid extension K M G T P E Z"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
CHUNKCMD="| dd obs=$CHUNKSIZE status=none "
|
||||||
if tar --version | grep -q GNU; then
|
if tar --version | grep -q GNU; then
|
||||||
SORTFILES="--sort=name"
|
SORTFILES="--sort=name"
|
||||||
fi
|
fi
|
||||||
@@ -134,7 +144,7 @@ for d in "${REALFOLDERS[@]}"; do
|
|||||||
fi
|
fi
|
||||||
printf "\n"
|
printf "\n"
|
||||||
eval "tar cvv $SORTFILES --index-file=\"$d.${SUFFIX}.lst\" \"$d\" | \
|
eval "tar cvv $SORTFILES --index-file=\"$d.${SUFFIX}.lst\" \"$d\" | \
|
||||||
pv -s \"$SIZE\" $COMPRESSCMD $STORECMD" && {
|
pv -s \"$SIZE\" $COMPRESSCMD $CHUNKCMD $STORECMD" && {
|
||||||
# tar exists okay
|
# tar exists okay
|
||||||
NEWEST="$( awk '{ print $4 " " $5 }' "$d.${SUFFIX}.lst" | sort | tail -n 1 )"
|
NEWEST="$( awk '{ print $4 " " $5 }' "$d.${SUFFIX}.lst" | sort | tail -n 1 )"
|
||||||
if [[ -n "$SPLIT" ]]; then
|
if [[ -n "$SPLIT" ]]; then
|
||||||
|
|||||||
Reference in New Issue
Block a user