Skip to content

Setup custom RAID on Scaleway

rgaudin edited this page Jan 14, 2026 · 3 revisions

Elastic Metal servers at PAR2 don't have access to scaleway's partitioning tools and come with just two raid1 arrays for /boot and /.

We generally want to place all our non-system data in a dedicated array (with potentially different level) mounted on /data.

The following describes how to do it. Please read and adjust instructions are server status and expected outcome are various.

Gather data

Because the SCW layout has a single partition for everything but /boot, we have to restart in rescue mode (on a system not tied to disk) to be able to break things apart.

Before that, keep a record of some information from the running server

# list of block devices
❯ lsblk
NAME    MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINTS
sda       8:0    0 931.5G  0 disk
├─sda1    8:1    0   599M  0 part
│ └─md0   9:0    0   598M  0 raid1 /boot
└─sda2    8:2    0 930.9G  0 part
  └─md1   9:1    0 930.8G  0 raid1 /
sdb       8:16   0 931.5G  0 disk
├─sdb1    8:17   0   599M  0 part
│ └─md0   9:0    0   598M  0 raid1 /boot
└─sdb2    8:18   0 930.9G  0 part
  └─md1   9:1    0 930.8G  0 raid1 /
❯ ls -l /dev/sd*
brw-rw---- 1 root disk 8,  0 Jan 13 14:29 /dev/sda
brw-rw---- 1 root disk 8,  1 Jan 13 14:29 /dev/sda1
brw-rw---- 1 root disk 8,  2 Jan 13 14:29 /dev/sda2
brw-rw---- 1 root disk 8, 16 Jan 13 14:29 /dev/sdb
brw-rw---- 1 root disk 8, 17 Jan 13 14:29 /dev/sdb1
brw-rw---- 1 root disk 8, 18 Jan 13 14:29 /dev/sdb2
# layout and status of RAID
❯ cat /proc/mdstat
Personalities : [raid1] [raid0] [raid6] [raid5] [raid4] [raid10]
md0 : active raid1 sdb1[1] sda1[0]
      612352 blocks super 1.2 [2/2] [UU]

md1 : active raid1 sdb2[1] sda2[0]
      976015360 blocks super 1.2 [2/2] [UU]
      [=>...................]  resync =  9.2% (89868032/976015360) finish=313.9min speed=47038K/sec

unused devices: <none>
# disk partition table (assuming same on all disks)
❯ fdisk -l /dev/sda
Disk /dev/sda: 931.51 GiB, 1000204886016 bytes, 1953525168 sectors
Disk model: Samsung SSD 850
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xb59ba587

Device     Boot   Start        End    Sectors   Size Id Type
/dev/sda1  *       2048    1228799    1226752   599M fd Linux raid autodetect
/dev/sda2       1228800 1953523711 1952294912 930.9G fd Linux raid autodetect
# madam.conf
❯ cat /etc/mdadm/mdadm.conf
# mdadm.conf
#
# !NB! Run update-initramfs -u after updating this file.
# !NB! This will ensure that initramfs has an uptodate copy.
#
# Please refer to mdadm.conf(5) for information about this file.
#

# by default (built-in), scan all partitions (/proc/partitions) and all
# containers for MD superblocks. alternatively, specify devices to scan, using
# wildcards if desired.
#DEVICE partitions containers

# automatically tag new arrays as belonging to the local system
HOMEHOST <system>

# instruct the monitoring daemon where to send mail alerts
MAILADDR root

# definitions of existing MD arrays
ARRAY /dev/md/0  metadata=1.2 UUID=70b5af3c:d77774a1:d0eb00ab:21ee368e
ARRAY /dev/md/1  metadata=1.2 UUID=050b4851:ce563d81:d842977d:39c2a066

# This configuration was auto-generated on Tue, 13 Jan 2026 15:14:51 +0100 by mkconf
# madam detail (UUIDs should match with mdadm.conf)
❯ mdadm --detail --scan
ARRAY /dev/md/1 metadata=1.2 UUID=050b4851:ce563d81:d842977d:39c2a066
ARRAY /dev/md/0 metadata=1.2 UUID=70b5af3c:d77774a1:d0eb00ab:21ee368e
# fstab
❯ cat /etc/fstab
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# systemd generates mount units based on this file, see systemd.mount(5).
# Please run 'systemctl daemon-reload' after making changes here.
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
# / was on /dev/md1 during installation
UUID=2c130595-60fa-47b7-ac66-cb42ffa5eac0 /               ext4    errors=remount-ro 0       1
# /boot was on /dev/md0 during installation
UUID=9c2a7e53-1ea1-418e-8f21-dcc0d9e90d43 /boot           ext4    defaults        0       2
# block devices UUIDs
❯ blkid
/dev/sdb2: UUID="050b4851-ce56-3d81-d842-977d39c2a066" UUID_SUB="fcf1dc2c-76a9-5a9a-5f83-ba2c75de19cd" LABEL="srv-s:1" TYPE="linux_raid_member" PARTUUID="67174b64-02"
/dev/sdb1: UUID="70b5af3c-d777-74a1-d0eb-00ab21ee368e" UUID_SUB="7e9cc3a6-4901-5822-6769-9955b285343a" LABEL="srv-s:0" TYPE="linux_raid_member" PARTUUID="67174b64-01"
/dev/md0: UUID="9c2a7e53-1ea1-418e-8f21-dcc0d9e90d43" BLOCK_SIZE="4096" TYPE="ext4"
/dev/sda2: UUID="050b4851-ce56-3d81-d842-977d39c2a066" UUID_SUB="f2842539-f758-874c-796c-987c62e99585" LABEL="srv-s:1" TYPE="linux_raid_member" PARTUUID="b59ba587-02"
/dev/sda1: UUID="70b5af3c-d777-74a1-d0eb-00ab21ee368e" UUID_SUB="33a11cc8-efe1-4c75-d70f-4af273ed002d" LABEL="srv-s:0" TYPE="linux_raid_member" PARTUUID="b59ba587-01"
/dev/md1: UUID="2c130595-60fa-47b7-ac66-cb42ffa5eac0" BLOCK_SIZE="4096" TYPE="ext4"

Rescue Mode

Shut the server down (systemctl halt) then use Scaleway’s WebUI (or cli-tool) to boot the server in rescue mode and connect to it. Then become root (sudo su -)

First gather some information here to find out how the RAID has been recognized and configured in rescue.

❯ cat /proc/mdstat
Personalities : [raid1] [linear] [multipath] [raid0] [raid6] [raid5] [raid4] [raid10]
md126 : active (auto-read-only) raid1 sda1[0] sdb1[1]
      612352 blocks super 1.2 [2/2] [UU]

md127 : active (auto-read-only) raid1 sdb2[1] sda2[0]
      976015360 blocks super 1.2 [2/2] [UU]
      	resync=PENDING

unused devices: <none>

❯ lsblk
NAME      MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT
loop0       7:0    0 826.6M  1 loop  /usr/lib/live/mount/rootfs/filesystem.squashfs
sda         8:0    0 931.5G  0 disk
|-sda1      8:1    0   599M  0 part
| `-md126   9:126  0   598M  0 raid1
`-sda2      8:2    0 930.9G  0 part
  `-md127   9:127  0 930.8G  0 raid1
sdb         8:16   0 931.5G  0 disk
|-sdb1      8:17   0   599M  0 part
| `-md126   9:126  0   598M  0 raid1
`-sdb2      8:18   0 930.9G  0 part
  `-md127   9:127  0 930.8G  0 raid1

❯  mdadm --detail --scan
ARRAY /dev/md/srv-s:1 metadata=1.2 name=srv-s:1 UUID=050b4851:ce563d81:d842977d:39c2a066
ARRAY /dev/md/srv-s:0 metadata=1.2 name=srv-s:0 UUID=70b5af3c:d77774a1:d0eb00ab:21ee368e

❯ blkid
/dev/loop0: TYPE="squashfs"
/dev/sda1: UUID="70b5af3c-d777-74a1-d0eb-00ab21ee368e" UUID_SUB="33a11cc8-efe1-4c75-d70f-4af273ed002d" LABEL="srv-s:0" TYPE="linux_raid_member" PARTUUID="b59ba587-01"
/dev/sda2: UUID="050b4851-ce56-3d81-d842-977d39c2a066" UUID_SUB="f2842539-f758-874c-796c-987c62e99585" LABEL="srv-s:1" TYPE="linux_raid_member" PARTUUID="b59ba587-02"
/dev/sdb1: UUID="70b5af3c-d777-74a1-d0eb-00ab21ee368e" UUID_SUB="7e9cc3a6-4901-5822-6769-9955b285343a" LABEL="srv-s:0" TYPE="linux_raid_member" PARTUUID="67174b64-01"
/dev/sdb2: UUID="050b4851-ce56-3d81-d842-977d39c2a066" UUID_SUB="fcf1dc2c-76a9-5a9a-5f83-ba2c75de19cd" LABEL="srv-s:1" TYPE="linux_raid_member" PARTUUID="67174b64-02"
/dev/md127: UUID="2c130595-60fa-47b7-ac66-cb42ffa5eac0" TYPE="ext4"
/dev/md126: UUID="9c2a7e53-1ea1-418e-8f21-dcc0d9e90d43" TYPE="ext4"

Based on this information, we are now assuming that:

  • /boot array (previously md0) is now on md126.
  • / array (previously md1) is now on md127.

Our plan is to:

  1. Mount the root raid
  2. Make a file backup of the root partition
  3. Take down the root RAID
  4. Remove root and swap partitions
  5. Recreate swap partition (won’t use it but just in case)
  6. Recreate root partition with smaller size (100G)
  7. Create a new partition for data using rest of disk
  8. Format root partition and restore system
  9. Fix IDs in madam and fstab
  10. Update initramfs and grub

Backup system

# stop sync processecho frozen > /sys/block/md127/md/sync_action
❯ mkdir -p /mnt/root
❯ mount -o ro /dev/md127 /mnt/root
❯ cd /mnt/root
❯ tar czf /tmp/rootfs-backup.tar.gz \
  --exclude=./proc \
  --exclude=./sys \
  --exclude=./dev \
  --exclude=./tmp \
  --exclude=./run \
  --exclude=./mnt \
  .
# make sure file is present
❯ ls -lh /tmp
❯ cd /
❯ umount /mnt/root

Recreate partitions

❯ mdadm --stop /dev/md127
# the root partition is on sda2 and sdb2
❯ mdadm --zero-superblock /dev/sda2 /dev/sdb2
❯ fdisk /dev/sda
# 
# Given SCW servers comes with different layouts
# including dos and GPT ones, it’s probably safe
# to use disk interactively and reproduce your new
# layout exactly the same for both disks.
# Below is example target layout: 2G swap, 100G root and rest data
# 
# fdisk -l /dev/sda
# Disk /dev/sda: 931.53 GiB, 1000204886016 bytes, 1953525168 sectors
# Disk model: Samsung SSD 850
# Units: sectors of 1 * 512 = 512 bytes
# Sector size (logical/physical): 512 bytes / 512 bytes
# I/O size (minimum/optimal): 512 bytes / 512 bytes
# Disklabel type: dos
# Disk identifier: 0xb59ba587
# 
# Device     Boot     Start        End    Sectors   Size Id Type
# /dev/sda1  *         2048    1228799    1226752   599M fd Linux raid autodetect
# /dev/sda2         1228800    5423103    4194304     2G 82 Linux swap / Solaris
# /dev/sda3         5423104  215138303  209715200   100G fd Linux raid autodetect
# /dev/sda4       215138304 1953525167 1738386864 828.9G fd Linux raid autodetect 
# 
# do exactly same on /dev/sdb
❯ fdisk /dev/sdb

Restore system

# recreate RAID1 for root
❯ mdadm --create /dev/md127 --level=1 --raid-devices=2 /dev/sda3 /dev/sdb3

❯ cat /proc/mdstat
cat /proc/mdstat
Personalities : [raid1] [linear] [multipath] [raid0] [raid6] [raid5] [raid4] [raid10]
md127 : active raid1 sdb3[1] sda3[0]
      104791040 blocks super 1.2 [2/2] [UU]
      [>....................]  resync =  2.9% (3119040/104791040) finish=9.2min speed=183472K/sec

md126 : active (auto-read-only) raid1 sda1[0] sdb1[1]
      612352 blocks super 1.2 [2/2] [UU]

# wait for it to sync…
❯ mkfs.ext4 -L root /dev/md127
❯ mkdir -p /mnt/new_root
❯ mount /dev/md127 /mnt/new_root
❯ cd /mnt/new_root
❯ tar xzf /tmp/rootfs-backup.tar.gz
❯ mkdir -p /mnt/new_root/{proc,sys,dev,run,mnt,tmp}
❯ chmod 0555 /mnt/new_root/{proc,sys,dev,run,mnt,tmp}
❯ chown root:root /mnt/new_root/{proc,sys,dev,run,mnt,tmp}

❯ mount --bind /dev /mnt/new_root/dev
❯ mount --bind /proc /mnt/new_root/proc
❯ mount --bind /sys /mnt/new_root/sys

# mount the other array as boot
❯ mount /dev/md126 /mnt/new_root/boot

# enter chroot
❯ chroot /mnt/new_root /bin/bash
# re-run madam detail to get new ID
❯ mdadm --detail --scan
ARRAY /dev/md/srv-s:0 metadata=1.2 UUID=70b5af3c:d77774a1:d0eb00ab:21ee368e
ARRAY /dev/md127 metadata=1.2 UUID=5e7d228b:0a717fbd:429a0288:667a49ec
# fix IDs in mdadm.conf
❯ vim /etc/mdadm/mdadm.conf
❯ cat /etc/mdadm/mdadm.conf
# mdadm.conf
#
# !NB! Run update-initramfs -u after updating this file.
# !NB! This will ensure that initramfs has an uptodate copy.
#
# Please refer to mdadm.conf(5) for information about this file.
#

# by default (built-in), scan all partitions (/proc/partitions) and all
# containers for MD superblocks. alternatively, specify devices to scan, using
# wildcards if desired.
#DEVICE partitions containers

# automatically tag new arrays as belonging to the local system
HOMEHOST <system>

# instruct the monitoring daemon where to send mail alerts
MAILADDR root

# definitions of existing MD arrays
ARRAY /dev/md/0  metadata=1.2 UUID=70b5af3c:d77774a1:d0eb00ab:21ee368e
ARRAY /dev/md/1  metadata=1.2 UUID=5e7d228b:0a717fbd:429a0288:667a49ec

# This configuration was auto-generated on Tue, 13 Jan 2026 15:14:51 +0100 by mkconf
# display new block device IDs
❯ blkid
/dev/md127: LABEL="root" UUID="d0089996-5287-4e2d-970c-fbed6248ec80" BLOCK_SIZE="4096" TYPE="ext4"
/dev/sdb4: PARTUUID="67174b64-04"
/dev/sdb2: PARTUUID="67174b64-02"
/dev/sdb3: UUID="5e7d228b-0a71-7fbd-429a-0288667a49ec" UUID_SUB="cb22c349-2f7b-66e5-0db7-2f5087ebc32f" LABEL="51-159-97-236:127" TYPE="linux_raid_member" PARTUUID="67174b64-03"
/dev/sdb1: UUID="70b5af3c-d777-74a1-d0eb-00ab21ee368e" UUID_SUB="7e9cc3a6-4901-5822-6769-9955b285343a" LABEL="srv-s:0" TYPE="linux_raid_member" PARTUUID="67174b64-01"
/dev/loop0: BLOCK_SIZE="131072" TYPE="squashfs"
/dev/md126: UUID="9c2a7e53-1ea1-418e-8f21-dcc0d9e90d43" BLOCK_SIZE="4096" TYPE="ext4"
/dev/sda4: PARTUUID="b59ba587-04"
/dev/sda2: PARTUUID="b59ba587-02"
/dev/sda3: UUID="5e7d228b-0a71-7fbd-429a-0288667a49ec" UUID_SUB="17ac3467-070b-91a8-91f9-b3d36717f3fa" LABEL="51-159-97-236:127" TYPE="linux_raid_member" PARTUUID="b59ba587-03"
/dev/sda1: UUID="70b5af3c-d777-74a1-d0eb-00ab21ee368e" UUID_SUB="33a11cc8-efe1-4c75-d70f-4af273ed002d" LABEL="srv-s:0" TYPE="linux_raid_member" PARTUUID="b59ba587-01"
# edit fstab to use correct ID for root part (md127 one)
# /!\ if your fstab mentions swap, comment-it out (we don’t use it on our k8s nodes)

❯ cat /etc/fstab
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# systemd generates mount units based on this file, see systemd.mount(5).
# Please run 'systemctl daemon-reload' after making changes here.
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
# / was on /dev/md1 during installation
UUID=d0089996-5287-4e2d-970c-fbed6248ec80 /               ext4    errors=remount-ro 0       1
# /boot was on /dev/md0 during installation
UUID=9c2a7e53-1ea1-418e-8f21-dcc0d9e90d43 /boot           ext4    defaults        0       2
# disable swap in initramfsecho RESUME=none > /etc/initramfs-tools/conf.d/resume
❯ update-initramfs -u -k all
❯ grub-install /dev/sda
❯ grub-install /dev/sdb
❯ update-grub
# exit chrootexit

❯ umount /mnt/new_root/boot
❯ umount /mnt/new_root/dev
❯ umount /mnt/new_root/proc
❯ umount /mnt/new_root/sys
❯ umount /mnt/new_root
❯ sync
❯ systemctl halt

Now go back to Scaleway UI and switch to normal mode.

DATA raid setup

On your running normal system, you can now create the array your want for your data.

# example raid1
❯ mdadm --create /dev/md2 --level=1 --raid-devices=2 /dev/sda4 /dev/sdb4
❯ cat /proc/mdstat
❯ mkfs.ext4 -L data /dev/md2
❯ mkdir -p /data

# get ID with blkid, add it to fstab then
❯ systemctl daemon-reload
❯ mount -a

Clone this wiki locally