====== RAID ======

===== Copy Partition Scheme =====
Save to file
<sxh bash>
sfdisk -d /dev/sda > partitions
</sxh>

Restore from File and force
<sxh bash>
sfdisk --force /dev/sda < partitions
</sxh>

=== In one step ===
<sxh bash>
sfdisk -d /dev/sda | sfdisk /dev/sdb
</sxh>

==== Get Disk Serial ====
Using smartctl
<sxh bash>
smartctl -i /dev/sda
</sxh>

===== Check RAID Status =====
<sxh bash>
cat /proc/mdstat
</sxh>

==== Remove a Malfunctioning Disk ====
Do the Folloing for all partitions of the malfunctioning disk. Note that mark as faill is not necessary or even possible in case the disk is not detected anymore from the OS.

Mark partition as failed
<sxh bash>
mdadm --manage /dev/md0 --fail /dev/sda1
</sxh>

Remove Partition
<sxh bash>
mdadm --manage /dev/md0 --remove /dev/sda1
</sxh>

==== Add New Disk in Array ====
Repeat for all required partitions
<sxh bash>
mdadm --manage /dev/md0 --add /dev/sda1
</sxh>