Title: Setting Up RAID 1 with NVMe Drives on Hetzner Server (Ignoring SSD Disk)
Introduction
In this article, we will guide you through the process of setting up a RAID 1 configuration using NVMe drives on a Hetzner server, while intentionally ignoring the SSD disk. This guide assumes that you have already set up your server and have access to the command line.
Prerequisites
- Access to the server's command line
- NVMe drives installed
- Root access to the server
Step 1: Identify and Partition NVMe Drives
First, we need to identify the NVMe drives and partition them. Use the following command to list all drives:
lsblk
Find the NVMe drives and note down their names. For example, let's assume the NVMe drives are /dev/nvme0n1 and /dev/nvme1n1.
Next, partition the drives using a tool like fdisk or parted. Here's an example using fdisk:
sudo fdisk /dev/nvme0n1
Follow the prompts to create a new partition. Repeat the process for the other NVMe drive.
Step 2: Format Partitions
Format the new partitions using the mkfs command. For example:
sudo mkfs.ext4 /dev/nvme0n1p1
sudo mkfs.ext4 /dev/nvme1n1p1
Step 3: Create MD Device
Now, create the MD device for the RAID 1 array. Use the following command:
mdadm --create /dev/md0 --level=1 --raid-devices=2 /dev/nvme0n1p1 /dev/nvme1n1p1
Replace /dev/md0 with a name of your choice for the MD device.
Step 4: Add MD Device to Bootloader
Add the new MD device to the bootloader configuration. For GRUB, edit the /etc/grub/grub.cfg file and add the following line:
root (hd0,0)
kernel /vmlinuz-$(uname -r) root=/dev/md0 ro
initrd /initramfs-$(uname -r).img
Replace (hd0,0) with the correct hard drive and partition number for your system.
Step 5: Mount the RAID 1 Array
Finally, mount the RAID 1 array to a directory. For example:
sudo mkdir /mnt/raid1
sudo mount /dev/md0 /mnt/raid1
Conclusion
You have now successfully set up a RAID 1 array using NVMe drives on your Hetzner server, while ignoring the SSD disk. Remember to backup important data before making any changes to your system.
References
This article is for educational purposes only. The author and Hetzner are not responsible for any data loss or system damage resulting from following this guide. Always backup your data before making any changes to your system.