{"id":1095,"date":"2025-01-29T16:55:20","date_gmt":"2025-01-29T15:55:20","guid":{"rendered":"https:\/\/wp.bizoir.dk\/?p=1095"},"modified":"2025-02-16T10:03:41","modified_gmt":"2025-02-16T09:03:41","slug":"linux-temporarily-remap-tmp","status":"publish","type":"post","link":"https:\/\/wp.bizoir.dk\/?p=1095","title":{"rendered":"Linux: Temporarily remap \/tmp"},"content":{"rendered":"<p>In my case, I am using gogs on an Azure VM, which has a not-large main drive, but a rather large drive that only exists as long as the VM is running.<\/p>\n<p>Given that the gogs backup is rather disk hungry, I found the need to move its use away from \/tmp and onto the temporary disk.<\/p>\n<p><code># Since \"resource\" is owned by root, make a subfolder and make it world-usable<br \/>\nsudo mkdir \/mnt\/resource\/TEMP &amp;&amp; sudo chmod 777 \/mnt\/resource\/TEMP<br \/>\n# Verify<br \/>\nls -ld \/mnt\/resource\/TEMP<br \/>\n# while TMP and TEMP did not affect gogs, TMPDIR DID, indicating that gogs uses mktemp<br \/>\nTMPDIR=\/mnt\/resource\/TEMP .\/gogs backup<\/code><\/p>\n<p><!--more--><\/p>\n<p>Whether or not it works for other linux programs, depends upon how they find the \/tmp directory. Try setting the TMP, TEMP and TMPDIR environmentvars in succession and see if any of them works.<\/p>\n<p>If it uses <code>mktemp<\/code> as it should, that takes <code>TMPDIR<\/code> into consideration<br \/>\nRef.:<a href=\"https:\/\/www.baeldung.com\/linux\/change-tmp-directory-path\" rel=\"nofollow ugc\">https:\/\/www.baeldung.com\/linux\/change-tmp-directory-path<\/a><\/p>\n<p>If it does not use mktemp, some temporary <code>mount<\/code>ing onto \u201ctmp\u201d is probably needed<\/p>\n","protected":false},"excerpt":{"rendered":"<p>In my case, I am using gogs on an Azure VM, which has a not-large main drive, but a rather large drive that only exists as long as the VM is running. Given that the gogs backup is rather disk hungry, I found the need to move its use away from \/tmp and onto the &hellip; <a href=\"https:\/\/wp.bizoir.dk\/?p=1095\" class=\"more-link\">Continue reading<span class=\"screen-reader-text\"> &#8220;Linux: Temporarily remap \/tmp&#8221;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[11],"tags":[],"class_list":["post-1095","post","type-post","status-publish","format-standard","hentry","category-diverse"],"_links":{"self":[{"href":"https:\/\/wp.bizoir.dk\/index.php?rest_route=\/wp\/v2\/posts\/1095","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/wp.bizoir.dk\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wp.bizoir.dk\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wp.bizoir.dk\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wp.bizoir.dk\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1095"}],"version-history":[{"count":5,"href":"https:\/\/wp.bizoir.dk\/index.php?rest_route=\/wp\/v2\/posts\/1095\/revisions"}],"predecessor-version":[{"id":1119,"href":"https:\/\/wp.bizoir.dk\/index.php?rest_route=\/wp\/v2\/posts\/1095\/revisions\/1119"}],"wp:attachment":[{"href":"https:\/\/wp.bizoir.dk\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1095"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wp.bizoir.dk\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1095"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wp.bizoir.dk\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1095"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}