{"id":380,"date":"2015-09-17T20:50:16","date_gmt":"2015-09-18T00:50:16","guid":{"rendered":"http:\/\/deadpelican.com\/wordpress\/?p=380"},"modified":"2015-09-17T20:51:37","modified_gmt":"2015-09-18T00:51:37","slug":"save-buttons-and-backups","status":"publish","type":"post","link":"https:\/\/deadpelican.com\/wordpress\/?p=380","title":{"rendered":"Save buttons and backups."},"content":{"rendered":"<p>It seems to me that it&#8217;s gotten to the point where we don&#8217;t need a save button anymore.<br \/>\nActually I think this happened a long time ago, but we are all so hung up on our save buttons.<br \/>\nIn windows programs you&#8217;ll see (although I don&#8217;t use windows much so maybe this isn&#8217;t true anymore) that the icon for the save button is a picture of a 3.5 inch disk. An item that is so far out of use that amazon charges $1.50 for one of them, after they showcase all of the discontinued listings.<br \/>\nBut what is the save button for? It takes the data in memory and puts it on disk.<br \/>\nWhy can&#8217;t the computer do this by itself? Why can&#8217;t it permanently record every bit of work you do, so you won&#8217;t lose it?<br \/>\nWell, the classic argument is that if you screw up what&#8217;s in memory you can fall back to the last saved version.<br \/>\nA valuable technique for sure, but you only get one version of history and it is easily wiped away if you accidentally hit save. It&#8217;s hard to argue that the save button is a serious archival data system.<\/p>\n<p>My point is that computers have gotten complex enough and fast enough and disk is so cheap and voluminous that there&#8217;s no reason the computer can&#8217;t keep track of all of your history since the dawn of time.<br \/>\nSome applications provide this functionality, I think ms office products do, and I know eclipse has a built in local history feature, but these are limited to specific applications.<\/p>\n<p>But it turns out there&#8217;s a way to provide this history for everything you do, it&#8217;s called zfs snapshots.<br \/>\nAlas I don&#8217;t think they&#8217;ve ported zfs to windows, and a little poking around says they&#8217;re not going to implement btrfs either, but what you can do is set up a virtual machine running some form of linux that exposes a samba share attached to a zfs drive.<br \/>\nAnd just have the drive take snapshots every minute.<br \/>\nIt only stores the deltas, so it will take you quite a while to fill up a $50 terabyte drive.<\/p>\n<p>I&#8217;m a linux guy so I use it for everything. I&#8217;ve gotten into the habit of storing everything in my home directory, so I made my home directory a zfs filesystem and I run these scripts to snapshot every minute of use, and I never lose anything&#8230;<br \/>\nhttps:\/\/github.com\/nixomose\/scripts\/tree\/master\/zfs<br \/>\nhttps:\/\/github.com\/nixomose\/zfs-scripts\/tree\/master\/scripts<\/p>\n<p>Can&#8217;t say enough good things about zfs.<\/p>\n<p>I had to take some notes for the process of converting my home directory to be a zfs filesystem.<\/p>\n<p>There&#8217;s docs on how to make your root filesystem a zfs filesystem, but it&#8217;s a real complicated hassle, and does it really matter if \/var\/ and \/run and \/usr are on zfs? That stuff doesn&#8217;t change much, and you can reinstall it. The valuable stuff you want to backup and archive is usually in your home directory.<\/p>\n<p>So firstly, google and mozilla make a big mess of your home directory, via the .cache and .mozilla directories. You&#8217;re better off moving those outside of your home directory and making symlinks to them.<\/p>\n<p>So here&#8217;s a cheatsheet list of things I did to make a zfs volume out of my home directory:<\/p>\n<p>(presuming you&#8217;re using all of your disk space, and need to make room for the zfs pool)<br \/>\nboot live cd<br \/>\nshrink \/<br \/>\nmake new partition, leave blank<\/p>\n<p>reboot to your machine again, make sure everything is sane.<\/p>\n<p>I use ubuntu, your mileage will vary with distro&#8230;<\/p>\n<p>add-apt-repository ppa:zfs-native\/stable<br \/>\napt-get update<br \/>\napt-get install ubuntu-zfs<br \/>\nmodprobe zfs<br \/>\ncd \/home\u00a0 (don&#8217;t tie up your home dir by having it as your current directory)<\/p>\n<p>sudo su<\/p>\n<p>mv username oldusername<\/p>\n<p>(assuming \/dev\/sda5 is your freed-up partition space)<\/p>\n<p>zpool create zhome \/dev\/sda5 -m \/home\/username<\/p>\n<p>(this alone is worth the price of admission&#8230;)<br \/>\nzfs set compression=lz4 zhome<br \/>\ncd ..\/oldusername<br \/>\nmv .* * ..\/username\/<br \/>\nchown username:username username<br \/>\nreboot just to make sure zfs automounts it.<\/p>\n<p>and now you can add the backupnotidle script here for added fun.<\/p>\n<p>https:\/\/github.com\/nixomose\/scripts\/tree\/master\/zfs<\/p>\n<p>&nbsp;<\/p>\n","protected":false},"excerpt":{"rendered":"<p>It seems to me that it&#8217;s gotten to the point where we don&#8217;t need a save button anymore. Actually I think this happened a long time ago, but we are all so hung up on our save buttons. In windows programs you&#8217;ll see (although I don&#8217;t use windows much so maybe this isn&#8217;t true anymore) [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[1],"tags":[],"class_list":["post-380","post","type-post","status-publish","format-standard","hentry","category-notes"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/deadpelican.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/380","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/deadpelican.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/deadpelican.com\/wordpress\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/deadpelican.com\/wordpress\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/deadpelican.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=380"}],"version-history":[{"count":3,"href":"https:\/\/deadpelican.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/380\/revisions"}],"predecessor-version":[{"id":384,"href":"https:\/\/deadpelican.com\/wordpress\/index.php?rest_route=\/wp\/v2\/posts\/380\/revisions\/384"}],"wp:attachment":[{"href":"https:\/\/deadpelican.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=380"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/deadpelican.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=380"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/deadpelican.com\/wordpress\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=380"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}