mirror of https://github.com/trapexit/mergerfs.git
trapexit
2 days ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 162 additions and 66 deletions
-
16mkdocs/docs/faq/reliability_and_scalability.md
-
11mkdocs/docs/media_and_publicity.md
-
33mkdocs/docs/related_projects.md
-
103mkdocs/docs/usage_patterns.md
-
28tools/mergerfs.percent-full-mover
-
25tools/mergerfs.time-based-mover
@ -1,21 +1,37 @@ |
|||||
#!/usr/bin/env sh |
#!/usr/bin/env sh |
||||
|
|
||||
if [ $# != 3 ]; then |
if [ $# != 3 ]; then |
||||
echo "usage: $0 <cache-fs> <backing-pool> <percentage>" |
|
||||
|
echo "usage: $0 <cache-fs> <base-pool> <percentage>" |
||||
exit 1 |
exit 1 |
||||
fi |
fi |
||||
|
|
||||
CACHE="${1}" |
|
||||
BACKING="${2}" |
|
||||
|
CACHEFS="${1}" |
||||
|
BASEPOOL="${2}" |
||||
PERCENTAGE=${3} |
PERCENTAGE=${3} |
||||
|
|
||||
set -o errexit |
set -o errexit |
||||
while [ $(df --output=pcent "${CACHE}" | grep -v Use | cut -d'%' -f1) -gt ${PERCENTAGE} ] |
|
||||
|
while [ $(df "${CACHE}" | tail -n1 | awk '{print $5}' | cut -d'%' -f1) -gt ${PERCENTAGE} ] |
||||
do |
do |
||||
|
# Find the file with the oldest access time |
||||
FILE=$(find "${CACHE}" -type f -printf '%A@ %P\n' | \ |
FILE=$(find "${CACHE}" -type f -printf '%A@ %P\n' | \ |
||||
sort | \ |
sort | \ |
||||
head -n 1 | \ |
head -n 1 | \ |
||||
cut -d' ' -f2-) |
cut -d' ' -f2-) |
||||
test -n "${FILE}" |
|
||||
rsync -axqHAXWESR --preallocate --relative --remove-source-files "${CACHE}/./${FILE}" "${BACKING}/" |
|
||||
|
# If no file found, exit |
||||
|
test -n "${FILE}" || exit 0 |
||||
|
# Move file |
||||
|
rsync \ |
||||
|
--archive \ |
||||
|
--acls \ |
||||
|
--xattrs \ |
||||
|
--atimes \ |
||||
|
--hard-links \ |
||||
|
--one-file-system \ |
||||
|
--quiet \ |
||||
|
--preallocate \ |
||||
|
--remove-source-files \ |
||||
|
--relative \ |
||||
|
--log-file=/tmp/mergerfs-cache-rsync.log \ |
||||
|
"${CACHE}/./${FILE}" \ |
||||
|
"${BACKING}/" |
||||
done |
done |
@ -1,13 +1,26 @@ |
|||||
#!/usr/bin/env sh |
#!/usr/bin/env sh |
||||
|
|
||||
if [ $# != 3 ]; then |
if [ $# != 3 ]; then |
||||
echo "usage: $0 <cache-fs> <backing-pool> <days-old>" |
|
||||
|
echo "usage: $0 <cache-fs> <base-pool> <days-old>" |
||||
exit 1 |
exit 1 |
||||
fi |
fi |
||||
|
|
||||
CACHE="${1}" |
|
||||
BACKING="${2}" |
|
||||
N=${3} |
|
||||
|
CACHEFS="${1}" |
||||
|
BASEPOOL="${2}" |
||||
|
DAYS_OLD=${3} |
||||
|
|
||||
find "${CACHE}" -type f -atime +${N} -printf '%P\n' | \ |
|
||||
rsync --files-from=- -axqHAXWES --preallocate --remove-source-files "${CACHE}/" "${BACKING}/" |
|
||||
|
find "${CACHEFS}" -type f -atime +${DAYS_OLD} -printf '%P\n' | \ |
||||
|
rsync \ |
||||
|
--files-from=- \ |
||||
|
--archive \ |
||||
|
--acls \ |
||||
|
--xattrs \ |
||||
|
--atimes \ |
||||
|
--hard-links \ |
||||
|
--one-file-system \ |
||||
|
--quiet \ |
||||
|
--preallocate \ |
||||
|
--remove-source-files \ |
||||
|
--log-file=/tmp/mergerfs-cache-rsync.log \ |
||||
|
"${CACHEFS}/" \ |
||||
|
"${BASEPOOL}/" |
Write
Preview
Loading…
Cancel
Save
Reference in new issue