Skip to content

Instantly share code, notes, and snippets.

@ArturiaPendragon
Last active June 12, 2023 07:44
Show Gist options
  • Save ArturiaPendragon/d3dfeac1328b5848d497e26d49054a8f to your computer and use it in GitHub Desktop.
Save ArturiaPendragon/d3dfeac1328b5848d497e26d49054a8f to your computer and use it in GitHub Desktop.
Step-by-Step Tutorial for Switching from RAID1 to RAID0 using Scaleway/OneProvider

Introduction

  • This guide is based on Debian 11 (Bullseye) and is designed to be used with Scaleway/OneProvider as the cloud provider.
  • We will be transitioning from RAID1 to RAID0 on SSD. It's vital to verify that your hosting solution supports the RAID configuration you're about to implement.
  • Also, remember to back up any data stored on the drives as the RAID configuration changes could result in data loss.
  • Here are the steps to follow, with appreciation to @danaelg for their contributions.

Preliminary

  • /dev/md126 (typically md0) = /boot (RAID 1)
  • /dev/md127 (typically md1) = / (RAID 1 which will be switched to RAID0 and become md1)

Rescue Mode

Activate "Boot in rescue mode" from your cloud provider's interface.

Data Recovery

mkdir /mnt/md127
mount /dev/md127 /mnt/md127
rsync -aHAXxv /mnt/md127/ /mnt/newraid
umount /mnt/md127

Creation of the New RAID Configuration

RAID Rebuilding

mdadm --stop /dev/md127
mdadm --verbose --create /dev/md1 --level=0 --raid-devices=2 /dev/sda2 /dev/sdb2
  • Validate with cat /proc/mdstat

File System Creation

mkfs.ext4 /dev/md1

Mounting of the New RAID

mkdir /mnt/md1
mount /dev/md1 /mnt/md1

Data Transfer

rsync -aHAXxv /mnt/newraid /mnt/md1

UUID Retrieval of md1

lsblk -f

Preserve this for future reference

fstab Modification

nano /mnt/md1/etc/fstab

UUID=XXX / ext4 defaults 0 0 INFO Use the /etc/fstab of the rescue mode to test and verify the syntax

Grub Modification

Proc, sys, and dev Binding

mount --bind /dev /mnt/md1/dev
mount --bind /proc /mnt/md1/proc
mount --bind /sys /mnt/md1/sys

Chroot into /mnt/md1

chroot /mnt/md1 /bin/bash

Grub Update

update-initramfs
update-grub

System Reboot

Switch back to "Boot in normal mode" in your cloud provider's interface.

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