Save buttons and backups.

It seems to me that it’s gotten to the point where we don’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’ll see (although I don’t use windows much so maybe this isn’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.
But what is the save button for? It takes the data in memory and puts it on disk.
Why can’t the computer do this by itself? Why can’t it permanently record every bit of work you do, so you won’t lose it?
Well, the classic argument is that if you screw up what’s in memory you can fall back to the last saved version.
A valuable technique for sure, but you only get one version of history and it is easily wiped away if you accidentally hit save. It’s hard to argue that the save button is a serious archival data system.

My point is that computers have gotten complex enough and fast enough and disk is so cheap and voluminous that there’s no reason the computer can’t keep track of all of your history since the dawn of time.
Some 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.

But it turns out there’s a way to provide this history for everything you do, it’s called zfs snapshots.
Alas I don’t think they’ve ported zfs to windows, and a little poking around says they’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.
And just have the drive take snapshots every minute.
It only stores the deltas, so it will take you quite a while to fill up a $50 terabyte drive.

I’m a linux guy so I use it for everything. I’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…
https://github.com/nixomose/scripts/tree/master/zfs
https://github.com/nixomose/zfs-scripts/tree/master/scripts

Can’t say enough good things about zfs.

I had to take some notes for the process of converting my home directory to be a zfs filesystem.

There’s docs on how to make your root filesystem a zfs filesystem, but it’s a real complicated hassle, and does it really matter if /var/ and /run and /usr are on zfs? That stuff doesn’t change much, and you can reinstall it. The valuable stuff you want to backup and archive is usually in your home directory.

So firstly, google and mozilla make a big mess of your home directory, via the .cache and .mozilla directories. You’re better off moving those outside of your home directory and making symlinks to them.

So here’s a cheatsheet list of things I did to make a zfs volume out of my home directory:

(presuming you’re using all of your disk space, and need to make room for the zfs pool)
boot live cd
shrink /
make new partition, leave blank

reboot to your machine again, make sure everything is sane.

I use ubuntu, your mileage will vary with distro…

add-apt-repository ppa:zfs-native/stable
apt-get update
apt-get install ubuntu-zfs
modprobe zfs
cd /homeĀ  (don’t tie up your home dir by having it as your current directory)

sudo su

mv username oldusername

(assuming /dev/sda5 is your freed-up partition space)

zpool create zhome /dev/sda5 -m /home/username

(this alone is worth the price of admission…)
zfs set compression=lz4 zhome
cd ../oldusername
mv .* * ../username/
chown username:username username
reboot just to make sure zfs automounts it.

and now you can add the backupnotidle script here for added fun.

https://github.com/nixomose/scripts/tree/master/zfs

 

Leave a Reply