Wednesday, October 3, 2018

How to create software raid1 mirroring in Proxmox PVE

These instructions below will show you how to create software raid1 (mirroring) in your proxmox pve. The example below uses 2 hard drives in /dev/sdb and /dev/sdc (yours may be different).

 

apt-get update 
apt-get upgrade
apt-get dist-upgrade

apt-get install mdadm

modprobe raid1
                        (do not need to add to /etc/modules)


cat /proc/mdstat


Prepare partitions to Linux Raid Auto-Detect:

fdisk -l
fdisk /dev/sdb
    type fd  (linux auto raid)




Copy partition from one drive to another

sfdisk -d /dev/sdb | sfdisk --force /dev/sdc



Remove previous RAID data if any:
mdadm --zero-superblock /dev/sdb1
mdadm --zero-superblock /dev/sdc1


Create the array with missing disk
mdadm --create /dev/md0 --level=1 --raid-disks=2 missing /dev/sdb1


Create the array with both disk
mdadm --create /dev/md0 --level=1 --raid-disks=2 /dev/sdb1 /dev/sdc1

-----------------------------------  (if using LVM stop here - continue to: https://sites.google.com/a/datafeedfile.com/code/proxmox/proxmoxrecreatelocalmd0lvm2basedsharedlocalfilesystem)

Create the filesystem
mkfs.ext4 /dev/md0

Double check to make sure all okay:
cat /proc/mdstat

Create mount target
mkdir /mnt/md0
chmod -R 777 /mnt/md0


Edit fstab
blkid

nano /etc/fstab
UUID=<UUID> /mnt/md0 ext4 defaults,noatime,nodiratime,noacl,data=writeback,barrier=0,nobh,errors=remount-ro 0 2

mount -a

reboot


1 comment:

  1. It’s exhausting to find educated folks on this matter, however you sound like you already know what you’re talking about! Thanks casino blackjack

    ReplyDelete