Gentoo Archives: gentoo-amd64

From: Duncan <1i5t5.duncan@×××.net>
To: gentoo-amd64@l.g.o
Subject: [gentoo-amd64] Re: Symlinks vs. Bind mounts.
Date: Tue, 12 Aug 2008 04:45:59
Message-Id: pan.2008.08.12.04.45.48@cox.net
In Reply to: [gentoo-amd64] Symlinks vs. Bind mounts. by "Juan Fco. Giordana"
1 "Juan Fco. Giordana" <juangiordana@×××××.com> posted
2 48A1034E.5030109@×××××.com, excerpted below, on Tue, 12 Aug 2008 00:28:14
3 -0300:
4
5 > Instead of creating symlinks to /var and /tmp I've opted for doing "bind
6 > mounts" to these directories because I think it's more manageable this
7 > way. Also I'm taking into consideration the same approach for portage
8 > (instead of modifying the variables in /etc/make.conf).
9
10 Symlinks are the older and more traditional approach, well proven (and
11 generally optimized) over decades of use. While in theory possibly
12 slightly less efficient, in practice, it's generally not going to matter
13 much except for the first access directly off of disk, because after
14 that, it'll all be in-memory cache-access. Any time you go to actual
15 disk, it's many times slower than memory access, so any access to
16 anything uncached will take long enough it doesn't really matter. After
17 that first symlink dereference, that bit is cached anyway. It's sort of
18 like debating whether taking the bus or a taxi to the airport will be
19 faster, when your destination (from the US) is China. A few extra
20 minutes at the local end isn't going to matter much, compared to the
21 hours in flight.
22
23 Bind-mounts are newer, but should be effectively as stable as any mount,
24 and once mounted, it's handled by the kernel directly. Being newer,
25 they're significantly less commonly used, especially since they're new
26 enough most people will intuitively think symlink and not even consider a
27 bind-mount. They may be (probably are but I don't know for sure)
28 slightly more efficient than symlinks, but again, you're debating the
29 equivalent of the taxi ride to the airport when the flight is hours.
30
31 OTOH, and this is why I excerpted the bit above, I don't see why you
32 don't want to change the make.conf settings. The processing from the
33 portage perspective should be the same either way, but if you point it at
34 the real (dereferenced) location, you'll effectively shortcut the entire
35 dereferencing process, either way. You can then leave the symlinks/bind-
36 mounts in place if desired, for your own use and for anything that has
37 hardcoded the default location instead of properly looking it up in
38 make.conf, but portage will be using direct path accesses and therefore
39 be as efficient as possible (altho I think that's a taxi/bus debate as
40 well).
41
42 Now, if you /really/ want to make a difference in portage's speed,
43 consider pointing PORTAGE_TMPDIR at a tmpfs. If you've a decent amount
44 of memory, it'll make a HUGE difference, since all the files it normally
45 creates only temporarily in by default, /var/tmp/portage/* will be
46 created in memory (tmpfs) only. Even with a relatively low amount of
47 memory, say a gig (we're talking amd64 system context here, after all,
48 and a gig has been relatively common since its introduction, not some old
49 1990s 32-bit x86), where tmpfs may be swapped out in some cases, the
50 shortest lived files should never hit disk (swap in the case of tmpfs) at
51 all. That's a LOT of extreme-latency hard-disk I/O avoided!! If you
52 have some serious memory, 2 gig, 4 gig, higher (I have 8 gig), it's even
53 MORE effective, as only the biggest merges will ever hit disk at all,
54 except of course for the initial PORTDIR/DISTDIR operations and the final
55 qmerge to the live filesystem.
56
57 But for PORTDIR and DISTDIR, yes, reiserfs is a pretty good choice. In
58 fact, here I'm using reiserfs exclusively, for everything (except what's
59 on tmpfs, of course). But some folks don't trust it for their main
60 system, and certainly, before it got data=ordered journalling by default,
61 it was sometimes a bit less than reliable. I've certainly found it
62 reliable since, but as they say, YMMV. Even if you're one who doesn't
63 believe it reliable enough for your main system, however, using it for
64 stuff like PORTDIR and DISTDIR makes a lot of sense, because that stuff
65 can always be redownloaded from the net anyway, if something goes wrong
66 and the data gets corrupted.
67
68 But... if you're after performance and have at least a gig of memory, do
69 consider pointing PORTAGE_TMPDIR (or indeed all of /tmp and /var/tmp, as
70 I do, with /var/tmp a symlink to /tmp and PORTAGE_TMPDIR pointed at /tmp
71 directly) at a tmpfs. I expect you'll be very happy with the results,
72 tho you might have to tweak a few things a bit if you find stuff
73 disappearing over reboots that you want to keep. (I ended up tweaking a
74 few KDE cache settings that pointed at /var/tmp by default, to point
75 somewhere in /home instead, for instance. Ask if you want the details.)
76
77 --
78 Duncan - List replies preferred. No HTML msgs.
79 "Every nonfree program has a lord, a master --
80 and if you use the program, he is your master." Richard Stallman

Replies

Subject Author
Re: [gentoo-amd64] Re: Symlinks vs. Bind mounts. "Morgan Wesström" <gentoo-amd64@×××××××××.biz>