#!/bin/bash

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

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

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

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

umount /dev/sdb2
umount /dev/sdb3

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