Skip to content

Partitioning Disks for NixOS

In order to use NixOS, you will have to initially partition the allocated disk space for the NixOS installation. I prefer to do this manually because it’s only a one-time setup and it’s easier to set up. However, you can also use tools like disko to declaratively partition your disks.

  1. Partition the disk using parted or fdisk. For example, if you have a disk at /dev/sda, you can use the following command:

    Terminal window
    sudo parted /dev/sda -- mklabel msdos
    sudo parted /dev/sda -- mkpart primary ext4 1MiB 100%
  2. Format the partition:

    Terminal window
    sudo mkfs.ext4 -L nixos /dev/sda1
  3. Mount the partition:

    Terminal window
    sudo mount /dev/sda1 /mnt
References