{"action":"created","issue":{"url":"https://api.github.com/repos/trynd/wren/issues/10","labels_url":"https://api.github.com/repos/trynd/wren/issues/10/labels{/name}","comments_url":"https://api.github.com/repos/trynd/wren/issues/10/comments","events_url":"https://api.github.com/repos/trynd/wren/issues/10/events","html_url":"https://github.com/trynd/wren/issues/10","id":56276846,"number":10,"title":"Investigate ZFS and Btrfs","user":{"login":"codewithmichael","id":2614473,"avatar_url":"https://avatars.githubusercontent.com/u/2614473?v=3","gravatar_id":"","url":"https://api.github.com/users/codewithmichael","html_url":"https://github.com/codewithmichael","followers_url":"https://api.github.com/users/codewithmichael/followers","following_url":"https://api.github.com/users/codewithmichael/following{/other_user}","gists_url":"https://api.github.com/users/codewithmichael/gists{/gist_id}","starred_url":"https://api.github.com/users/codewithmichael/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/codewithmichael/subscriptions","organizations_url":"https://api.github.com/users/codewithmichael/orgs","repos_url":"https://api.github.com/users/codewithmichael/repos","events_url":"https://api.github.com/users/codewithmichael/events{/privacy}","received_events_url":"https://api.github.com/users/codewithmichael/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/trynd/wren/labels/enhancement","name":"enhancement","color":"c7def8"},{"url":"https://api.github.com/repos/trynd/wren/labels/help%20wanted","name":"help wanted","color":"e11d21"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":6,"created_at":"2015-02-02T18:51:37Z","updated_at":"2015-02-04T02:25:12Z","closed_at":null,"body":"This issue should store investigation notes on the potential advantages and disadvantages of using ZFS or Btrfs for writeable disk images, most notably including the active save data image.\r\n\r\nAs noted in issue #2, LVM snapshot functionality is currently broken (for Wren's purposes) in Ubuntu 14.04. Now is as good a time as any to look into the proposed alternatives (ZFS / Btrfs).\r\n\r\n[Version 0.1.1, `copy/save.sh`, lines 216-218](https://github.com/trynd/wren/blob/baac929ef701b75fe9b0488b3ce19d11fa8b3346/copy/save.sh#L216-218):\r\n```sh\r\n###\r\n### DISABLED: Snapshots with udev/overlayfs are currently broken in Ubuntu 14.04\r\n###\r\n```\r\n\r\n**Initial Notes:**\r\n* I believe they are both supported by the current kernel (though ZFS requires installing an additional kernel module, +1 for Btrfs).\r\n* Both ZFS and Btrfs provide snapshot functionality similar to what was previously accomplished with LVM.\r\n* They both support built-in file system compression, which could be a real bonus for on-disk save images as well as active save data (if the overhead is low enough).\r\n  * Compression may cause issues in determining storable data size, as `du` reports *disk usage*, not file size, which are significantly different in a compressed file system.\r\n* Without further investigation, I don't yet know if either works appropriately with resizable file system images as are currently used for active save data and snapshots.\r\n  * When LVM worked correctly, image size was increased and then the volume extents was expanded to match."},"comment":{"url":"https://api.github.com/repos/trynd/wren/issues/comments/72778830","html_url":"https://github.com/trynd/wren/issues/10#issuecomment-72778830","issue_url":"https://api.github.com/repos/trynd/wren/issues/10","id":72778830,"user":{"login":"codewithmichael","id":2614473,"avatar_url":"https://avatars.githubusercontent.com/u/2614473?v=3","gravatar_id":"","url":"https://api.github.com/users/codewithmichael","html_url":"https://github.com/codewithmichael","followers_url":"https://api.github.com/users/codewithmichael/followers","following_url":"https://api.github.com/users/codewithmichael/following{/other_user}","gists_url":"https://api.github.com/users/codewithmichael/gists{/gist_id}","starred_url":"https://api.github.com/users/codewithmichael/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/codewithmichael/subscriptions","organizations_url":"https://api.github.com/users/codewithmichael/orgs","repos_url":"https://api.github.com/users/codewithmichael/repos","events_url":"https://api.github.com/users/codewithmichael/events{/privacy}","received_events_url":"https://api.github.com/users/codewithmichael/received_events","type":"User","site_admin":false},"created_at":"2015-02-04T02:25:12Z","updated_at":"2015-02-04T02:25:12Z","body":"Today, as a proof of concept, I got a Btrfs variant of the save script working (with snapshots).\r\n\r\n[See commit](https://github.com/codewithmichael/wren/commit/86ee762a3dd4a457b54055124464e30036f766c3).\r\n\r\nSince it's not yet part of the boot process, testing the save script requires manually creating a Btrfs volume and root subvolume for the active data and manually populating it (or rsyncing in the save data) and bootstrapping the run environment with additional platform variables by copying in the new `platform.conf`.\r\n\r\nHopefully in the next day or two I'll get it booting on the Btrfs root subvolume instead of the LVM save volume. If everything works out as planned, we should be able to strip out all the LVM code/dependencies soon.\r\n\r\n**Applicable `save-btrfs.sh` test steps (run all commands as root):**\r\n* Boot new Wren instance\r\n* Clone repo and save a new save image\r\n* Build with `wrender`\r\n* Copy `initrd.img-*` and `platform-*` images into the new save's directory\r\n* Update `grub.cfg` (via `update-grub.sh`)\r\n* Boot the new save\r\n* Replace `/var/run/wren/conf/platform.conf` with the cloned `copy/platform.conf`\r\n* Create and format a sparse image file to store the Btrfs test volume:\r\n  * `dd if=/dev/zero of=/mnt/wren/xx-images/active.btrfs bs=1 seek=$((1024*1024*1024)) count=0`\r\n* Create and mount the Btrfs test volume and create root subvolume:\r\n  * `mkdir -p /mnt/wren/xx-volumes/active`\r\n  * ```loop_device=`losetup -f` ```\r\n  * `losetup \"$loop_device\" /mnt/wren/xx-images/active.btrfs`\r\n  * `mount \"$loop_device\" /mnt/wren/xx-volumes/active`\r\n  * `btrfs subvolume create /mnt/wren/xx-volumes/active/@`\r\n* Add test content to root subvolume, or rsync in active save data:\r\n  * `rsync -axHAXSv /mnt/wren/04-save/ /mnt/wren/xx-volumes/active/@`\r\n* Run the new save script — e.g.:\r\n  * `/etc/wren/save-btrfs.sh -s btrfs-test`"}}