HOW TO Proxmox software RAID 10 in 21 Steps

..:: HOW TO Proxmox software RAID 10 in 21 Steps ::..

1- Clean any leftovers from before

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

2- Boot and Install Proxmox to /dev/sda

3- nano /etc/apt/sources.list

deb http://ftp.de.debian.org/debian wheezy main contrib
# security updates
deb http://security.debian.org/ wheezy/updates main contrib
# PVE pve-no-subscription repository provided by proxmox.com, NOT recommended for production use
deb http://download.proxmox.com/debian wheezy pve-no-subscription

4- nano /etc/apt/sources.list.d/pve-enterprise.list

#deb https://enterprise.proxmox.com/debian wheezy pve-enterprise

5-

apt-get update
apt-get dist-upgrade
apt-get install mdadm
dpkg-reconfigure locales (*optional)

6-

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

7-

sgdisk -G /dev/sdb
sgdisk -G /dev/sdc
sgdisk -G /dev/sdd

8-

sgdisk -t 2:fd00 /dev/sdb
sgdisk -t 3:fd00 /dev/sdb
sgdisk -t 2:fd00 /dev/sdc
sgdisk -t 3:fd00 /dev/sdc
sgdisk -t 2:fd00 /dev/sdd
sgdisk -t 3:fd00 /dev/sdd

8-1

dd if=/dev/sda1 of=/dev/sdb1
dd if=/dev/sda1 of=/dev/sdc1
dd if=/dev/sda1 of=/dev/sdd1

9-

mdadm --create /dev/md0 --level=1 --raid-disks=4 missing /dev/sdb2 /dev/sdc2 /dev/sdd2
mdadm --create /dev/md1 --level=10 --raid-disks=4 missing /dev/sdb3 /dev/sdc3 /dev/sdd3

10-

mdadm --examine --scan >> /etc/mdadm/mdadm.conf
cat /etc/mdadm/mdadm.conf

(check what’s in here)

11-

mkfs.ext3 /dev/md0
mkdir /mnt/md0
mount /dev/md0 /mnt/md0
cp -ax /boot/* /mnt/md0

12- nano /etc/fstab

# /dev/pve/root / ext3 errors=remount-ro 0 1
/dev/pve/data /var/lib/vz ext3 defaults 0 1
#UUID=0db2359a-2754-43df-9d7c-6d9f1950cf6a /boot ext3 defaults 0 1
/dev/md0 /boot ext3 defaults 0 1
/dev/pve/swap none swap sw 0 0
proc /proc proc defaults 0 0

13-

echo '# customizations' >> /etc/default/grub
echo 'GRUB_DISABLE_LINUX_UUID=true' >> /etc/default/grub
echo 'GRUB_PRELOAD_MODULES="raid dmraid"' >> /etc/default/grub
echo raid1 >> /etc/modules
echo raid10 >> /etc/modules
echo raid1 >> /etc/initramfs-tools/modules
echo raid10 >> /etc/initramfs-tools/modules

grub-install /dev/sda
grub-install /dev/sdb
grub-install /dev/sdc
grub-install /dev/sdd

update-grub
update-initramfs -u

14- reboot and mount | grep boot
/dev/md0 on /boot type ext3 (rw,relatime,errors=continue,user_xattr,acl,barrier=0,data=ordered)
If looks like that, you’re good to go.

15- Now add sda2 to our Raid 1 Array

sgdisk -t 2:fd00 /dev/sda
mdadm --add /dev/md0 /dev/sda2
cat /proc/mdstat

16- Now we will move our LVM over /dev/md1
!!IMPORTANT Install screen before pvemove.Because it will take several hours!!

pvcreate /dev/md1
vgextend pve /dev/md1
apt-get install screen
screen
pvmove /dev/sda3 /dev/md1

17- reduce and remove /dev/sda3

vgreduce pve /dev/sda3
pvremove /dev/sda3

18- add /dev/sda3 to RAID 10 array md1

sgdisk -t 3:fd00 /dev/sda
mdadm --add /dev/md1 /dev/sda3

19- Let our RAID 10 Array Rebuild itself. Maybe want to watch it for some fun.
Or speed rebuilding a little bit if you want.

echo 800000 > /proc/sys/dev/raid/speed_limit_min
echo 1600000 > /proc/sys/dev/raid/speed_limit_max

watch -n 2 cat /proc/mdstat

20- extend our VG space and add it to our LV

lvextend -l +100%FREE /dev/pve/data
resize2fs /dev/pve/data

~~~ ALL DONE! 🙂 ~~~

21- Before rebooting don't forget to install grub one last time

grub-install /dev/sda
grub-install /dev/sdb
grub-install /dev/sdc
grub-install /dev/sdd

update-grub
update-initramfs -u