00:11 -!- Diocles [~tim@compsoc.sunion.warwick.ac.uk] has joined #unionfs-hurd 00:11 [Users #unionfs-hurd] 00:11 -!- Irssi: Total of 3 nicks [1 ops, 0 halfops, 0 voices, 2 normal] 00:11 -!- Channel #unionfs-hurd created Fri May 27 00:09:27 2005 00:11 -!- Irssi: Join to #unionfs-hurd was synced in 0 secs 00:11 < Casper_> I believe so :) 00:11 <@bing> Casper_: ok 00:11 < Diocles> Hi there. Small tutorial... 00:11 <@bing> yup 00:11 <@bing> Diocles: need a hurd account to compile this on? 00:12 < Diocles> Hmm, I'll boot my laptop. 00:12 <@bing> okay, the tutorial will start in 5 minutes 00:13 < Casper_> Yup, just wrote hello world and it compiles + runs :) 00:14 -!- Polar [~csuead@user-1931.l1.c2.dsl.pol.co.uk] has joined #unionfs-hurd 00:15 <@bing> Polar: need a hurd account to compile this on? 00:15 <@bing> tutorial starting in 3 minutes 00:17 <@bing> does anybody need more time? 00:17 < Diocles> Hmm, I'd better install gcc. :) But you can start. 00:17 <@bing> okay here we go 00:18 <@bing> unionfs is a translator that produces a union of filesystems :-) 00:18 <@bing> where "filesystems" in this case just means a directory 00:18 <@bing> why is it useful? 00:19 <@bing> well, use your imagination 00:19 <@bing> knoppix uses a unionfs 00:19 -!- cavehippo [~bren@82-70-166-214.dsl.in-addr.zen.co.uk] has joined #unionfs-hurd 00:19 <@bing> so anyway, let's go get unionfs for the hurd and compile it 00:19 <@bing> export CVS_RSH="ssh" 00:19 <@bing> cvs -z3 -d:ext:anoncvs@savannah.nongnu.org:/cvsroot/hurdextras co unionfs 00:20 <@bing> this will checkout the very latest version of unionfs 00:20 <@bing> once it's checked out: 00:20 <@bing> cd unionfs 00:20 <@bing> make 00:22 <@bing> after it compiles you can get some help on it 00:22 <@bing> $ ./unionfs --help 00:22 <@bing> Usage: unionfs [OPTION...] FILESYSTEMS ... 00:22 <@bing> Hurd unionfs server 00:22 <@bing> -c, --cache-size=SIZE specify the maximum number of nodes in the cache 00:22 <@bing> -u, --underlying add the underlying node to the unionfs 00:22 <@bing> -w, --writable specify the following filesystem as writable 00:22 <@bing> Runtime options: 00:22 <@bing> -m, --match=PATTERN add only nodes of the underlying filesystem 00:22 <@bing> matching pattern 00:22 <@bing> -r, --remove remove the following filesystem 00:22 <@bing> -s, --stow=STOWDIR stow given directory 00:22 <@bing> -?, --help Give this help list 00:22 <@bing> --usage Give a short usage message 00:22 <@bing> -V, --version Print program version 00:22 <@bing> Mandatory or optional arguments to long options are also mandatory or optional 00:22 <@bing> for any corresponding short options. 00:22 <@bing> Report bugs to Moritz Schulte <moritz@duesseldorf.ccc.de>. 00:22 <@bing> lots of options. 00:23 <@bing> -c controls the cache size, there's a lot of dirent lookups, and this is meant to speed things up 00:24 <@bing> -u means add the underlying filesystem to the union -- this means that i can both set /foo as the union destination, and use /foo as part of the union 00:25 <@bing> -w goes with a filesystem, and it specifies it as one we can write to 00:25 <@bing> forget -m, and forget -s for now 00:25 <@bing> -r means we can remove a filesystem from the union as it runs 00:26 <@bing> questions? 00:27 < Casper_> unionfs is supposed to replace /usr on Unix systems. How can it be used to both export the /usr part of the system, or import a remote /usr and inegrate it with the existing filesystem? 00:27 <@bing> Casper_: patience! 00:27 <@bing> let's walk first 00:27 <@bing> err, crawl 00:28 <@bing> for those of you who have it compiled, type the following: 00:28 <@bing> $ mkdir foo 00:28 <@bing> $ mkdir bar 00:28 <@bing> $ touch foo/file1 00:28 <@bing> $ touch bar/file2 00:28 <@bing> $ mkdir baz 00:29 <@bing> now we will make baz/ the union of foo/ and bar/ 00:29 <@bing> you do it with this command: 00:29 <@bing> $ settrans -a baz ./unionfs foo bar 00:29 <@bing> $ ls -l baz 00:29 <@bing> total 0 00:29 <@bing> -rw-r--r-- 1 bing bing 0 2005-05-26 14:24 file1 00:29 <@bing> -rw-r--r-- 1 bing bing 0 2005-05-26 14:24 file2 00:30 <@bing> and now we can remove the foo/ filesystem from the union with the following command: 00:30 <@bing> fsysopts baz/ -r foo 00:30 <@bing> $ ls -l baz 00:30 <@bing> total 0 00:30 <@bing> -rw-r--r-- 1 bing bing 0 2005-05-26 14:24 file2 00:32 <@bing> now let's get rid of the union with the following command: 00:32 <@bing> $ settrans -fg baz 00:33 <@bing> this example was readonly, but it shows how unionfs can be used to show a union of two directories 00:34 <@bing> questions? 00:34 <@bing> has anyone here does these steps? ;-) 00:34 < Casper_> Small question: touching files in baz while fs was in union put the files into bar. Is there a reason for that? 00:35 <@bing> yes! 00:35 <@bing> write support is very new. check the ChangeLog to see just how new 00:35 <@bing> i haven't even messed with write support yet. :-) 00:36 <@bing> okay, next example. :-) 00:36 <@bing> $ settrans -a baz ./unionfs -w foo 00:36 <@bing> $ ls -l baz/ 00:36 <@bing> total 0 00:36 <@bing> -rw-r--r-- 1 bing bing 0 2005-05-26 14:24 file1 00:37 <@bing> $ fsysopts baz bar 00:37 <@bing> $ ls -l baz 00:37 <@bing> total 0 00:37 <@bing> -rw-r--r-- 1 bing bing 0 2005-05-26 14:24 file1 00:37 <@bing> -rw-r--r-- 1 bing bing 0 2005-05-26 14:24 file2 00:37 <@bing> this shows how to ADD a filesystem on the fly using fsysopts 00:37 <@bing> foo is designated as writable 00:38 <@bing> $ echo "foo" >> baz/file1 00:38 <@bing> $ cat baz/file1 00:38 <@bing> foo 00:39 <@bing> $ cat foo/file1 00:39 <@bing> foo 00:39 <@bing> this shows us writing to the union, and the data also being written to the original filesystem 00:39 <@bing> if you do the same with bar, it will also work even though we didn't specify it as writable. not sure why 00:40 <@bing> $ mkdir baz/qux 00:40 <@bing> $ ls -l bar/ 00:40 <@bing> total 8 00:40 <@bing> -rw-r--r-- 1 bing bing 4 2005-05-26 14:36 file2 00:40 <@bing> drwxr-xr-x 2 bing bing 4096 2005-05-26 14:37 qux 00:40 <@bing> $ ls -l foo/ 00:40 <@bing> total 4 00:40 <@bing> -rw-r--r-- 1 bing bing 4 2005-05-26 14:35 file1 00:40 <@bing> the created directory went into bar, and not foo! 00:41 <@bing> other unionfs implementations would put qux into both foo and bar 00:41 <@bing> apparently it writes to the first writable filesystem on the list 00:42 <@bing> and the list is last first 00:42 <@bing> that's my answer to your question Casper_ 00:42 < Casper_> Thanks :) 00:42 <@bing> $ settrans -fg baz 00:42 <@bing> make the baz/ union go away 00:43 <@bing> for kicks, let's put the union on foo/, and put baz inside of it 00:43 <@bing> err 00:43 <@bing> for kicks, let's pu thte union on foo/, and put bar/ inside of it 00:43 <@bing> so that the union foo/ will contain both foo/ and bar/ 00:44 <@bing> $ settrans -a foo ./unionfs -u bar/ 00:44 <@bing> $ ls -l foo/ 00:44 <@bing> total 12 00:44 <@bing> -rw-r--r-- 1 bing bing 4 2005-05-26 14:35 file1 00:44 <@bing> -rw-r--r-- 1 bing bing 4 2005-05-26 14:36 file2 00:44 <@bing> drwxr-xr-x 2 bing bing 4096 2005-05-26 14:37 qux 00:44 <@bing> the trick here is the -u 00:45 <@bing> Casper, if you want to put a union on /usr, and have it *include* /usr, you'd use the -u switch 00:45 <@bing> $ rmdir foo/qux 00:46 <@bing> $ ls -l foo/ 00:46 <@bing> total 8 00:46 <@bing> -rw-r--r-- 1 bing bing 4 2005-05-26 14:35 file1 00:46 <@bing> -rw-r--r-- 1 bing bing 4 2005-05-26 14:36 file2 00:46 <@bing> $ ls -l bar/ 00:46 <@bing> total 4 00:46 <@bing> -rw-r--r-- 1 bing bing 4 2005-05-26 14:36 file2 00:46 <@bing> here we see the directory going away 00:46 <@bing> any more questions? 00:47 < Casper_> bing: I mean on the Hurd /usr seems to be a symlink to . 00:47 <@bing> $ settrans -fg foo 00:47 <@bing> $ ls -l foo/ 00:47 <@bing> total 4 00:47 <@bing> -rw-r--r-- 1 bing bing 4 2005-05-26 14:35 file1 00:47 <@bing> Casper_: yes it is! do you want to know why that is? 00:47 < Casper_> Sure! 00:47 <@bing> Casper_: but it is only a symlink, not a union 00:48 <@bing> Casper_: it's a symlink translator though 00:48 <@bing> the hurd maintainers thought that having a /usr around was only from historic inertia 00:49 <@bing> historically, /usr was held on one tape, and / was held on another 00:49 <@bing> now we say that / contains everything required to "mount" /usr 00:50 <@bing> and the hurd does this, but there's no need for a distinction 00:50 <@bing> the hope is that the translator functionality makes /usr unnecessary 00:50 <@bing> err, the /usr split 00:50 < Diocles> Is there the potential for filesystem recursion here? 00:50 <@bing> Diocles: yes! 00:51 <@bing> Diocles: making a union of a union of a union is baaaaad 00:51 <@bing> at least the last time i checked it was! 00:51 < Diocles> :) 00:51 <@bing> i'm not going to risk it again 00:51 <@bing> so if you want to make a union of / and anything below it, you're out of luck 00:51 <@bing> it just so happens with the live-cd, that's the case. 00:52 <@bing> more questions? 00:52 <@bing> some ppl say that it would be neat to take a union of the data in all of your home directories from various machines 00:53 < Casper_> that would require sshfs? 00:53 <@bing> that way you don't have to copy things and login to different places 00:53 <@bing> Casper_: well yes, you'd need a way to see the remote fs 00:53 <@bing> Casper_: nfs will do 00:53 <@bing> more questions? 00:54 <@bing> i don't have anything else to demonstrate. :-) 00:54 < Diocles> Hmm. Are translators remembered across reboots? 00:55 <@bing> good question 00:55 <@bing> that's what passive translators are for 00:55 <@bing> i've never gotten passive translators to work with unionfs 00:55 < Casper_> Is there a way to view all passive translators? 00:55 <@bing> i'll leave it as an exercise to you 00:55 < Diocles> Heh. 00:55 <@bing> Casper_: you can see if a node has a passive translator on it 00:56 <@bing> Casper_: by using showtrans 00:56 < Casper_> so, a bash script... 00:56 <@bing> Casper_: yeah it's possible, but you still need read access to the file 00:57 <@bing> showtrans only shows Passive translators 00:57 <@bing> we were using active translators, so showtrans wouldn't have worked on baz/ 00:57 <@bing> passive translators are stored in the extended attributes of the inode 00:57 <@bing> (xattr) 00:58 <@bing> $ showtrans /dev/null 00:58 <@bing> /hurd/null 00:59 <@bing> $ /hurd/null --help 00:59 <@bing> Usage: null [OPTION...] 00:59 <@bing> Endless sink and null source 00:59 <@bing> -f, --full Cause writes to fail as if to a full disk 00:59 <@bing> -?, --help Give this help list 00:59 <@bing> --usage Give a short usage message 00:59 <@bing> -V, --version Print program version 00:59 <@bing> Report bugs to <bug-hurd@gnu.org>. 00:59 <@bing> any more questions? 00:59 <@bing> what's with the --stow option? 01:00 <@bing> ams thought it would be nice to turn unionfs into stowfs 01:00 <@bing> so he convinced gianluca to put that in 01:00 < Diocles> stowfs? 01:00 <@bing> what's stow? 01:01 <@bing> well, GNU Stow exists 01:01 < Casper_> http://www.gnu.org/software/stow/stow.html 01:01 <@bing> it's a perl script that creates the union of a bunch of dirs with symlinks 01:01 <@bing> it's quite amazing really -- it uses the least possible number of symlinks 01:01 < Diocles> Ah, I see... 01:02 <@bing> the idea is that software packages are stored in /packages or someplace 01:02 <@bing> and then you stow them into the stowdir 01:02 <@bing> so that they appear to be together, when they're not 01:02 < Diocles> And --match seems fairly straightforward. 01:03 <@bing> yes, note that it only works for the underlying filesystem 01:03 <@bing> that's a shame 01:03 <@bing> it should work for *any* filesystem 01:03 <@bing> and -w doesn't do what we'd expect either 01:03 <@bing> as an exercise, you can make a filesystem that is readonly 01:03 < Casper_> it seems to be implisit on all fses 01:04 <@bing> eg. put bar/ on a readonly filesystem 01:04 <@bing> this means passing --readonly to storeio i think, or maybe to ext2fs 01:04 <@bing> then see what happens when it fails to write to bar 01:04 <@bing> does it move on to the next writable filesystem? 01:04 <@bing> or does it just skip over it in the first place? 01:04 <@bing> gianluca would love to hear the answer to these questions 01:05 <@bing> gianluca was the person who just wrote write support 01:05 <@bing> if there are no more questions, this concludes the tutorial. :-) 01:05 <@bing> thanks for showing up! 01:05 <@bing> i'll stick around here if you have any more questions 01:06 < Diocles> Thanks for the tutorial. I now have a build environment, as well. ;) 01:07 <@bing> great 01:07 <@bing> if you see gianluca, tell him you've tried it out :-) 01:08 < Casper_> I'm going to try the readonly trick... fsysopts /home --readonly did the trick making it readonly 01:08 <@bing> ooh nice 01:08 <@bing> gotta love those runtime options :-) 01:10 <@bing> oh, and with a huge /usr, unionfs wouldn't work very well 01:10 <@bing> it seems it's slow 01:10 <@bing> maybe increasing the cache-size would help in that case 01:11 < Casper_> Yes, it moves onto the next fs :) 01:12 < Casper_> settrans -a baz unionfs/unionfs foo /home/anton/union 01:12 < Casper_> ls baz/ 01:12 < Casper_> file1 foo 01:12 < Casper_> touch baz/file2 01:12 < Casper_> ls foo 01:12 < Casper_> file1 file2 01:13 <@bing> whoo! 01:13 <@bing> Casper_: please tell gianluca 01:13 <@bing> he'll be so happy that somebody is trying it out 01:14 < Diocles> Are there other versions of unionfs, at all? 01:14 <@bing> Diocles: nope, not for the hurd 01:15 <@bing> maybe when linux2.6's fuse gets ported, we'll have another unionfs 01:15 < Diocles> I'm going to have to play with it... d'oh, I should be working. :) 01:16 < Casper_> ;) 01:16 <@bing> i'd be interested in hear what you guys do with it 01:16 <@bing> i'm hard pressed to find any *real* uses for it :-) 01:17 <@bing> the live-cd is one such use, but it can't work for the reason i already stated 01:18 <@bing> oh, and the whole list of filesystems is prioritized 01:18 <@bing> that's important! 01:19 <@bing> the union needs the filesystems to be prioritized so it can decide what stomps over what 01:19 <@bing> let's say you merge two websites 01:19 <@bing> and they both have an index.html 01:19 <@bing> which one wins? 01:19 <@bing> the higher priority filesystem 01:20 < Casper_> or maybe it should do a diff and combine the two? 01:20 <@bing> heh 01:20 <@bing> Casper_: heck no :-) 01:20 <@bing> Casper_: that sounds a bit like `kitten' 01:20 < Casper_> kitten? 01:21 * Casper_ realises googling kitten brings up something different 01:21 <@bing> heh 01:21 <@bing> it's gnu system stuff again 01:21 <@bing> ams 01:21 <@bing> one file contains many files 01:22 <@bing> and when you change the one main file, it'll change the right other file 01:22 <@bing> if that makes any sense at all 01:22 < Casper_> Ummm... 01:23 < Diocles> Heh, they've invented a word `conkittenation'... 01:23 <@bing> a translator provides a unioned FILE 01:25 < Casper_> So it's something between unionfs and tar? 01:25 <@bing> noo 01:25 <@bing> well kinda 01:25 <@bing> i see what you mean 01:26 <@bing> yeah 01:28 <@bing> does anyone have a script of this session? 01:31 < Casper_> in the scrollback... do you want it? 01:32 <@bing> Casper_: yes please 01:32 <@bing> my scrollback doesn't go far enough back 01:32 <@bing> mail it to ben at asselstine dot com, please