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


Proxmox install boot options

linux ext4 hdsize=8
linux ext4 hdsize=10
linux ext4 hdsize=12
linux ext4 hdsize=16

For Proxmox 5.x I have been using linux ext4 hdsize=16 for 16GB in my PVE Root capacity. After Proxmox has been completely installed I usually have 1.4GB Free.

  • linux ext4 – sets the partition format to ext4. The default is ext3.
  • hdsize=nGB – this sets the total amount of hard disk to use for the Proxmox installation. This should be smaller than your disk size.
  • maxroot=nGB – sets the maximum size to use for the root partition. This is the max size so if the disk is too small, the partition may be smaller than this.
  • swapsize=nGB – sets the swap partition size in gigabytes.
  • maxvz-nGB – sets the maximum size in gigabytes that the data partition will be. Again, this is similar to maxroot and the final partition size may be smaller.
  • minfree=nGB – sets the amount of free space to remain on the disk after the Proxmox installation.

Tuesday, October 2, 2018

Restart all Proxmox services in PVE 5.x

Sometime you just need to restart promox pve services in your hardware nodes because they froze or not functioning properly. These commands below will help you restart all your proxmox services:

killall -9 corosync
systemctl restart pve-cluster
systemctl restart pvedaemon
systemctl restart pveproxy
systemctl restart pvestatd


Stopping ALL your proxmox services in Proxmox PVE 5.x

Sometime you just need to STOP promox pve services in your hardware nodes because they froze or not functioning properly. These commands below will help you stop all your proxmox services:

killall -9 corosync
systemctl stop pve-cluster
systemctl stop pvedaemon
systemctl stop pveproxy
systemctl stop pvestatd