Skip to main content

Software Raid

Create raid:

Raid levels can be changed with: --level=1 // --level=0 // --level=5

Raid 1

mdadm --create --verbose /dev/md0 --level=1 --raid-devices=2 /dev/sdX /dev/sdX

Raid 5

mdadm --create --verbose /dev/md0 --level=5 --raid-devices=3 /dev/sdX /dev/sdX /dev/sdX

Raid 6

mdadm --create --verbose /dev/md0 --level=6 --raid-devices=4 /dev/sda /dev/sdX /dev/sdX /dev/sdX

Raid 10

mdadm --create --verbose /dev/md0 --level=10 --layout=o3 --raid-devices=4 /dev/sdX /dev/sdX /dev/sdX /dev/sdX

Stop raid:

mdadm --stop /dev/md0

Assemble raid:

mdadm -A /dev/mdX /dev/sdaX --run

Cloning a partition table

MBR:

X = Source (old drive), Y = Destination (new drive)

sfdisk -d /dev/sdX | sfdisk --force /dev/sdY
GPT:

Install gdisk

sgdisk /dev/sdX  -R /dev/sdY