{"id":1041,"date":"2015-02-14T09:14:31","date_gmt":"2015-02-14T09:14:31","guid":{"rendered":"http:\/\/cdblog.cdstealer.com\/?p=1041"},"modified":"2017-05-05T17:55:18","modified_gmt":"2017-05-05T16:55:18","slug":"portage-tmpfs","status":"publish","type":"post","link":"https:\/\/cdblog.cdstealer.com\/?p=1041","title":{"rendered":"Portage TMPFS"},"content":{"rendered":"<h1 id=\"firstHeading\" class=\"first-header\" lang=\"en\"><span dir=\"auto\">Portage TMPDIR on tmpfs<\/span><\/h1>\n<div id=\"bodyContent\" class=\"mw-body-content\">\n<div id=\"contentSub\"><\/div>\n<div id=\"mw-content-text\" class=\"mw-content-ltr\" dir=\"ltr\" lang=\"en\">\n<p>When emerging packages it is possible to build them in tmpfs (RAM) space instead of having build files pushed and pulled to Hard Disk Drive (HDD) or Solid State Drive (SSD) space. Building in tmpfs both speeds up emerge times and reduces HDD\/SSD wearing. For system's containing SSDs, it is generally a good idea to have Portage compile using tmpfs (RAM) instead burning up precious SSD write cycles (especially on something like compiling software).<\/p>\n<h2><span id=\"fstab_Configuration\" class=\"mw-headline\">fstab Configuration<\/span><\/h2>\n<p>Mount Portage's <code>TMPDIR<\/code> to tmpfs by adding the following to the system's <tt>\/etc\/fstab<\/tt> config file:<\/p>\n<div class=\"box-caption\"><span class=\"label\">FILE<\/span> <strong><code>\/etc\/fstab<\/code><\/strong> tmpfs fstab example<\/div>\n<div class=\"mw-geshi mw-code mw-content-ltr\" dir=\"ltr\">\n<div class=\"text source-text\">\n<pre class=\"de1\">tmpfs\t\t\/var\/tmp\/portage\t\ttmpfs\tuid=portage,gid=portage,mode=775,size=2048M,noatime\t0 0<\/pre>\n<\/div>\n<\/div>\n<p>Adjust the <code>size<\/code> parameter <tt>\/etc\/fstab<\/tt> to the desired amount of RAM. Systems with large amounts of RAM can increase the number quite significantly.<\/p>\n<p>After <tt>\/etc\/fstab<\/tt> has been modified, mount Portage's TMPDIR to RAM by running the <kbd>mount<\/kbd> command followed by the directory location outline in <tt>fstab<\/tt>:<\/p>\n<div class=\"cmd-box\">\n<div><code>root #<\/code><code>mount \/var\/tmp\/portage<\/code><\/div>\n<\/div>\n<h2><span id=\"Considering_tmpfs.27_Size\" class=\"mw-headline\">Considering tmpfs' Size<\/span><\/h2>\n<p>The system's tmpfs space should be large enough to handle the largest packages to be compiled on the system. If the tmpfs space were to ever become completely full then the emerge will fail. Most packages do not need more than 1 GB of tmpfs space their compiles, but there are few <i>very<\/i> large packages. If you have a lot of RAM, setting Be careful to include enough tmpfs space when installing the following packages:<\/p>\n<p><a class=\"external text\" href=\"http:\/\/packages.gentoo.org\/package\/app-office\/openoffice\" rel=\"nofollow\">app-office\/openoffice<\/a>: 10GBs or so.<\/p>\n<p><a class=\"external text\" href=\"http:\/\/packages.gentoo.org\/package\/www-client\/chromium\" rel=\"nofollow\">www-client\/chromium<\/a>: More than 2GBs.<\/p>\n<p><a class=\"external text\" href=\"http:\/\/packages.gentoo.org\/package\/sys-devel\/gcc\" rel=\"nofollow\">sys-devel\/gcc<\/a>: More than 4 GiB.<\/p>\n<h2><span id=\"Per-Package_Choices_at_Compile_Time\" class=\"mw-headline\">Per-Package Choices at Compile Time<\/span><\/h2>\n<p>Portage can be configured to build large packages outside of the tmpfs space on a per-package basis.<\/p>\n<p>Create a file to tell Portage where to place the temporary files directory:<\/p>\n<div class=\"box-caption\"><span class=\"label\">FILE<\/span> <strong><code>\/etc\/portage\/env\/notmpfs.conf<\/code><\/strong><\/div>\n<div class=\"mw-geshi mw-code mw-content-ltr\" dir=\"ltr\">\n<div class=\"text source-text\">\n<pre class=\"de1\">PORTAGE_TMPDIR=\"\/var\/tmp\/notmpfs\"<\/pre>\n<\/div>\n<\/div>\n<p>Create a separate temporary file directory outside of the tmpfs mount location:<\/p>\n<div class=\"cmd-box\">\n<pre><code>mkdir \/var\/tmp\/notmpfs &amp;&amp; chown portage:portage \/var\/tmp\/notmpfs &amp;&amp; chmod 775 \/var\/tmp\/notmpfs<\/code><\/pre>\n<\/div>\n<p>Create a special Portage file called <tt>package.env<\/tt> in <tt>\/etc\/portage<\/tt> and list all the packages that are too large to be compiled using tmpfs:<\/p>\n<div class=\"box-caption\"><span class=\"label\">FILE<\/span> <strong><code>\/etc\/portage\/package.env<\/code><\/strong><\/div>\n<div class=\"mw-geshi mw-code mw-content-ltr\" dir=\"ltr\">\n<div class=\"text source-text\">\n<pre class=\"de1\">app-office\/libreoffice notmpfs.conf\r\nmail-client\/mozilla-thunderbird notmpfs.conf\r\nwww-client\/chromium notmpfs.conf<\/pre>\n<\/div>\n<\/div>\n<\/div>\n<div id=\"catlinks\" class=\"catlinks\"><\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>Portage TMPDIR on tmpfs When emerging packages it is possible to build them in tmpfs (RAM) space instead of having build files pushed and pulled to Hard Disk Drive (HDD) or Solid State Drive (SSD) space. Building in tmpfs both speeds up emerge times and reduces HDD\/SSD wearing. For system's containing SSDs, it is generally &hellip; <a href=\"https:\/\/cdblog.cdstealer.com\/?p=1041\" class=\"more-link\">Continue reading <span class=\"screen-reader-text\">Portage TMPFS<\/span> <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[213,208,209],"class_list":["post-1041","post","type-post","status-publish","format-standard","hentry","category-gentoo","tag-gentoo","tag-portage","tag-tmpfs"],"_links":{"self":[{"href":"https:\/\/cdblog.cdstealer.com\/index.php?rest_route=\/wp\/v2\/posts\/1041","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cdblog.cdstealer.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cdblog.cdstealer.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cdblog.cdstealer.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/cdblog.cdstealer.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1041"}],"version-history":[{"count":3,"href":"https:\/\/cdblog.cdstealer.com\/index.php?rest_route=\/wp\/v2\/posts\/1041\/revisions"}],"predecessor-version":[{"id":1698,"href":"https:\/\/cdblog.cdstealer.com\/index.php?rest_route=\/wp\/v2\/posts\/1041\/revisions\/1698"}],"wp:attachment":[{"href":"https:\/\/cdblog.cdstealer.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1041"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cdblog.cdstealer.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1041"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cdblog.cdstealer.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1041"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}