Hello Riku, > im just after a way how to get information what data files is use. if > i example delete something it will delete also s3ql_data_(number) file > so there must be in database a record what s3ql_data_ files are > suppose to be in use, i want a way to extract that info so i can do a > comparison to my filesystem and delete non used files manually(well do > a bash script to delete em) (because the unionfs cannot remove files, > it can only modify or add them)
I am not sure I understand what you do or if that makes sense. Anyways to find out what files should be there you can use the following SQL query |SELECT 's3ql_data_' || id FROM objects ORDER BY id|. Here is an (untested) bash script that uses this to delete the superfluous data files (using the good old |comm| to do the hard work): |#!/bin/bash DB_FILE="path/to/s3ql.db" DIR_WITH_DATAFILES="path/to/your/unionfs/or/whatever" set -e # stop execution on error WORKDIR=$(mktemp -dt "$(basename "$0").XXXXXXXXXX") # first map what is there then find out what should be there # other way round is dangerous if the file system is mounted # (upload new file between steps -> file gets deleted) # what is there cd "$DIR_WITH_DATAFILES" find . -name 's3ql_data_*' > "$WORKDIR/actually_there" # what should be there sqlite3 "$DB_FILE" "SELECT './s3ql_data_' || id FROM objects ORDER BY id" \ > "$WORKDIR/should_be_there" # comm wants lexical sorted files, sqlite prvides naturally soted sort "$WORKDIR/should_be_there" > "$WORKDIR/should_be_there_sorted" rm "$WORKDIR/should_be_there" sort "$WORKDIR/actually_there" > "$WORKDIR/actually_there_sorted" rm "$WORKDIR/actually_there" cd "$DIR_WITH_DATAFILES" # compare the two lists and delete all files that are only in the second one # remove the "echo" to actually delete files comm -13 "$WORKDIR/should_be_there_sorted" "$WORKDIR/actually_there_sorted" \ | xargs echo rm # rm -f \ # "$WORKDIR/should_be_there_sorted" \ # "$WORKDIR/actually_there_sorted" # rmdir "$WORKDIR" | It should theoretically be able to run with a mounted S3QL filesystem but I wouldn’t be so sure about that. -- You received this message because you are subscribed to the Google Groups "s3ql" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/d/optout.
