> ## Knowledge Base Index
> Fetch the complete knowledge base index at: https://helpdesk.ggcircuit.com/sitemap.xml
> Use this file to discover available pages before exploring further.
> Pure-Markdown content can be obtained by appending a '.md' suffix to the content URLs listed in the sitemap (without the trailing slash).

# Appendix II: 🛠️ Installing Debian on a Software RAID1 Array (with GRUB Redundancy)

This guide walks you through installing Debian onto a RAID1 array using either the **Debian Installer** or manually with `mdadm`, and ensures **GRUB is installed on both drives**—so your system can keep booting even if one disk fails 🚀

---

## ✨ Option 1: Using the Debian Installer (Easiest Way)

The Debian Installer includes built-in support for software RAID. Here’s how to do it:

### 1. Boot the Debian installer

Use a standard Debian ISO. Advanced users may prefer the *netinst* version.

### 2. Choose manual partitioning

When prompted, select:

```
Guided – use entire disk and set up LVM → Manual
```

### 3. Prepare RAID partitions

On **each disk**:

* Create identical partitions (e.g., 500MB EFI, 20GB root, etc.)
* Set partition type to: `Use as: physical volume for RAID`

### 4. Create the RAID1 array

Select **“Configure software RAID”**, then:

* Create new MD device → RAID1
* Select the matching partitions from both disks (e.g., sda1 + sdb1 for /boot)

Repeat this for each volume (e.g., root, swap).

> 💡 Tip: Avoid placing the EFI partition in RAID—keep EFI on each drive separately.

### 5. Assign filesystems

Assign your mount points (`/`, `/boot`, `swap`) on the new RAID volumes.

### 6. Proceed with installation

Continue until Debian is fully installed.

---

## ⚙️ Add GRUB to Both Disks (Required for RAID1 Boot Redundancy)

After the system reboots:

1. Open a terminal and run:

```
   sudo grub-install /dev/sdb
   sudo update-grub
```

   Replace `/dev/sdb` with the second disk in your array. GRUB was already installed to `/dev/sda` during install.

---

## 🧪 (Optional) Test Your Redundancy

Make sure your system can boot from either disk:

1. Power off.
2. Unplug `/dev/sda` and boot.
3. Power off, plug `/dev/sda` back in, unplug `/dev/sdb`, and boot again.

If both work, your RAID1 boot redundancy is confirmed! 🎉

---

## 🧰 Option 2: Manual RAID Setup post-install with `mdadm` (Advanced Users)

If you're more comfortable configuring RAID after install or using a minimal ISO, here’s how to build your array manually.

### 1. Install Debian normally (on a single disk or minimal setup)

Boot into your new Debian system.

### 2. Install `mdadm`

```
sudo apt update
sudo apt install mdadm
```

### 3. Partition both disks

Use `fdisk` or `parted` to create matching partitions on both drives:

```
sudo fdisk /dev/sda
sudo fdisk /dev/sdb
```

Set them as type `fd` (Linux RAID autodetect) or use GPT with `parted`.

### 4. Create the RAID array

```
sudo mdadm --create --verbose /dev/md0 --level=1 --raid-devices=2 /dev/sda1 /dev/sdb1
```

Repeat for additional arrays (e.g., `/dev/md1` for root).

### 5. Format and mount

```
sudo mkfs.ext4 /dev/md0
sudo mount /dev/md0 /mnt
```

Install Debian to the mounted RAID device if you're doing a chroot install.

### 6. Save the RAID config

```
sudo mdadm --detail --scan | sudo tee -a /etc/mdadm/mdadm.conf
sudo update-initramfs -u
```

---

## ✅ Install GRUB on Both Disks

Regardless of method:

```
sudo grub-install /dev/sda
sudo grub-install /dev/sdb
sudo update-grub
```

This ensures either disk can boot independently 🛡️

---

## 📝 Summary

| Task | Debian Installer | `mdadm` Manual |
| ---- |
| RAID Setup Included | ✅ Yes | ❌ No (manual) |
| GRUB Installed on Both Disks | ❌ Manual Step | ❌ Manual Step |
| Skill Level | 👶 Beginner | 🧙 Advanced |
| Flexibility | Moderate | High |

---

Got questions or need help? Reach out to [support@ggcircuit.com](mailto:support@ggcircuit.com) —we're here to help! 😄

---