ecdye / zram-config

A complete zram-config utility for swap, directories, and logs to reduce SD, NAND and eMMC block wear.
MIT License
412 stars 53 forks source link

syncToDisk ? #14

Closed mstormi closed 4 years ago

mstormi commented 5 years ago

I noticed the syncToDisk command is commented out in zram-config What does it mean, will changes to upper layer FS (in ram) ever get synced to lower layer (SD card)? Can I enforce a sync ?

StuartIanNaylor commented 5 years ago

Uses mergeoverlay synctodisk doesn't exist copying whole directories on shutdown is just a bad idea.

mstormi commented 5 years ago

Ok, but as mergeOverlay() is only called on zram-config stop, files will only be merged when that is executed on server shutdown. I'd like to sync once a day or so. DoI have to call overlay merge (via cron or other) to do that or is there a more clever way ?

StuartIanNaylor commented 5 years ago

You can not as you have to merge offline so cronjob reboot or work out a way to umount / from a working system.

mstormi commented 4 years ago

Just an idea, I have come across https://github.com/amir73il/overlayfs/wiki/Overlayfs-snapshots Would that work to snapshot first and then (still online) copy the snapshot ?

StuartIanNaylor commented 4 years ago

This is the weird thing as supposedly no as the man himself Amir seemed to say. Have a look in the issue marked 'Help' Its weird as to be able to rotate snapshots on a live system would be freaking awesome.

If you would try it and see, but sort of don't if there is any possibility of corruption. I would rather it just didn't work than be a cause of corruption

Also would you try if my check for kernel 4.19 or less splits correct now and install Attr or Xattr depending on the previous

mstormi commented 4 years ago

Yeah read that. What I understood is that

My interpretation is: noone tried to combine snapshots and those tools so it's worth a try ?

StuartIanNaylor commented 4 years ago

Please do mstormi see how it works. I have been playing with Wayland/Panfrost of late so not able to do any prolonged testing.

This is what I don't get as the most perfect example of snapshots would be able to do a oldest snapshot merge down and cycle through a history to any point. I am totally bemused by the lack of overlayfs tools in this regard and that makes me think there must be a reason for this that I am not understanding as I am like you.

The 'glue' in the middle layer is being used to merge down the lower with my limited understanding but nothing removes that glue and therefore surely it becomes out of sync? Maybe it does merge down and clean the merge layer its been a while since I really examined with depth.

Then there is another problem of race conditions of any file access in the upper of source files in the lower and middle merge. If you could lock the upper file as it is processed then prob nirvana but just have a hunch overlayfs tools is far simpler and just goes through the whole layer. Creates serialised cp, mv & rm and permission functions and just runs that as a script at the end.

Its a huge race scenario that is hugely likely to miss current activity and I am still unsure about merge layer update after completion.

I would be absolutely amazing to have live merges on an overlayfs and if you would whilst I am faffing with wayland give it a go?