OVH Rescue Install

OVH' installer does not offer btrfs with btrfs raid, only with mdadm and limited options. so DiY!

stop raid

mdadm --stop /dev/md*


gdisk /dev/sda
Number  Start (sector)    End (sector)  Size       Code  Name
   1            2048            4095   1024.0 KiB  EF02  BIOS boot partition
   2            4096         1052671   512.0 MiB   FD00  Linux RAID
   3         1052672         3149823   1024.0 MiB  FD00  Linux RAID
   4         3149824        34607103   15.0 GiB    8300  Linux filesystem
   5        34607104       937703054   430.6 GiB   8300  Linux filesystem

copy to other disc

sgdisk -R=/dev/sdb /dev/sda


sgdisk --randomize-guids /dev/sdb

..tell the kernel:

partprobe /dev/sda* /dev/sdb*

mdadm raid1 for /boot - ignore metadata warning - grub2 is fine

mdadm --create /dev/md0 --level 1 --raid-devices=2 /dev/sda2 /dev/sdb2

mdadm raid2 for /swap

mdadm --create /dev/md1 --level 1 --raid-devices=2 /dev/sda3 /dev/sdb3 

cat /proc/mdstat

create swap

mkswap -L swap /dev/md1
swapon /dev/md1

boot fs

mkfs.ext2 -L bootfs /dev/md0

create btrfs raid fs root / home:

mkfs.btrfs -L rootfs -draid1 -mraid1 /dev/sda4 /dev/sdb4
mkfs.btrfs -L homefs -draid1 -mraid1 /dev/sda5 /dev/sdb5

mount the new partition

mkdir /debian/
mount /dev/sda4 /debian

check, that mkfs did the right thing: single chunks must not be used, “System, RAID1” is required to boot

btrfs fi df /debian/

if you find “System, single:…” convert to raid1, because single copies of data and metadata are not required in raid1-mode

btrfs bal start -v -f -sconvert=raid1 /debian/

check again:

btrfs fi df /debian/

remove all other single chunks:

btrfs bal start -v -f -dconvert=raid1 -mconvert=raid1 /debian/

do the same for homefs

mount /dev/sda5 /debian/home
btrfs fi df /debian/home
btrfs bal start -v -f -sconvert=raid1 /debian/home
btrfs bal start -v -f -dconvert=raid1 -mconvert=raid1 /debian/home


debootstrap --arch amd64 jessie /debian/

mount chroot dirs && chroot into

cd /debian/ && mkdir boot dev proc sys
for i in dev proc sys ; do mount --bind /$i /debian/$i ; done

mount /dev/md0 /debian/boot
chroot /debian /bin/bash --login
nano /etc/apt/sources.list

deb jessie main contrib non-free
deb-src jessie main contrib non-free

deb jessie/updates main contrib non-free
deb-src jessie/updates main contrib non-free

jessie-updates, previously known as 'volatile'

deb jessie-updates main contrib non-free
deb-src jessie-updates main contrib non-free

debian backports

deb jessie-backports main
apt-get update && apt-get -y upgrade
nano /etc/fstab

/dev/sda4       /       btrfs   noatime,ssd,user_subvol_rm_allowed      0 0
/dev/sda5       /home   btrfs   noatime,ssd,user_subvol_rm_allowed      0 0
/dev/md0        /boot   ext2    noatime         0 1
/dev/md1        swap    swap    pri=3           0 0
tmpfs   /tmp    tmpfs   defaults        0 0
tmpfs   /var/tmp        tmpfs   defaults        0 0
# proc ... cgroup is automatic by init scripts


ln -sf ../proc/mounts /etc/mtab

setup mdadm.conf:

  mdadm --detail --scan >> /etc/mdadm/mdadm.conf

install btrfs-tools: very important for initramfs generation, so the btrfs and scripts will be in initramfs if you miss this, you get: btrfs: error (device sda4) failed to read the system array: -5 btrfs: open_ctree failed

apt-get install btrfs-tools

kernel install (unsigned steht nur für non-secureboot)

apt-get -t jessie-backports install linux-image-4.7.0-0.bpo.1-amd64-unsigned

make /boot/grub/ or grub fails

apt install openssh-server grub2 mdadm mc tmux

generate bootmenu, ..:


& initramfs:

ln -s ../bin/fsck.btrfs /sbin/fsck.btrfs
ln -s ../bin/btrfs /sbin/btrfs
update-initramfs -kall -u

set passwd and keys!!

ssh-keygen -t ed25519
mcedit /root/.ssh/authorized_keys

mcedit /etc/ssh/sshd_config 



good luck! :)

optional checks:

test if grub install something to sdb1 bios boot parti, to ensure boot works if sda1 failed

cat /dev/zero >/dev/sdb1
cat /dev/sdb1 | sha256sum
grub-install /dev/sdb
cat /dev/sdb1 | sha256sum

simulate disc failure - overwrite MBR on sda with 0000.. to check, if sdb boots:

dd bs=512 count=1 if=/dev/zero of=/dev/sda

to restore mbr, run:

dd bs=512 count=1 if=/dev/sdb of=/dev/sda


Back to top
linux/debian_install/ovh_rescue_install.txt · Last modified: 2016/10/06 20:19 by tkilla