Skip to content

Instantly share code, notes, and snippets.

@NoobTaco
Last active May 31, 2025 20:50
Show Gist options
  • Save NoobTaco/71cc9b7ce52e807e27de3ff298902197 to your computer and use it in GitHub Desktop.
Save NoobTaco/71cc9b7ce52e807e27de3ff298902197 to your computer and use it in GitHub Desktop.
Comprehensive Disk Layout and Installation Plan (CachyOS with Limine and Btrfs/Snapper

Comprehensive Disk Layout and Installation Plan (CachyOS with GRUB, Btrfs/Snapper)

This guide provides a detailed plan for your fresh system install, incorporating your specific drive usage, CachyOS with Btrfs for snapshots, and the GRUB bootloader, accounting for the Calamares installer.


Summary of Your Desired Disk Layout:

  • /dev/sda (SanDisk SSD PLUS 931.5G): Scratch/test drive for Linux installs. (Will be ignored for this main plan, as you'll use it for temporary installs.)
  • /dev/sdb (Samsung SSD 850 931.5G): Dedicated developers' files drive for Linux. (Will be formatted.)
  • /dev/sdd (Elements 9.1T External HDD): External backup drive. (Will NOT be formatted, will be ignored for the main plan.)
  • /dev/nvme0n1 (Force MP600 931.5G NVMe SSD): Fresh Windows 11 install. (Existing data will be overwritten by Windows installer.)
  • /dev/nvme1n1 (WD_BLACK SN850X 1.8T NVMe SSD): Gaming and media drive. (Will NOT be formatted, needs to be mounted.)
  • /dev/nvme2n1 (Samsung SSD 990 EVO Plus 1.8T NVMe SSD): Root Linux (CachyOS/Arch) install with a dedicated /home (via Btrfs subvolume). (Will be formatted.)

Operating System: CachyOS (Arch Linux based) Desktop Environment/WM: Hyprland User & Hostname: * Linux Username: mike * Linux Hostname: hyprwulf * Windows Computer Name: HYPRWULF-WIN (or similar) Special Requirements: Dedicated /home directory (as a Btrfs subvolume) for distro hopping/reinstalls, Btrfs snapshots with Snapper, GRUB bootloader with snapshot booting capability.


Important Considerations Before You Begin:

  • Backup: Crucially, back up all important data from /dev/sdb, /dev/nvme0n1, and /dev/nvme2n1 before proceeding. While I'm outlining formatting, accidents can happen. Your /dev/sdd and /dev/nvme1n1 drives should be safe if you follow the instructions carefully, but it's always good practice to have backups.
  • UEFI Mode: Ensure your system is configured to boot in UEFI mode, as modern Linux and Windows installations primarily use this.
  • Boot Order: After installing both Windows and Linux, you might need to adjust the boot order in your BIOS/UEFI settings to prioritize GRUB or use the BIOS boot menu to select your OS. GRUB will be configured to detect and boot Windows.

1. Windows 11 Installation on /dev/nvme0n1

Drive: /dev/nvme0n1 (Force MP600 931.5G NVMe SSD) Action: Fresh install of Windows 11.

Steps during Windows Installation:

  1. Boot from your Windows 11 installation media.
  2. During the installation process, when you reach the "Where do you want to install Windows?" screen, select /dev/nvme0n1.
  3. Choose the option to "Delete" all existing partitions on /dev/nvme0n1.
  4. Then, select the "Unallocated Space" on /dev/nvme0n1 and click "Next." Windows will automatically create the necessary partitions (EFI System Partition, MSR, Windows Primary partition, Recovery Partition) for its installation.
  5. Proceed with the Windows installation as usual. During the Windows setup, when prompted to name your computer, choose HYPRWULF-WIN (or HYPRWULF-PC, HYPRWULF-W11, etc., as you prefer).
  6. Complete the Windows installation.

Expected Partitions (created by Windows):

  • /dev/nvme0n1p1 (EFI System Partition - FAT32, ~100-300MB) <- This is the EFI partition we will share with Linux.
  • /dev/nvme0n1p2 (Microsoft Reserved Partition - MSR, ~16MB, hidden)
  • /dev/nvme0n1p3 (Windows C: Drive - NTFS, remaining space)
  • /dev/nvme0n1p4 (Windows Recovery Environment - NTFS, ~500MB-1GB)

2. Linux (CachyOS/Arch) Installation using Calamares

Drive: /dev/nvme2n1 (Samsung SSD 990 EVO Plus 1.8T NVMe SSD) - Linux OS Drive: /dev/sdb (Samsung SSD 850 931.5G) - Developers Files

Filesystem Choices:

  • Root (/) and Home (/home): btrfs with subvolumes. This allows for efficient snapshots of your system and user data.
  • Swap: A dedicated swap partition. Your current 68GB is quite large.
  • EFI System Partition (/boot/efi): Must be FAT32. We will use the one created by Windows on /dev/nvme0n1p1. This partition will store GRUB's EFI files.
  • Developers Files (/mnt/devfiles): ext4 is a good choice for Linux-specific development files.

Calamares Installation Steps (Key Points):

  1. Boot from your CachyOS Live USB.

  2. Start the Calamares installer.

  3. Proceed through the initial steps (language, region, keyboard).

  4. User Information Step:

    • When prompted for your username, enter: mike
    • Set your password as desired.
  5. Computer Name (Hostname) Step:

    • When prompted for the computer name (hostname), enter: hyprwulf
  6. Partitioning Step: This is the most critical part. Choose the "Manual Partitioning" or "Replace a partition" (if applicable) option.

    • For /dev/nvme2n1 (Your Linux OS Drive):

      • Select /dev/nvme2n1. You will need to delete all existing partitions on this drive to start fresh.
      • Create a new Swap partition:
        • Size: 68GB (or your preferred size. Adjust based on your RAM and if you need hibernation).
        • Filesystem: linuxswap
        • Flag: swap
      • Create a new Btrfs partition:
        • Size: Remaining space on /dev/nvme2n1.
        • Filesystem: btrfs
        • Mount Point: Set this to / (root). If Calamares has advanced options for Btrfs subvolume creation (e.g., for @ and @home), use them. However, many installers will just format the partition as Btrfs root. In this case, you will perform the subvolume creation after the main installation (see "Post-Installation Btrfs Subvolume Setup" below). Do NOT create separate / and /home partitions on /dev/nvme2n1 if you want Btrfs subvolumes for Snapper on the same partition.
    • For /dev/nvme0n1p1 (Shared EFI System Partition):

      • Locate /dev/nvme0n1p1 (the EFI partition already created by Windows).
      • Select its mount point as /boot/efi.
      • Crucially, ensure the "Format" checkbox for this partition is UNCHECKED. You want to reuse the existing EFI partition, not format it, as it contains your Windows boot files.
    • For /dev/sdb (Developers Files Drive):

      • Select /dev/sdb. You will need to delete all existing partitions on this drive.
      • Create a new partition:
        • Size: All remaining space on /dev/sdb.
        • Filesystem: ext4.
        • Mount Point: /mnt/devfiles (you might need to type this in if it's not a standard option in Calamares).
  7. Bootloader Selection:

    • When Calamares prompts you to choose a bootloader, select GRUB.
    • It will ask you where to install the bootloader. Select /dev/nvme0n1p1 (your shared EFI System Partition). Calamares will install GRUB's EFI executable here alongside the Windows Boot Manager.
  8. Review and Install: Carefully review your proposed partition layout and settings within Calamares. Once you're confident, click "Install" to begin the installation process.


Post-Installation Btrfs Subvolume Setup for CachyOS (Crucial for Snapper & GRUB-Btrfs)

Even with Calamares, it's common for the installer to place the entire system directly on the root of the Btrfs partition (/dev/nvme2n1p2) rather than into designated subvolumes like @ and @home. For optimal Snapper and grub-btrfs integration, you'll need to set up these subvolumes.

You'll need to boot back into the CachyOS live environment after the Calamares installation is complete but before you attempt to boot into your newly installed system.

  1. Identify your main Btrfs partition: This should be /dev/nvme2n1p2.
  2. Mount the main Btrfs partition's root to a temporary location (e.g., /mnt):
    sudo mount /dev/nvme2n1p2 /mnt
  3. Move the initially installed system files into a temporary subvolume (e.g., @old_root):
    sudo btrfs subvolume create /mnt/@old_root
    sudo mv /mnt/* /mnt/.??* /mnt/@old_root/ # Move everything into the temporary subvolume
  4. Create the actual @ (for root) and @home (for user data) subvolumes:
    sudo btrfs subvolume create /mnt/@
    sudo btrfs subvolume create /mnt/@home
    # For grub-btrfs and Snapper, it's often recommended to put the snapshots here:
    sudo btrfs subvolume create /mnt/@snapshots
  5. Move the contents from the temporary subvolume (@old_root) into the new @ subvolume:
    sudo mv /mnt/@old_root/* /mnt/@/
    sudo mv /mnt/@old_root/.??* /mnt/@/ # To also move dotfiles/directories
  6. Delete the temporary subvolume:
    sudo btrfs subvolume delete /mnt/@old_root
  7. Unmount the Btrfs partition and remount it with the subvol=@ option for your new root:
    sudo umount /mnt
    sudo mount -o subvol=@,noatime,compress=zstd /dev/nvme2n1p2 /mnt
  8. Mount the @home subvolume:
    sudo mkdir -p /mnt/home
    sudo mount -o subvol=@home,noatime,compress=zstd /dev/nvme2n1p2 /mnt/home
  9. Mount the @snapshots subvolume:
    sudo mkdir -p /mnt/.snapshots
    sudo mount -o subvol=@snapshots,noatime,compress=zstd /dev/nvme2n1p2 /mnt/.snapshots
  10. Mount the shared EFI System Partition (/dev/nvme0n1p1):
    sudo mkdir -p /mnt/boot/efi
    sudo mount /dev/nvme0n1p1 /mnt/boot/efi
  11. Edit /etc/fstab (within your new root, i.e., /mnt/etc/fstab):
    • Ensure your fstab has the following correct entries. You can get the UUIDs using lsblk -f.
      • For / (root): UUID=<UUID_of_nvme2n1p2> / btrfs defaults,noatime,compress=zstd,subvol=@ 0 0
      • For /home: UUID=<UUID_of_nvme2n1p2> /home btrfs defaults,noatime,compress=zstd,subvol=@home 0 0
      • For /boot/efi: UUID=<UUID_of_nvme0n1p1> /boot/efi vfat umask=0077 0 2
      • For [SWAP]: UUID=<UUID_of_nvme2n1p1> none swap sw 0 0
      • For /.snapshots: UUID=<UUID_of_nvme2n1p2> /.snapshots btrfs defaults,noatime,compress=zstd,subvol=@snapshots 0 0

3. Mounting Existing Drives (Post-Installation)

Once your CachyOS system is installed and you've successfully booted into it, you'll configure these drives.

  • /dev/sdb (Developers Files Drive):

    • Filesystem: ext4
    • Mount Point: /mnt/devfiles
    • Action: Add the following entry to /etc/fstab (edit it as root, e.g., sudo nano /etc/fstab):
      UUID=your_sdb1_uuid /mnt/devfiles ext4 defaults,nofail 0 2
      
      (Replace your_sdb1_uuid with the actual UUID from lsblk -f. Create the mount point: sudo mkdir -p /mnt/devfiles)
  • /dev/nvme1n1p1 (Gaming & Media Drive):

    • Filesystem: ext4
    • Mount Point: /mnt/GamesMedia
    • Action: Add the following entry to /etc/fstab (edit it as root, e.g., sudo nano /etc/fstab):
      UUID=your_nvme1n1p1_uuid /mnt/GamesMedia ext4 defaults,nofail 0 2
      
      (Replace your_nvme1n1p1_uuid with the actual UUID from lsblk -f. Create the mount point: sudo mkdir -p /mnt/GamesMedia)
  • /dev/sdd1 (External Backup Drive):

    • Filesystem: ntfs
    • Mount Point: /mnt/Elements
    • Action: Add to /etc/fstab if you want it to mount automatically at boot, or mount manually when needed. For automatic mounting and user access, use:
      UUID=your_sdd1_uuid /mnt/Elements ntfs-3g defaults,nofail,uid=1000,gid=1000 0 0
      
      (Replace your_sdd1_uuid and adjust uid/gid if your user ID is different. Create mount point: sudo mkdir -p /mnt/Elements)

4. Snapper and GRUB-Btrfs Configuration (Post-Installation)

CachyOS defaults to installing snapper. You'll now configure Snapper and grub-btrfs to work together.

Basic Snapper Setup:

  1. Install Snapper and grub-btrfs (if not already present): sudo pacman -S snapper btrfs-progs grub-btrfs inotify-tools (CachyOS likely pre-installs snapper and btrfs-progs, but grub-btrfs and inotify-tools might need manual installation).

  2. Disable the default root Snapper config: (This is because your / is now @) sudo snapper -c root delete

  3. Create Snapper configurations for your root (@) and home (@home) subvolumes: sudo snapper -c root create-config / sudo snapper -c home create-config /home This will create config files in /etc/snapper/configs/root and /etc/snapper/configs/home.

  4. Adjust Snapper configuration (optional but recommended for grub-btrfs): Edit /etc/snapper/configs/root.

    • Ensure SUBVOLUME is set to / (this will be correctly interpreted as the mounted @ subvolume).
    • Make sure ALLOW_USERS = "yes" if you want non-root users to manage home snapshots.
    • Adjust TIMELINE_LIMIT_HOURLY, TIMELINE_LIMIT_DAILY, NUMBER_CLEANUP etc., as desired.
    • Crucial for grub-btrfs: Ensure Snapper saves snapshots to the /.snapshots directory which points to your @snapshots subvolume. By default snapper -c root create-config / should set SNAPPER_CONFIGS_DIR="/.snapshots", which is usually fine if /.snapshots is mounted.
  5. Enable Snapper services for automatic snapshots and cleanup: sudo systemctl enable snapper-timeline.timer sudo systemctl enable snapper-cleanup.timer sudo systemctl start snapper-timeline.timer sudo systemctl start snapper-cleanup.timer

Configuring grub-btrfs:

  1. grub-btrfs automatically scans for snapshots in / (which is @) and /.snapshots (which is @snapshots).
  2. Generate GRUB configuration: sudo grub-mkconfig -o /boot/grub/grub.cfg This command should now detect your Windows installation, your main Linux installation, and (if snapshots exist) a new submenu for Btrfs snapshots.
  3. Enable grub-btrfs daemon (optional but recommended): To automatically update the GRUB menu when snapshots are created/deleted, enable the grub-btrfs service: sudo systemctl enable grub-btrfs.path sudo systemctl start grub-btrfs.path This uses inotify to monitor changes in your snapshot directories and trigger grub-mkconfig.

Taking Snapshots Manually:

  • sudo snapper -c root create -d "Description of root snapshot"
  • sudo snapper -c home create -d "Description of home snapshot"

Listing Snapshots:

  • sudo snapper -c root list
  • sudo snapper -c home list

Rolling Back a Snapshot (Conveniently from GRUB):

  1. Reboot your computer.
  2. In the GRUB boot menu, you should now see an entry like "CachyOS Linux" and potentially a new entry like "CachyOS Linux (snapshots)" or similar.
  3. Select the "snapshots" entry (or navigate into the submenu if it's there).
  4. You will see a list of your root snapshots, often identified by their number and creation date/description.
  5. Select the desired snapshot and boot into it. This will boot your system into that previous, read-only state.

Performing a Permanent Rollback (after booting into a good snapshot):

  1. Boot into a known good snapshot via GRUB.
  2. Open a terminal.
  3. Identify the number of the snapshot you booted into. You can find this by checking sudo btrfs subvolume get-default / or by looking at the GRUB menu entry's ID, or by listing snapshots: sudo snapper -c root list.
  4. Perform the rollback (example assuming you booted into snapshot 123):
    sudo mount -o subvolid=0 /dev/nvme2n1p2 /mnt_btrfs_root # Mount the top-level Btrfs filesystem
    sudo btrfs subvolume delete /mnt_btrfs_root/@ # Delete the current live root subvolume
    sudo btrfs subvolume snapshot /mnt_btrfs_root/@snapshots/123/snapshot /mnt_btrfs_root/@ # Create a writable copy of the snapshot and name it @
    sudo reboot
    Note: The exact path to your snapshot (e.g., /mnt_btrfs_root/@snapshots/123/snapshot) might vary slightly depending on how Snapper names them. Use sudo btrfs subvolume list -t /mnt_btrfs_root to verify paths.

Important Note: If you created separate @var_log or other subvolumes, they won't be part of the @ snapshot. You might need to handle those separately if you rolled back the root and those independent subvolumes contained critical data you didn't want to revert. However, for most users, @ and @home (if home is separate) is sufficient and makes rollbacks straightforward.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment