Moving the home partition to a seperate drive after installation

Hi all, im a newb to NixOS, Ive been using it for 8 days as I write this.

The hardware im using is a 8yo Asus 302ca Flip chromebook, firmware and bios flashed to Coreboot.
Its only got a 32gb soldered on storage and id like to move the hone partition to a 64gb micro sd.

What caveats should i be aware of before trying to move my home partition?

Im assuming that there will have to be some adfitions to the configuration.nix and hardware-configuration.nix.

Is there documentation i haven been able to find?

Extra info, I have only started looking into flakes and home-manager in the last 18 hours.

Thanks in advance for your help and support

These instructions assume

  • you want your home directory to be at the root of the separate drive
  • you have already copied your files to the new drive
  • you know either the UUID or label of your new drive
    If those assumptions aren’t true, let us know and we can help more.

Move your current home folder out of the way so you can delete it once the new setup is working. You might want to do this by logging in as root, then renaming the folder.

Edit your /etc/nixos/hardware-configuration.nix (make a backup copy first!), and add something like the following. In this example, my account name is “amy” so I want my home folder to be at /home/amy, my drive is labeled “burrow”, and it is an ext4 partition.

  fileSystems."/home/amy" =
    { device = "/dev/disk/by-label/burrow";
      fsType = "ext4";

The device could reference the drive by UUID, for example /dev/disk/by-uuid/520F-2F33 or /dev/disk/by-uuid/a9267a30-7924-4fcc-8b92-edf85d6b9b17.

Reboot and enjoy!

Thank you so much. I was looking at the hardware-configuration.nix, thinking hmmmm! And you given me the confidence.

Standard disclaimers apply - you’re not responsible i mess it up and ive done me backups

1 Like