Giter VIP home page Giter VIP logo

disko's Introduction

disko - Declarative disk partitioning

Project logo

Documentation Index

NixOS is a Linux distribution where everything is described as code, with one exception: during installation, the disk partitioning and formatting are manual steps. disko aims to correct this sad 🤡 omission.

This is especially useful for unattended installations, re-installation after a system crash or for setting up more than one identical server.

Overview

disko can either be used after booting from a NixOS installer, or in conjunction with nixos-anywhere if you're installing remotely.

Before using disko, the specifications of the disks, partitions, type of formatting and the mount points must be defined in a Nix configuration. You can find examples of typical configurations in the Nix community repository, and use one of these as the basis of your own configuration.

You can keep your configuration and re-use it for other installations, or for a system rebuild.

disko is flexible, in that it supports most of the common formatting and partitioning options, including:

  • Disk layouts: GPT, MBR, and mixed.
  • Partition tools: LVM, mdadm, LUKS, and more.
  • Filesystems: ext4, btrfs, ZFS, bcachefs, tmpfs, and others.

It can work with these in various configurations and orders, and supports recursive layouts.

How to use disko

Disko doesn't require installation: it can be run directly from nix-community repository. The Quickstart Guide documents how to run Disko in its simplest form when installing NixOS.

For information on other use cases, including upgrading from an older version of disko, using disko without NixOS and downloading the module, see the How To Guide

For more detailed options, such as command line switches, see the Reference Guide

To access sample configurations for commonly-used disk layouts, refer to the examples provided.

Sample Configuration and CLI command

A simple disko configuration may look like this:

{
 disko.devices = {
  disk = {
   my-disk = {
    device = "/dev/sda";
    type = "disk";
    content = {
     type = "gpt";
     partitions = {
      ESP = {
       size = "500M";
       content = {
        type = "filesystem";
        format = "vfat";
        mountpoint = "/boot";
       };
      };
      root = {
       size = "100%";
       content = {
        type = "filesystem";
        format = "ext4";
        mountpoint = "/";
       };
      };
     };
    };
   };
  };
 };
}

If you'd saved this configuration in /tmp/disko-config.nix, and wanted to create a disk named /dev/nvme0n1, you would run the following command to partition, format and mount the disk.

sudo nix --experimental-features "nix-command flakes" run github:nix-community/disko -- --mode disko /tmp/disko-config.nix

Related Tools

This tool is used by nixos-anywhere, which carries out a fully-automated remote install of NixOS.

We also acknowledge https://github.com/NixOS/nixpart, the conceptual ancestor of this project.

Licensing and Contribution details

This software is provided free under the MIT Licence.

If you would like to become a contributor, please see our contribution guidelines.


This project is supported by Numtide. Untitledpng

We are a team of independent freelancers that love open source.  We help our customers make their project lifecycles more efficient by:

  • Providing and supporting useful tools such as this one
  • Building and deploying infrastructure, and offering dedicated DevOps support
  • Building their in-house Nix skills, and integrating Nix with their workflows
  • Developing additional features and tools
  • Carrying out custom research and development.

Contact us if you have a project in mind, or if you need help with any of our supported tools, including this one. We'd love to hear from you.

disko's People

Contributors

lassulus avatar mic92 avatar github-actions[bot] avatar bors[bot] avatar phaer avatar blaggacao avatar dependabot[bot] avatar rogarb avatar lilyinstarlight avatar cvoges12 avatar makefu avatar 4z3 avatar cscutcher avatar janik-haag avatar truenaho avatar l0b0 avatar mergify[bot] avatar jillthornhill avatar supersandro2000 avatar zimbatm avatar matthewcroughan avatar rosscomputerguy avatar rudolfvesely avatar a-kenji avatar technofab11 avatar stunkymonkey avatar fricklerhandwerk avatar enzime avatar ma27 avatar baitinq avatar

Stargazers

Sam Lehman avatar

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.