#!/bin/bash

# update and install mc
zypper -n ref
zypper -n update
zypper -n in mc

# Clone sda's partition table to sdb
sfdisk -d /dev/sda | sfdisk /dev/sdb

# clear any leftovers from /dev/sdb5
mdadm --zero-superblock /dev/sdb5

# add /dev/sdb5 to the md raid
mdadm --manage /dev/md4 --add /dev/sdb5

umount /dev/sda2
umount /dev/sda3

# clone the rest of the partitions
dd if=/dev/sda1 of=/dev/sdb1 bs=4096
dd if=/dev/sda2 of=/dev/sdb2 bs=4096
dd if=/dev/sda3 of=/dev/sdb3 bs=4096
