Giter Club home page Giter Club logo

nixos-zfs-setup's Introduction

nixos-zfs-setup.sh

Hello, world!

This is a script that sets up new zfs storage pools on your disk(s), for use with NixOS. It zaps the partition table(s), creates new partitions, sets up two storage pools (named bpool and rpool by default), and prepares them for NixOS installation.

This is a proof of concept and not for beginners. You are free to modify the commands. The shell code shouldn't be too hard to understand.

This script is based on the instructions from the NixOS Root on ZFS website, with a few deviations and exceptions:

  • It creates the partitions in a different (more sane) order;
  • It names the partitions in the GPT table it creates;
  • It uses /dev/disk/by-partname rather than /dev/disk/by-id/* or /dev/disk/by-path/*;
  • It (currently) does not support disk encryption;
  • It supports impermanence. Read: Erase Your Darlings;
  • It always allocates one or more swap partitions.

How to use this script

  1. Boot the NixOS liveCD
  2. If not using DHCP, set up networking inside the live environment.
  3. Open a terminal and login as root: sudo login -f root
  4. Set a password: passwd
  5. Restart sshd: systemctl restart sshd.service
  6. ssh into the shell as root: ssh [email protected]
  7. git clone this repository
  8. Edit the variables in nixos-zfs-setup.sh
  9. Optional: wipe existing partitions from the disk with wipefs -af /dev/...
  10. Run the script: bash ./nixos-zfs-setup.sh and....
  11. Hope for the best!

When the script has finished, it will tell you some commands to run next. Do this by hand. It's best to open another shell and run those commands in there, because the first command will output a lot of text and you might lose the other commands. Eventually I'll get around to improve this.

Tested with:

Qemu and vmware guests. I plan to test it on hardware when I have a chance to. This may take a long time because I have plenty of other NixOS related stuff to figure out first.

Todo

  • Add encryption.

Feedback

Feedback is thankfully welcomed on the github issue tracker.

Blurb

Copyright © Mark van Dijk, 2022, The Netherlands. This product is licensed under the GPLv3. It comes with ABSOLUTELY NO WARRANTY. This is free software, and you are welcome to redistribute it under certain conditions; see the LICENSE file for more information.

nixos-zfs-setup's People

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.