Tmpfs Tools Profile Sync Daemon (PSD): Difference between revisions

From WikiMLT
mNo edit summary
Line 1: Line 1:
<noinclude>{{ContentArticleHeader/Linux_Server|toc=off}}{{ContentArticleHeader/Linux_Desktop}}</noinclude>
<noinclude>{{ContentArticleHeader/Linux_Server|toc=off}}{{ContentArticleHeader/Linux_Desktop}}</noinclude>
''[https://github.com/graysky2/profile-sync-daemon Profile-sync-daemon] (psd) is a tiny pseudo-daemon designed to manage your browser's profile in <code>tmpfs</code> and to periodically sync it back to your physical disc (HDD/SSD). This is accomplished via a symlinking step and an innovative use of <code>rsync</code> to maintain back-up and synchronization between the two. One of the major design goals of <code>psd</code> is a completely transparent user experience.''
It is designed to work on desktop systems, but by creating custom fake profiles it could be used for non production servers :) Currently I'm using it to minimize [[Kali Linux Install Brave browser|Brave browser]] disk writings. More information about the PSD's Brave profile could be foun in the references section below.


== Preparation ==
== Preparation ==
Identify which directories has high [[I/O Monitoring and Analyze|I/O rate]] by the following command.<syntaxhighlight lang="shell" line="1" class="force-prompt">
Identify which directories has high [[I/O Monitoring and Analyze|I/O rate]] by the following command.<syntaxhighlight lang="shell" line="1" class="force-prompt">
sudo watch -d -n 1 "find /var -type f -size +80k -mmin -10 -printf '%-30s \t %t %p\n'"
sudo watch -d -n 1 "find ~/.cache ~/.config -type f -size +80k -mmin -10 -printf '%-30s \t %t %p\n'"
</syntaxhighlight>Check the current size of the identified directories.<syntaxhighlight lang="shell" line="1" class="force-prompt">
</syntaxhighlight>Check the current size of the identified directories.<syntaxhighlight lang="shell" line="1" class="force-prompt">
du -hs /var/log
du -hs ~/.cache ~/.config
</syntaxhighlight>Take a statistic for the average disk write per minute before the setup.<syntaxhighlight lang="shell" line="1" class="force-prompt">
</syntaxhighlight>Take a statistic for the average disk write per minute before the setup.<syntaxhighlight lang="shell" line="1" class="force-prompt">
iostat -h /dev/nvme0n1 -d 60 -t
iostat -h /dev/nvme0n1 -d 60 -t

Revision as of 14:43, 31 August 2022

Pro­file-sync-dae­mon (psd) is a tiny pseu­do-dae­mon de­signed to man­age your browser's pro­file in tmpfs and to pe­ri­od­i­cal­ly sync it back to your phys­i­cal disc (HDD/SSD). This is ac­com­plished via a sym­link­ing step and an in­no­v­a­tive use of rsync to main­tain back-up and syn­chro­niza­tion be­tween the two. One of the ma­jor de­sign goals of psd is a com­plete­ly trans­par­ent user ex­pe­ri­ence.

It is de­signed to work on desk­top sys­tems, but by cre­at­ing cus­tom fake pro­files it could be used for non pro­duc­tion servers :) Cur­rent­ly I'm us­ing it to min­i­mize Brave brows­er disk writ­ings. More in­for­ma­tion about the PSD's Brave pro­file could be foun in the ref­er­ences sec­tion be­low.

Prepa­ra­tion

Iden­ti­fy which di­rec­to­ries has high I/O rate by the fol­low­ing com­mand.

sudo watch -d -n 1 "find ~/.cache ~/.config -type f -size +80k -mmin -10 -printf '%-30s \t %t %p\n'"

Check the cur­rent size of the iden­ti­fied di­rec­to­ries.

du -hs ~/.cache ~/.config

Take a sta­tis­tic for the av­er­age disk write per minute be­fore the set­up.

iostat -h /dev/nvme0n1 -d 60 -t

In­stall log2ram

echo "deb [signed-by=/usr/share/keyrings/azlux-archive-keyring.gpg] http://packages.azlux.fr/debian/ bullseye main" | sudo tee /etc/apt/sources.list.d/azlux.list
sudo wget -O /usr/share/keyrings/azlux-archive-keyring.gpg  https://azlux.fr/repo.gpg
sudo apt update
sudo apt install log2ram

Set­up log2ram

sudo nano /etc/log2ram.conf
SIZE=2G
MAIL=true
PATH_DISK="/var/log"
ZL2R=false
COMP_ALG=lz4
LOG_DISK_SIZE=100M

Mod­i­fy the de­fault sys­temd timer unit, if you want to log more or less fre­quent­ly than one time per day.

sudo systemctl edit log2ram-daily.timer

Re­boot the sys­tem. Af­ter the re­boot check does it work­ing and use the io­stat com­mand to take a new sta­tis­tic.

Ref­er­ences