OiNKFS Wiki
Status: Pre-Alpha
Brought to you by:
xiansu
This is more of a walkthrough. So it will be long.
1. copy oinkfs.cfg as .oinkfs in your home directory and then modify it
cp /path/to/oinkfs.cfg ~/.oinkfs
This is optional but it'd be handy to have oinkfs and oinklink in your path:
sudo ln -s /path/to/oinkfs.py /usr/local/bin/oinkfs
sudo ln -s /path/to/oinklink.py /usr/local/bin/oinklink
2. Setting up your directories, PERM_ROOT and ORIG_ROOT.
PERM_ROOT should be structured as PERM_ROOT/$album
ORIG_ROOT should be structured as ORIG_ROOT/$whatever/$album
$album can be anything you want but they must match to be considered.
Ex:"Artist - Album" or "Artist - Year - Album" or "Album".
$whatever can be whatever you want, except for "tmp", so that you can have multiple
(possibly different) copies of albums in ORIG_ROOT. I have two $whatever directories,
one named "what" because I didn't know what to call it and one named "waffles", because
I like to eat waffles.
Other restrictions for files:
FLAC files inside PERM_ROOT must start with a 2 digit tracknumber.
Ex: "01. Artist - Track.flac" or "01 - Track.flac"
FLAC files inside ORIG_ROOT must have 2 consecutive digit somewhere in the filename.
Ex: "Artist - 01 - Track.flac" or "Weird Track Name 01.flac"
3. Run oinklink:
/path/to/oinklink.py -or- oinklink (if you did the optional step in #1)
See oinklink.gif in the wiki.
You'll notice in my example that some files are green and some are red. The green ones
are matched files and red ones are unmatched. This is correct as I do not keep jpg's or
m3u's in my organized directories. The important thing is that 23/23 flacs were
matched, saving me 621.68MB.
If you look inside LINK_ROOT, you will see the same directory structure as ORIG_ROOT,
but the flac files will have accompanying .rdiff files, totalling 48KB.
ls -laR /media/raid/links | awk '/rdiff$/{size+=$5} END {print size}'
47803
4. Run oinkfs:
/path/to/oinkfs.py OINKFS_MP -or- oinkfs OINKFS_MP (if you did the optional step)
xian@sammael:~/oinkfs> df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/md1 139G 48G 85G 36% /
/dev/md6 15T 12T 3.0T 80% /media/raid
oinkfs 15T 12T 3.0T 80% /media/raid/oinkfs
If you look inside OINKFS_MP, you will see the files in LINK_ROOT without the .rdiff
files. If you try to open the files, it will first patch them into OINKFS_MP/tmp and
then open the file descriptor to that file.
Let's try some md5sum's:
PERM_ROOT: e5f9e2e4cb86f380856fe0fdc50104df 02. The Shins - Simple Song.flac
ORIG_ROOT: d5367de8d4ae9f1483eb825520ab7664 02 - Simple Song.flac
LINK_ROOT: e5f9e2e4cb86f380856fe0fdc50104df 02 - Simple Song.flac
OINKFS_MP: d5367de8d4ae9f1483eb825520ab7664 02 - Simple Song.flac
You can now backup and remove the album in ORIG_ROOT. The only copy on your drive will
be the one in PERM_ROOT, the link in LINK_ROOT and the patch file. Because your only
copy is now in PERM_ROOT, you must NOT change this file, or you will lose the original
file. See the FAQ below for how to modify PERM_ROOT.
If you look inside OINKFS_MP/tmp, you will see 2 files, the song we just md5sum'd and
oinkfs.log which if you look inside, you will see:
2012/11/21 04:23:17 creating ./tmp/waffles/The Shins - Port of Morrow/02 - Simple Song.flac
You can also delete the files in OINKFS_MP/tmp at anytime because they will be
re-created whenever they are opened.
Q. More FAQs?
A. Seriously? Sigh...
Q. How do I unmount this shit?
A. fusermount -u OINKFS_MOUNTPOINT
Q. If I don't set DEL_FILES in .oinkfs, I have to delete files myself?
A. You can create a cronjob to delete files not access over an hour:
find OINKFS_MOUNTPOINT/tmp -amin +60 -exec rm {} \;
or to delete files not accessed for over a week:
find OINKFS_MOUNTPOINT/tmp -atime +7 -exec rm {} \;
Q. Why are my files suddenly colored white on a blue background?
A. That's normal. It means that there are multiple entries pointed at the inode.
Q. I want to modify an album in my PERM_ROOT directory. What do I do?
A. Just copy album from OINKFS_MP to ORIG_ROOT, delete the album in LINK_ROOT, and then
modify the album in PERM_ROOT. Next time oinklink is run, it will relink and repatch
the album.
Q. How do I manually create patches?
A. optional: 1. md5sum ORIG_FILE
2. rdiff signature PERM_FILE PERM_FILE.sig
3. rdiff delta PERM_FILE.sig ORIG_FILE PERM_FILE.rdiff
optional: 4. rdiff patch PERM_FILE PERM_FILE.rdiff | md5sum
Check #1 and #4 to see if they match. Place PERM_FILE and PERM_FILE.rdiff in LINK_ROOT
and you should now be able to open ORIG_FILE through OINKFS_MP.