{"id":139,"date":"2013-01-28T21:53:16","date_gmt":"2013-01-28T20:53:16","guid":{"rendered":"\/wordpress\/?p=139"},"modified":"2013-01-28T21:53:16","modified_gmt":"2013-01-28T20:53:16","slug":"diskless-var","status":"publish","type":"post","link":"\/wordpress\/freebsd\/diskless-var\/","title":{"rendered":"Diskless \/var"},"content":{"rendered":"<p>On root filesystems that&#8217;s served from flash memory it may be advisable to keep off heavy writes from them. By putting \/var on a ramdrive you can greatly increase the expected lifetime of an ssd or a usb memorystick.<\/p>\n<h3>Initial steps<\/h3>\n<p>A snapshot of \/var needs to be created. On true diskless systems FreeBSD ramdrive filesystems can be set up by populating \/conf\/base. While it won&#8217;t be supported in this case, it might prove a good idea to use the same base for this purpose.<br \/>\nStart off by creating an initial snapshot of \/var<\/p>\n<pre><code>mkdir -p \/conf\/base\/var\r\ntar -cf \/conf\/base\/var.cpio.gz -C \/ --format cpio --gzip var<\/code><\/pre>\n<p>The contents on disk of \/var is now obsolete.<\/p>\n<pre><code>rm -rf \/var\/*<\/code><\/pre>\n<h3>Configuration<\/h3>\n<h4>\/etc\/rc.conf<\/h4>\n<pre><code>mdconfig_md0=\"-t swap -s 64m\"\r\nmdconfig_md0_cmd=\"tar -xpz -C \/ -f \/conf\/base\/var.cpio.gz\"<\/code><\/pre>\n<h4>\/etc\/fstab<\/h4>\n<pre><code>\/dev\/md0 \/var ufs rw,noauto 0 0<\/code><\/pre>\n<h4>\/etc\/rc.shutdown.local<\/h4>\n<p>Whenever the system is shutdown, the snapshot must be updated with the current contents.<\/p>\n<pre><code>mv \/conf\/base\/var.cpio.gz \/conf\/base\/var.cpio.gz.old\r\ntar -cf \/conf\/base\/var.cpio.gz -C \/ --format cpio --gzip var<\/code><\/pre>\n<p>The above would also prove useful in crontab to safeguard for brownouts or system crashes. So add the following to root&#8217;s crontab.<\/p>\n<pre><code>0 * * * * \/bin\/sh \/etc\/rc.shutdown.local<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>On root filesystems that&#8217;s served from flash memory it may be advisable to keep off heavy writes from them. By putting \/var on a ramdrive you can greatly increase the expected lifetime of an ssd or a usb memorystick. Initial steps A snapshot of \/var needs to be created. On true diskless systems FreeBSD ramdrive <span class=\"ellipsis\">&hellip;<\/span> <span class=\"more-link-wrap\"><a href=\"\/wordpress\/freebsd\/diskless-var\/\" class=\"more-link\"><span>Read More &rarr;<\/span><\/a><\/span><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":[],"categories":[14],"tags":[31,35,11,36,37],"_links":{"self":[{"href":"https:\/\/wp.strahlert.net\/wordpress\/wp-json\/wp\/v2\/posts\/139"}],"collection":[{"href":"https:\/\/wp.strahlert.net\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/wp.strahlert.net\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/wp.strahlert.net\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/wp.strahlert.net\/wordpress\/wp-json\/wp\/v2\/comments?post=139"}],"version-history":[{"count":2,"href":"https:\/\/wp.strahlert.net\/wordpress\/wp-json\/wp\/v2\/posts\/139\/revisions"}],"predecessor-version":[{"id":141,"href":"https:\/\/wp.strahlert.net\/wordpress\/wp-json\/wp\/v2\/posts\/139\/revisions\/141"}],"wp:attachment":[{"href":"https:\/\/wp.strahlert.net\/wordpress\/wp-json\/wp\/v2\/media?parent=139"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/wp.strahlert.net\/wordpress\/wp-json\/wp\/v2\/categories?post=139"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/wp.strahlert.net\/wordpress\/wp-json\/wp\/v2\/tags?post=139"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}