Talk:Squashed Portage Tree

Tgbugs WARNING
Using the latest version of this script and stable x86 aufs2/squashfs (9/16/09), if you run this script form inside /etc/init.d it will overwrite your entire init.d folder with /usr/portage!!!!! DO NOT USE THIS SCRIPT! Whether it simply mounts portage to /etc/init.d or actually overwrites you will be stuck in a maintenance shell if you reboot!


 * This is what I do and I've never seen anything like this. Ni1s 14:35, 17 September 2009 (GMT)
 * To tell you the truth I have no idea why this happened, fortunately the install was on a usb key so I was able to take it out and plug it in to another computer and copy over the init.d directory. --Tgbugs 17:01, 18 September 2009 (GMT)

Multiple trees
I've made a modified version of this script months ago, it's been tested since then. I'm adding it to the article with minor modifications, but it's quite extensive. Let me know if you think it's better to create a new article, so more people can discuss, or feel free to do it yourself, if you dare to.

I believe I've covered all the steps necessary, while I have not tested it, probably I will. But, in the meantime it can also be improved overall.

And thanks all, for this script, it's really useful! morris 21:31, 22 November 2009 (GMT)

Arbitrary empty size for $PORTAGE_RW?
In the init script, the current disk usage of the $PORTAGE_RW dir is checked to determine whether the image needs to be updated. Right now, a usage of 4kB is assumed to be "empty". However, on my system, $PORTAGE_RW occupies 12kB:

T61p ~ # du -a /var/portage/portage_rw/ 0      /var/portage/portage_rw/.wh..wh.aufs 4      /var/portage/portage_rw/.wh..wh.orph 4      /var/portage/portage_rw/.wh..wh.plnk 12     /var/portage/portage_rw/

I know that in the past the "magic value" of 4 kB has worked for me. Since this empty value seems to change pretty arbitrarily, is there perhaps a better way to test this directory?


 * This is just the general concept of what you could change the script to - I haven't done so myself yet as I've not had any problems checking the directory "size" - but it would be far more accurate in determining a truly "empty" directory:


 * The first part lists the contents of $PORTAGE_RW (Note: This does not include special/hidden files/directories), the grep line returns any non-linked files/directories, and the wc line of course counts the number of results and returns either 0 or a number greater than 0. From here you could throw an "IF" statement into the script to suggest that, if the result is greater than zero, then the $PORTAGE_RW directory is "NOT" empty, "ELSE" assume it is empty.
 * The first part lists the contents of $PORTAGE_RW (Note: This does not include special/hidden files/directories), the grep line returns any non-linked files/directories, and the wc line of course counts the number of results and returns either 0 or a number greater than 0. From here you could throw an "IF" statement into the script to suggest that, if the result is greater than zero, then the $PORTAGE_RW directory is "NOT" empty, "ELSE" assume it is empty.


 * Again, this is just the general idea - I've not tested it myself nor do I use it. -  Mousee 14:12, 10 April 2010 (GMT)

Kernel rebuild/reboot suggestion
As of 05/10/11 and following this article on a current system, the init script fails saying that AUFS2 support is unavailable. My next stop was to tail -f /var/log/messages in a split (tmux) shell and modprobe aufs, it fails with a boat load of missing symbols. A bit of google-fu says that a kernel rebuild is required after the ebuild patches the kernel (well duh!) I deliberately failed to rebuilt my running kernel and reboot to see what happen. The ebuild maintainer and/or portages documentation team should be notified and some documentation written making it clear that a KERNEL REBUILD/REBOOT is *REQUIRED* when the 'kernel-patch' flag is uses ... maybe a stop/pause or automatically dip into /usr/src/linux and rebuild for the user.
 * Instructions are not clear no. You can only load the aufs module after the ed kernel is running. /Ni1s 05:22, 12 May 2011 (GMT)
 * I have added a warning after portage just up in my face when I upgraded kernels. Tbh, using an out-of-tree module for something vital as portage is not wise and as such I've removed the script again. Perhaps somebody can update it to use the unionfs module which should be in the kernel (if I understand the kernel discussion about aufs2 - it was denied because unionfs is already there). 77.168.115.4
 * You can if aufs2 fails to load still mount the squashfs file, the article should cover this, sure, but no need to be dramatic(ideally the script should still mount the sqfs portage tree as read-only AND INFORM YOU). Not to mention that there exist kernels that include aufs2, i.e zen-sources. This article is indeed lacking. /Ni1s 22:57, 5 July 2011 (GMT)