Updating my partition for more memory for Nixos

Hi everyone,

New to the community but been using Nixos and nix for a couple of months now. I am running a dual boot of windows and linux and upon my initial portion for nixos I was limited to a certain amount of GiBs. I was wondering now since I am more comfertable with nixos if I can allocate more disk space to linux from my windows boot.

What is your current partition layout? I would normally recommend shrinking the main Windows partition with Windows tools, then expand the Linux partition with something gparted.

Hi sorry to get back late! Here my partition: jerryarg@jerryarg ~> sudo lsblk -f
[sudo] password for jerryarg:
NAME FSTYPE FSVER LABEL UUID FSAVAIL FSUSE% MOUNTPOINTS
zram0 swap 1 zram0 56c3a93a-485d-428c-b701-71f6c66ea46d [SWAP]
nvme0n1
├─nvme0n1p1 vfat FAT32 B0A4-8F1E
├─nvme0n1p2
├─nvme0n1p3 ntfs B094A51B94A4E4D6
├─nvme0n1p4 ntfs 0C9C56BD9C56A14E
├─nvme0n1p5 vfat FAT32 boot 72F1-9B66 983.1M 4% /boot
├─nvme0n1p6 swap 1 4d026114-630a-48a9-a451-8f5395e30e9f [SWAP]
└─nvme0n1p7 ext4 1.0 root 975c0da6-fe37-4225-9470-e4444caf52f3 329.8G 7% /nix/store
/
jerryarg@jerryarg ~>

This is not going to be straightforward due to how Windows adds extra partitions. Since I’m guessing that nvme0n1p3 is your main Windows partition (where all the extra space is to switched from), you will need to do something like this:

  1. shrink nvme0n1p3, using Windows-based tools, then resize the filesystem to match the current space. The free space MUST be after nvme0n1p3 (NOTE: the usage of Windows tools is a recommendation, not a hard requirement).

These steps can be done with Linux-based tools, like gparted:

  1. move nvme0n1p4 above the current free space
  2. move nvme0n1p5 above the current free space, just below nvme0n1p4
  3. move nvme0n1p6 above the current free space, just below nvme0n1p5
  4. expand nvme0n1p7 with the free space, then resize the partition

I’ve done this many times, until I finally decided to move my Windows install to a separate disk. I’m not a fan of having (2) boot partitions on the same disk; this is just asking for trouble. Since you’re not adding/subtracting any partitions, your Nix config won’t be affected.

1 Like