You are not logged in.

#1 2021-08-31 20:54:00

Automath
Member
Registered: 2016-05-16
Posts: 115

Trying to mantain my filesystem tidy and nice with xattrs.

Yesterday I set a bunch of attributes to my files and today I installed icrond with the hope that it should help me maintaining them.

When I read it's description all sounded nice: it watches for file creations, modification and deletion and executes commands based on that in a nice cron based environment, all that marvelous except for two very soooo minor issues: does not monitor recursively and does not monitor over mounted filesystems. How can somebody make all this with so important flaws? IDK.   

Now I'm considering using watchdog, but I'm still not sure if this is the best method.

What I want is to be able to record creation dates, checksums, sizes, locations, hostnames, avaible copies, process and user that originated the file, all that what I think a modern filesystem should do by DEFAULT. I only hope that all this monitoring, if possible , not be so much resources consuming.

What do you think would be the best method for this?

Last edited by Automath (2021-08-31 20:55:35)

Offline

#2 2021-09-01 01:24:29

solskog
Member
Registered: 2020-09-05
Posts: 462

Re: Trying to mantain my filesystem tidy and nice with xattrs.

You can write a script recursively list all the files on local/remote filesystem then feed into icron.

find DIR -type d -print0 |xargs -0 -I{} echo "{} IN_CREATE \"do something\""

Offline

#3 2021-09-01 07:01:14

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 77,280

Re: Trying to mantain my filesystem tidy and nice with xattrs.

How can somebody make all this with so important flaws?

I only hope that all this monitoring, if possible , not be so much resources consuming.

man 7 inotify
cat /proc/sys/fs/inotify/max_user_instances
cat /proc/sys/fs/inotify/max_user_watches

creation dates

man stat

checksums, sizes, locations, hostnames

I assume you mean some "original" values here? Like, when you downloaded the file w/ firefox?
Because the checksum of the file is its checksum - that's deterministic.
Likewise its size.
And "locations" probably doesn't reference to its present hardlinks?

avaible copies

What?

process and user that originated the file

Philosophical questions:
If I "sudo pacman" and pacman uses curl to download a package: which user and what process "originated" the file?
If there's a file an I copy that: what user created the file how and what's its creation time, it's original location, …
If I wget a file, kill the process and the next day "wget -c" the file: what's its creation date? If a different UID continues the download: who originated the file? What was it's initial checksum? What if be both "sudo wget" it?

What do you think would be the best method for this?

Use the FF addon as progandy suggested?

Your recent posts yell XY-PROBLEM in every single line.
You likely have a very specific task in mind and figured you're gonna solve that by bending a userspace overlay filesystem around that - perhaps trying to replicate the failure that was WinFS - but in any event not having generalized the problem at all.

1. Everything is a file. Do you intend to monitor devfs/procfs/sysfs?
2. Files have a habit to move around and be changed. What are the "proper" attrs for some sourcecode file that I edit w/ ever editor under the sun over weeks and months, move onto a usb key to edit it on the road, move it back from said usb key when returning home. And what are the benefits that "a modern filesystem should do by DEFAULT" if I track the code in git?
3. What if pacman installs a config to /etc and I copy, patch and copy it back?

Your idea seems to be to preserve the "true" nature of a file?
But at least outside the context of some web-downloaded r/o document or binary, it's hard to even imagine what that "true" nature is.

If that's not it, maybe you want to re-invent intrusion detection systems that log and check files against external manipulation?

Or you're looking for a COW/snapshotting FS that allows you to go back in time, dedup and whatnot fancy stuff, ie. btrfs/zfs?

tl;dr
=> Use the FF addon as progandy suggested in the other thread.

Offline

#4 2021-09-01 20:17:44

Automath
Member
Registered: 2016-05-16
Posts: 115

Re: Trying to mantain my filesystem tidy and nice with xattrs.

Hi seth, we know better every time.

seth wrote:

How can somebody make all this with so important flaws?

I only hope that all this monitoring, if possible , not be so much resources consuming.

man 7 inotify
cat /proc/sys/fs/inotify/max_user_instances
cat /proc/sys/fs/inotify/max_user_watches

creation dates

man stat

I have read those man pages many times and obviusly they don't reply my questions, obviuosly I know how to use stat at least on a basic level, I wouldn't come with this if not, and as you know most linux distribution don't record creation dates and I also don't trust much about the other dates (should I learn more?),  about inotify seems as many other free software, flawed on purpose if I don't put the enough faith in it, you're suggesting me that's a limited number of instances and watches and I should know more about what an instance of inotify is, but if that is just issuing an inotify --recursive, I don't see that much many instances.

checksums, sizes, locations, hostnames

I assume you mean some "original" values here? Like, when you downloaded the file w/ firefox?
Because the checksum of the file is its checksum - that's deterministic.
Likewise its size.
And "locations" probably doesn't reference to its present hardlinks?

Sure, I mean original, what else could it be. I mean original location, and if you think that I'm revolving on a bad idea I plan to also keep record of history of all this:

user.location="/movedhere/"
user.location.history="/somedir/","/someotherdir/", "/movedhere/"
user.size.history="32","44","20","62"
user.size.original="32"
user.checksum.md5.original="aaaaaaaaaz"
user.checksum.md5.history="aaaaaaaaaz","baaaaaaaz"

.original and .history in case I ned to rotate histories.

avaible copies

What?

user.backups="/etc/foo1", "/home/bar/foo2","/home/bar_bkp/foo"

process and user that originated the file

Philosophical questions:
If I "sudo pacman" and pacman uses curl to download a package: which user and what process "originated" the file?
If there's a file an I copy that: what user created the file how and what's its creation time, it's original location, …
If I wget a file, kill the process and the next day "wget -c" the file: what's its creation date? If a different UID continues the download: who originated the file? What was it's initial checksum? What if be both "sudo wget" it?

So many philosophical questions like that have already been solved when they made linux kernel: everything is a file, do not forgive, do not forget, etc. Everytime you have to pick a scheme and stick to it, that's why there are so many specifications and electric wall plugs types. In my opinion, it was pacman that created the file because it's the most significant and specific in the list, however appointing any of those would be better than nothing, and in case you can't choose, you can always pick them all. A copy is a copy and not the original file, in any case you adopted it, the creator is the creator of the original file, like the parable of the ship, in practical cases the creator of that ship is the owner of the shipyard where it was ensambled. The creation date of the downloaded file is the date that you started downloading it, and after that you have modifyied it, though that file was not complete until that point, same, same, then its sudo wget, no matter what, uid are efimerous and I don't want to record that, my goal is storage, not development and also none of those criteria are excluyent, you can record all that like it's done in so many ways under computer systems.

What do you think would be the best method for this?

Use the FF addon as progandy suggested?

Your recent posts yell XY-PROBLEM in every single line.

That's because I get stuck on trivial limitations exceeding my responsibilities before that I can come with a solution, not because I don't know what I'm doing but because that I had to turn around over my work. You are being reductionist with me, I'm just trying to take the shortest path and not reinvent the wheel, I already know that I can create a service with just a simple bash script . And also there are many experienced people that would know better than me how to do what I want and I rather ask than save my doubts, because generally I do the latter. I'm not a skilled programmer (though I know a bunch of python and I understand basically how a programming language works) but I maintained computer systems for decades, so I know what works for me.

You likely have a very specific task in mind and figured you're gonna solve that by bending a userspace overlay filesystem around that - perhaps trying to replicate the failure that was WinFS - but in any event not having generalized the problem at all.
[/quote ] I wish there was an integrated way to do that, it surely be faster and more efficient, I don't find it. Also I don't know much about WinFS, but surely it mixed bad ideas with good ideas and file tagging is a good idea, even for a non developer.

1. Everything is a file. Do you intend to monitor devfs/procfs/sysfs?

Nope, my intentions limits to just my user files, not system files as that.

2. Files have a habit to move around and be changed. What are the "proper" attrs for some sourcecode file that I edit w/ ever editor under the sun over weeks and months, move onto a usb key to edit it on the road, move it back from said usb key when returning home. And what are the benefits that "a modern filesystem should do by DEFAULT" if I track the code in git?

user.xdg.publisher="nano"
user.xdg.publisher.history="nano", "vim","kate","mousepad"
user.location.original="/home/desktopuser"
user.location.history="/home/desktopuser","/usr/run/usb","/home/desktopuser"
user.hostname="home_desktop"
user.hostname.history="home_desktop","SamsungS00010","home_desktop"

I'm an old school local storage guy and I don't live at the cloud, I'm also a musician and artist so I wan't to mantain my archive in a solid way, everything have flaws but that doesn't mean not to try. If I loose everything in a fire and I recover my files from the cloud well there was a fire, but meanwhile I'll give it a try. I don't remember said as default, it probably is not a good idea for system files, however if it comes by default and you are such a skilled developer you'll know how to get rid of that. You guys mantain "pacman" (I mean the aur)! You pretty know how to do this well.

3. What if pacman installs a config to /etc and I copy, patch and copy it back?

Your idea seems to be to preserve the "true" nature of a file?
But at least outside the context of some web-downloaded r/o document or binary, it's hard to even imagine what that "true" nature is.

You see now I'm not so evil, you define true by yourself but do it, a file is an instance of creation, it could have been spawned in 1971, and had been modified many times, it still has been created in 1971. Book publishers had this philosophical questions way before than us and they still print data on the cover. As I said, it could nt be a good idea for system files, just tag them as system.systemfile=True

If that's not it, maybe you want to re-invent intrusion detection systems that log and check files against external manipulation?

Nope, I'm not security paranoid, it's ok, I have my passwords and change them, I run as root the less that I can, I have a firewall, a nas and I don't have servers listening for external connections, so I] should be ok, I just want to know what my user files are for.

Or you're looking for a COW/snapshotting FS that allows you to go back in time, dedup and whatnot fancy stuff, ie. btrfs/zfs?

I'd like to but I'd better not deal with that extra complexity, even if xattrs got integrated on ext4 it's not so much low level complexity of leyering snapshops and the added complexity of test a filesystem that I yet never used before. Also I think those filesystems don have journaling and are less stable?

tl;dr
=> Use the FF addon as progandy suggested in the other thread.

You're sending me play with my toys, I rather develop a tagging service in day than wasting days configuring uncomplete ff addons that I lost my memory on how to deal with them (enabling external addons, etc, easy stuff that bores me so much). Btw being crawled on what I say is double shaped, for one side I get better comprension from the other side on my needs, by the other side I feel a little observed, I keep with the first one as you are good people trying to help me.

For last, do you think it really is a bad idea? I could be too pretentious but surely something could be done, for sure stat records had'nt been modified in decades and we stand for what was mostly possibly 20 years back, not for now. We just only get more eyecandy stuff.

Last edited by Automath (2021-09-01 20:21:44)

Offline

#5 2021-09-03 10:02:39

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 77,280

Re: Trying to mantain my filesystem tidy and nice with xattrs.

Inotify watches an inode, there's no recursion to that.
You can leverage the audit framework, https://wiki.archlinux.org/title/Audit_ … ies_access
You keep track of a certain directory and store the audit in xattr.
Whether that's a bad idea depends on why you think it#s necessary, but depending on the file, tjis can quickly spiral out of proportions.

Also unless the "copy" is a hardlink (in which case you don't have to store them, the FS knows the other links) there's no guarantee that the stored copy is still there and has the same hash and unless you track the copy as well, your attribute will get out of sync.

Git is btw. not "the cloud" but an explicitly local cvs - and it's used to log changes to the git tree w/ annotations as to why they happened.

Offline

#6 2021-09-05 16:36:36

Automath
Member
Registered: 2016-05-16
Posts: 115

Re: Trying to mantain my filesystem tidy and nice with xattrs.

I use the git command only for cloning repositories from hithub, I don-t create nor mantain them yet, so I-m sorry If my ciuriosity is limited, I know it exist and have an I idea what is for.

I noticed that inotifywatch events are not the EVENTS per se but a very low level version of them, and that if precision is needed I should watch for sequences of events in order to deduce what's the actual operation.

This is a little problem for files being copied as there is not such event but a recognizable patron at the best, this also interfere a litle with creation, as both operations imply the CREATE event. However this is not a total problem since i take care of not overwritting the attributes when this event is found, may be I can even deduce that a file is being copied from this, because if it already has attribute as created then itś being copied but the easiest way may be to be careful of using some script instead of cp,. which indeed will keep track of attributes, like

 cp foo bar&& setfattr ... foo&& setfattr ... bar

I'm still thinking on this.

Finally the script that I came was this:

# xattrd; demonio para mantenimiento de atributos extendidos de archivo
##########


#!/bin/bash
getfattr --version||exit
setfattr --version||exit
CONFIG_DIR="/etc/attr.d/monitoring.conf"
cat "$CONFIG_DIR"|
while read config; do
monitoring_directory="$(echo "$config"|cut -d' ' -f1)"
EVENTS="$(echo "$config"|cut -d' ' -f2)"
options="$(echo "$config"|cut -d' ' -f3)"
EVENTS="${EVENTS//,/ }"
options="${options//,/ --}"
echo "$EVENTS"
inotifywait --quiet --monitor --no-dereference --recursive "$monitoring_directory" -- |
while read event; do
#####Definiendo las variable globales
event_dir="$(echo $event|
cut -d' ' -f1)"
event_type="$(echo $event|
cut -d' ' -f2)"
event_file="$(echo $event|
cut -d' ' -f3)"
[[ "$event_dir" == "${event_dir///./}" ]]||
event_type=IGNORE_IT 
echo event = $event_type
echo eventdiff = "${event_dir///./}"
for EVENT_ in $EVENTS; do
if [[ "$EVENT_" == "$event_type" ]]; then
#####Iniciando algunas variables generales: fecha, hora, tamaño, etc

ttime=$(date +%s)
humandate="$(date +%Y-%M-%d' '%H:%m:%S.%N' '%z)"
size=$(wc -c "$event_dir""$event_file"|
cut -d' ' -f1)
echo size before= $size
case $event_type in
            'MODIFY')   ####obteniendo los atributos
                 echo size after= $size
                 watch=3600     #####periodo de latencia entre modificiones para ser considerada como tal
                 sizewatch=350
                 history=$(getfattr -d --only-values -n user.date.modify.history "$event_dir""$event_file"|
                 tail -n1)
                 modifycounter=$(getfattr -d --only-values -n user.modify.counter "$event_dir""$event_file"|
                 tail -n1)
                 humanhistory=$(getfattr -d --only-values -n user.date.modify.history.human "$event_dir""$event_file"|
                 tail -n1)
                 sizehistory=$(getfattr -d --only-values -n user.size.history  "$event_dir""$event_file"|
                 tail -n1)

                 #####Procesando algunos datos
                 lastmodify=$(echo $history|
                 rev|
                 cut -d, -f1|
                 rev)
                 lastsize=$(echo $sizehistory|
                 rev|
                 cut -d, -f1|
                 rev)
                 echo last= $lastmodify
                 echo since last=$elapsed
                 elapsed=$(echo $ttime-0$lastmodify|
                 bc)
                 sizediff=$(echo $size-0$lastsize|
                 bc)
                 sizediff=${sizediff#-}
####                echo                 $ttime-$lastmodify,0 ###se graban cambios cada mas de 1 hora desde el último cambio
                 ######Actualizando las variables
                 modifycounter=$(echo 0$modifycounter+1|bc)
                 #####Se usa el periodo watch para revisar si la modificacion es relevante
                 if [[ $elapsed -gt $watch ]]||[[ sizediff -gt $sizewatch ]]; then 
                 echo doing shit
                 sizehistory="$sizehistory","$size"
                 history=$history,$ttime
                 humanhistory="$humanhistory,$humandate"
                 ########Reformateando variables de valores únicos
                 
                 sizehistory=$(echo "$sizehistory"|
                 tr \, '\n'|
                 uniq|
                 tr '\n' \,)
                 sizehistory="${sizehistory%,}"
                 
                 ####Actualiazando los atributos
                 setfattr --raw -n user.date.modify.history -v "${history#,}" "$event_dir""$event_file"
                 setfattr --raw -n user.date.modify.history.human -v "${humanhistory#,}" "$event_dir""$event_file"
                 setfattr --raw -n user.modify.counter -v $modifycounter "$event_dir""$event_file"
                 setfattr --raw -n user.size.history -v "${sizehistory#,}" "$event_dir""$event_file"
                 fi
                 
                 ;;
          CREATE)
                 Definiendo algunas variables necesarias
                 mime_type=$(file -bi "$event_dir""$event_file")
                 disklabel=$(lsblk $(df  -P ~/media/human_bkp/|tail -n1|cut -d' ' -f1) -o LABEL|
                 tail -n1)
                 diskuuid=$(lsblk $(df  -P ~/media/human_bkp/|tail -n1|cut -d' ' -f1) -o UUID|
                 tail -n1)
                 ######Inicializando los atributos
                 getfattr -n user.date.origin "$event_dir""$event_file"||
                 setfattr -n user.date.origin -v $ttime "$event_dir""$event_file"
                 getfattr -n user.date.origin.human "$event_dir""$event_file"||
                 setfattr -n user.date.origin.human -v "$humandate" "$event_dir""$event_file"
                 getfattr -n user.hostname.origin "$event_dir""$event_file"||
                 setfattr -n user.hostname.origin -v "$HOSTNAME" "$event_dir""$event_file"
                 getfattr -n user.disk.label.origin "$event_dir""$event_file"||
                 setfattr -n user.disk.label.origin -v "$disklabel" "$event_dir""$event_file"
                 getfattr -n user.disk.uuid.origin "$event_dir""$event_file"||
                 setfattr -n user.disk.uuid.origin -v "$diskuuid" "$event_dir""$event_file"
                 getfattr -n user.fullpath.origin "$event_dir""$event_file"||
                 setfattr -n user.fullpath.origin -v "$event_dir""$event_file" "$event_dir""$event_file"
                 getfattr -n user.size.origin "$event_dir""$event_file"||
                 setfattr --raw -n user.size.origin -v $size "$event_dir""$event_file"
                 getfattr -n user.modify.counter "$event_dir""$event_file"||
                 setfattr --raw -n user.modify.counter -v 0 "$event_dir""$event_file"
                 getfattr -n user.mime.type "$event_dir""$event_file"||
                 setfattr --raw -n user.mime.type -v $mime_type "$event_dir""$event_file"

                 ;;

        MOVED_TO)#####Obteniendo algunas variables
                 disklabel=$(lsblk $(df  -P ~/media/human_bkp/|tail -n1|cut -d' ' -f1) -o LABEL|
                 tail -n1)
                 diskuuid=$(lsblk $(df  -P ~/media/human_bkp/|tail -n1|cut -d' ' -f1) -o UUID|
                 tail -n1)

                    #### obteniendo atributos
                 datemoved=$(getfattr -d --only-values -n user.date.moved.history  "$event_dir""$event_file"|
                 tail -n1)
                 humandatemoved=$(getfattr -d --only-values -n user.date.moved.history.human  "$event_dir""$event_file"|
                 tail -n1)
                 path_history=$(getfattr -d --only-values -n user.fullpath.history  "$event_dir""$event_file"|
                 tail -n1)
                 moved_history=$(getfattr -d --only-values -n user.moved.fullpath.history  "$event_dir""$event_file"|
                 tail -n1)
                 host_history=$(getfattr -d --only-values -n user.hostname.history  "$event_dir""$event_file"|
                 tail -n1)
                 disklabel_history=$(getfattr -d --only-values -n user.disk.label.history  "$event_dir""$event_file"|
                 tail -n1)
                 diskuuid_history=$(getfattr -d --only-values -n user.disk.uuid.history  "$event_dir""$event_file"|
                 tail -n1)
                 host_movedhistory=$(getfattr -d --only-values -n user.moved.hostname.history  "$event_dir""$event_file"|
                 tail -n1)
                 moved_counter=$(getfattr -d --only-values -n user.moved.counter  "$event_dir""$event_file"|
                 tail -n1)
                    ##### Redefiniendo variables
                 datemoved=$datemoved,$ttime
                 humandatemoved="$humandatemoved","$humandate"
                 path_history="$path_history","$event_dir""$event_file" 
                 moved_history="$moved_history","$event_dir""$event_file" 
                 host_history=$host_hisory,"$HOSTNAME"
                 disklabel_history=$disklabel_hisory,"$disklabel"
                 diskuuid_history=$diskuuid_hisory,"$diskuuid"
                 host_movedhistory=$host_movedhisory,$HOSTNAME
                 moved_counter=$(echo 0$moved_counter+1|bc)
                  ###Formateando algunas variables
                 host_history=$(echo $host_history|###### Eliminando valores contiguos.
                 tr \, '\n'|
                 uniq|
                 tr '\n' \,)
                 host_history=${host_history%,}
                 disklabel_history=$(echo $disklabel_history|###### Eliminando valores contiguos.
                 tr \, '\n'|
                 uniq|
                 tr '\n' \,)
                 disklabel_history=${diskuuid_history%,}
                 diskuuid_history=$(echo $diskuuid_history|###### Eliminando valores contiguos.
                 tr \, '\n'|
                 uniq|
                 tr '\n' \,)
                 diskuuid_history=${diskuuid_history%,}
                 host_movedhistory=$(echo $host_movedhistory|
                 tr \, '\n'|
                 uniq|
                 tr '\n' \,)
                 host_movedhistory=${host_movedhistory%,}
                 #####Aplicando atributos
                 setfattr -n user.date.moved.history -v "${datemoved#,}" "$event_dir""$event_file"
                 setfattr -n user.date.moved.history.human -v "${humandatemoved#,}" "$event_dir""$event_file"
                 setfattr -n user.fullpath.history -v "${path_history#,}" "$event_dir""$event_file"
                 setfattr -n user.moved.fullpath.history -v "${moved_history#,}" "$event_dir""$event_file"
                 setfattr -n user.hostaname.history -v "${host_history#,}" "$event_dir""$event_file"
                 setfattr -n user.disk.label.history -v "${disklabel_history#,}" "$event_dir""$event_file"
                 setfattr -n user.disk.uuid.history -v "${diskuuid_history#,}" "$event_dir""$event_file"
                 setfattr -n user.moved.hostaname.history -v "${host_movedhistory#,}" "$event_dir""$event_file"
                 setfattr -n user.moved.counter -v "$moved_counter" "$event_dir""$event_file"
                 ;;
        _ACCESS)   #### obteniendo atributos #El puto sitema operativo no se entera de nada
                   #### hay que interpretar patrones de eventos para que esto funcione como se debe
                   #### no digas que no lo sabías
                 datecopied=$(getfattr -d --only-values -n user.date.copied.history  "$event_dir""$event_file"|
                 tail -n1)
                 humandatecopied=$(getfattr -d --only-values -n user.date.copied.history.human  "$event_dir""$event_file"|
                 tail -n1)
                 path_history=$(getfattr -d --only-values -n user.fullpath.history  "$event_dir""$event_file"|
                 tail -n1)
                 copied_history=$(getfattr -d --only-values -n user.copied.fullpath.history  "$event_dir""$event_file"|
                 tail -n1)
                 host_history=$(getfattr -d --only-values -n user.hostname.history  "$event_dir""$event_file"|
                 tail -n1)
                 host_copiedhistory=$(getfattr -d --only-values -n user.copied.hostname.history  "$event_dir""$event_file"|
                 tail -n1)
                 copied_counter=$(getfattr -d --only-values -n user.copied.counter  "$event_dir""$event_file"|
                 tail -n1)
                    ##### Redefiniendo variables
                 datecopied=$datecopied,$ttime
                 humandatecopied="$humandatecopied","$humandate"
                 path_history="$path_history","$event_dir""$event_file" 
                 copied_history="$copied_history","$event_dir""$event_file" 
                 host_history=$host_hisory,"$HOSTNAME"
                 host_copiedhistory=$host_copiedhisory,$HOSTNAME
                 copied_counter=$(echo 0$copied_counter+1|bc)
                  ###Formateando algunas variables
                 host_history=$(echo $host_history|###### Eliminando valores contiguos.
                 tr \, '\n'|
                 uniq|
                 tr '\n' \,)
                 host_history=${host_history%,}
                 host_copiedhistory=$(echo $host_copiedhistory|
                 tr \, '\n'|
                 uniq|
                 tr '\n' \,)
                 host_copiedhistory=${host_movedhistory%,}
                 #####Aplicando atributos
                 setfattr -n user.date.copied.history -v "${datecopied#,}" "$event_dir""$event_file"
                 setfattr -n user.date.copied.history.human -v "${humandatecopied#,}" "$event_dir""$event_file"
                 setfattr -n user.fullpath.history -v "${path_history#,}" "$event_dir""$event_file"
                 setfattr -n user.copied.fullpath.history -v "${copied_history#,}" "$event_dir""$event_file"
                 setfattr -n user.hostaname.history -v "${host_history#,}" "$event_dir""$event_file"
                 setfattr -n user.copied.hostaname.history -v "${host_copiedhistory#,}" "$event_dir""$event_file"
                 setfattr -n user.copied.counter -v "$copied_counter" "$event_dir""$event_file"
                 ;;
esac
fi
done
done
done

and my conf file looks like this:

#monitoring.conf
/home/human/ CREATE,MODIFY,MOVED_TO,COPIED_TO exclude=/home/human/cdrom/useless/'\.*'

Surely I could do it a little more elegant than this, but I installed it as a systemctl service and it works for now.

Offline

#7 2021-09-05 17:05:17

HalosGhost
Forum Fellow
From: Twin Cities, MN
Registered: 2012-06-22
Posts: 2,097
Website

Re: Trying to mantain my filesystem tidy and nice with xattrs.

Automath wrote:

do you think it really is a bad idea?

Yes. This seems like a terrible idea to me. As far as I can tell from reading this thread so far, it seems like you are trying to reinvent git for your whole filesystem. Many of the philosophical questions Seth asked are interesting to muse on because, unlike for many physical media (such as books as you mentioned), there aren't always coherent, consistent, or complete answers for digital records.

My suggestion would be to abandon this plan and figure out on which files you actually would benefit from having more detailed provenance, and put those in a version-control system (like a git repository). Otherwise, something like btrfs may indeed be useful.

However, to seth's point (again), there is a reason why such a thing isn't supported on any filesystem at all built-in. Trying to shoe-horn your own solution to do this deeply feels like there's a specific benefit you want to garner that you've not clearly laid out.

All the best,

-HG

Offline

#8 2021-09-06 01:19:56

solskog
Member
Registered: 2020-09-05
Posts: 462

Re: Trying to mantain my filesystem tidy and nice with xattrs.

I run a desktop VM and few other VMs for testing purpose with periodic snapshots on SSD. This way I can always go back in time and compare the effects of different settings and file stats between time periods for the same VM.

Offline

#9 2021-09-06 21:17:48

zpg443
Member
Registered: 2016-12-03
Posts: 316

Re: Trying to mantain my filesystem tidy and nice with xattrs.

Agree with solskog that a VM approach is a reasonable approach for testing different version control schemes.

Last edited by zpg443 (2021-09-06 21:18:02)

Offline

Board footer

Powered by FluxBB