Giter VIP home page Giter VIP logo

xtaran / unburden-home-dir Goto Github PK

View Code? Open in Web Editor NEW
50.0 6.0 12.0 874 KB

Automatically unburden $HOME from caches, etc. Useful for $HOME on SSDs, small disks or slow NFS homes. Can be triggered via an hook in /etc/X11/Xsession.d/.

Home Page: https://unburden-home-dir.readthedocs.io/

License: GNU General Public License v2.0

Perl 94.02% Shell 2.35% Makefile 3.63%
disk-space perl tmpfs cleanup ssd nfs backup homedir symlinks

unburden-home-dir's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

unburden-home-dir's Issues

Do not override XDG_CACHE_HOME

Hi,

I have to set XDG_CACHE_HOME="$HOME/.cache" because if it's empty unburden-home-dir overrides it. Is there a way of use unburden-home-dir without it set XDG_CACHE_HOME to the /tmp/.unburden-%u/cache ?

WARNING: lsof not found, not checking for files in use

This WARNING is in my .xsession-errors. Although I have lsof installed
$ rpm -q lsof
lsof-4.88-2.fc22.x86_64

On my Fedora 22 desktop (and I guess on all fedora/redhat clones/derivatives) lsof is located at /usr/sbin:
$ which lsof
/usr/sbin/lsof

Unfortunately when snippet is run by xinit, '/usr/[local/]sbin' directories are not part of the PATH.
They are added by /etc/profile which means on interactive shells only.

zram: using a compressed in-memory fs?

as inspiration, my /usr/local/bin/overlay-zram

#!/bin/bash -xv
set -e # die if one step fails

echo "called $0 $@"
dir=$(basename "$@")
zram=/tmp/zram

modprobe -v zram
zramdev=$(zramctl --find --size 20GiB --algorithm lz4)
mkfs.ext4 -O ^has_journal ${zramdev}
mkdir -pv ${zram}
mount -vo discard,dax,noatime ${zramdev} ${zram}
mkdir -pv "/tmp/${dir}-union" "${zram}/${dir}"/{.work,.upper}
modprobe -v overlay
mount -vt overlay overlay -o "lowerdir=${@},upperdir=${zram}/${dir}/.upper,workdir=${zram}/${dir}/.work" "/tmp/${dir}-union"
chown -v --reference="${@}" "/tmp/${dir}-union"

Compression ratio can be looked at with zramctl ..
hard to know if it's worth the fuzz without trying..

Add mask for move all Electron apps caches

All Electron apps store cache files in .config and other folders and eat a lot of space, here is issue about this problem: electron/electron#8124

Until this issue solved, will be good to have default configuration for unburden all those folders, something like this:

# Electron apps in .config folder
m D .config/*/Cache electronApp-%1-Cache
m D .config/*/GPUCache electronApp-%1-GPUCache
m D .config/*/*/Cache electronApp-%1-%2-Cache
m D .config/*/*/GPUCache electronApp-%1-%2-GPUCache

What do you think about this idea?

gnome-keyring 3.4 no more works as ssh-agent replacement when .cache is moved away

The typical error message seems: "Agent admitted failure to sign using the key."

GNOME Keyring changed the keyring socket's location from somewhere under /tmp/ to somewhere under $HOME/.cache with 3.3.92 (i.e. a 3.4 beta release).

This should be at least documented and the default configuration should care about it if it's no GNOME Keyring bug.

Doesn't affect Debian Squeeze or Ubuntu Precise, but will affect Debian Wheezy if not fixed.

major browsers cache location is wrong

I hope that I am not wrong on this:
Looking at contents of /etc/unburden-home-dir.list

  • google-chrome
    I don't see files .config/google-chrome/*/Thumbnails[-journal]
    (actually I am using beta channel and dir for me is .config/google-chrome-beta, maybe its good idea to consider beta users too or maybe even unstable?)
    $ find . -name Thumbnails (in $HOME) returns nothing, so its not moved, just not valid (at least for beta)
    but there are 2 cache dirs at ~/.cache/google-chrome-beta/Default/
    google-chrome-beta-46.0.2490.13-1.x86_64
  • for firefox
    cache dirs are under ./.cache/mozilla/firefox/{profile}/
    there is no Cache.Trash but few more
    firefox-40.0.3-1.fc22.x86_64

I guess I can fork/patch/create pull request but maybe that is not valid for every distribution,
I really have no idea.

Question: Use in NFS-based multiple seat environments?

I'm just wondering if anyone has used this in multiple seat environments, i.e. where I might be on workstation A on one day, and workstation B another, or even both at the same time?

Are all the the "unburdened" directories non-essential in the sense they could disappear and everything would keep working?

unburden-home-dir can't move .cache folder because find command already use it

I configure moving .cache folder on Ubuntu 14.04 with KDE environment, but each time on login I see in logs this problem:

WARNING: Can't handle /home/user1/.cache: in use, not (re)moving. Process list:
   3813 (find)
   3813 (find)

So .cache folder will never moved to unburden location.

Seems that unburden-home-dir script launch find process, that don't finish on this check. How can I fix the problem? Maybe can help sleep command for some seconds before this check?

How to deal with spaces in path?

for example if i want to handle some chromium files, then a list entry
m f .config/chromium/Default/Cookies chromium/Default/Cookies
works totally fine, but how to handle a file with spaces in its name, e.g. Network Action Predictor?
I have tried
m f .config/chromium/Default/Network Action Predictor chromium/Default/Network Action Predictor
and
m f ".config/chromium/Default/Network Action Predictor" "chromium/Default/Network Action Predictor"
at the moment this entries in the list will be just silently ignored.

Problem with file links

I have a config option that looks like:

m F app/output.txt app

If there is an existing symlink with a file as the target, i.e.

output.txt -> /user_data/.tmp/app.jvd/output.txt

Then you'll get errors like:

WARNING: Can't handle /u/jvd/app/output.txt: /user_data/.tmp/app.jvd/output.txt not equal /user_data/.tmp/app.jvd/ at /usr/bin/unburden-home-dir line 184, line 16.

If you remove the link, and run unburden again, it creates the link OK. Second time you run, you'll now see errors:

ERROR: Can't handle /user_data/.tmp/app.jvd/: Unexpected type (not a file) at /usr/bin/unburden-home-dir line 189, line 16.

So it looks to me when you evaluate the target for a link, that target is always a directory. But then check_for_unexpected_target is trying to ensure that the target is the same type as the source. So I don't see how that can work if you're symlinking a file to a directory?

Unless I've got the wrong end of the stick somewhere?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.