Proxmox customization

How to change default settings and make software raid (mirror and stripe) with GPT.

While booting installation:

linux ext4 hdsize=10 maxroot=5 swapsize=1 maxvz=1

http://www.jamescoyle.net/how-to/261-proxmox-advanced-install-settings

In case your partitions were used with raid you should wipe them (dry :]):

wipefs -a /dev/sdb1
# or mdadm --zero-superblock /dev/sdb[1-4]
apt-get -y update
apt-get -y dist-upgrade
START_AT=`parted /dev/sda p | tail -n 2 | head -n 1 | awk -F " " '{print $3}'`
parted /dev/sda mkpart primary $START_AT 100% 
apt-get install xfsprogs -y
apt-get -y install mdadm

sgdisk -b=/tmp/partitions /dev/sda
sgdisk -l=/tmp/partitions /dev/sdb

dd if=/dev/sda1 of=/dev/sdb1
sgdisk -t 2:fd00 /dev/sdb
sgdisk -t 3:fd00 /dev/sdb
sgdisk -t 4:fd00 /dev/sdb
sgdisk -t 4:fd00 /dev/sda

# To create a "degraded" array in which some devices are missing, simply give the word "missing" in 
# place of a device name.  This will cause mdadm to leave the corresponding slot in the array empty.
# For a RAID4 or RAID5 array at most one slot can be "missing"; for a RAID6 array at most two slots.  # For a RAID1 array, only one real device needs to be given.  All of the others can be "missing".
yes | mdadm --create /dev/md0 --level=1 --raid-disks=2 missing /dev/sdb2
yes | mdadm --create /dev/md1 --level=1 --raid-disks=2 missing /dev/sdb3
yes | mdadm --create /dev/md2 --level=0 --raid-disks=2 --chunk=256 /dev/sda4 /dev/sdb4
/usr/share/mdadm/mkconf > /etc/mdadm/mdadm.conf
mkfs.ext4 /dev/md0
mkfs.ext4 /dev/md1
# xfsprogs and the mkfs.xfs utility automatically select the best stripe size and stripe width for underlying devices that support it, such as Linux software RAID devices.
mkfs.xfs -f /dev/md2
mkdir /mnt/md0
mount /dev/md0 /mnt/md0
cp -ax /boot/* /mnt/md0
sed -i  's/UUID=.*\s\/boot/\/dev\/md0 \/boot/' /etc/fstab
reboot

After reboot

echo 'GRUB_DISABLE_LINUX_UUID=true' >> /etc/default/grub
echo 'GRUB_PRELOAD_MODULES="raid dmraid"' >> /etc/default/grub
echo raid1 >> /etc/modules
echo raid1 >> /etc/initramfs-tools/modules
grub-install /dev/sda --recheck
grub-install /dev/sdb --recheck
update-grub
update-initramfs -u

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

pvcreate /dev/md1
vgextend pve /dev/md1
pvmove /dev/sda3 /dev/md1
vgreduce pve /dev/sda3
pvremove /dev/sda3
sgdisk -t 3:fd00 /dev/sda
mdadm --add /dev/md1 /dev/sda3

# voila...
lsblk -o NAME,MAJ:MIN,RM,SIZE,TYPE,FSTYPE,MOUNTPOINT,UUID

Sources:
http://www.anchor.com.au/blog/2012/10/the-difference-between-booting-mbr-and-gpt-with-grub/
http://alexunil.net/2013/09/12/proxmox-3-1-auf-softraid-mit-gpt/
http://boffblog.wordpress.com/2013/08/22/how-to-install-proxmox-ve-3-0-on-software-raid/

  1. For 3.4 Promox it has HD options in GUI. Unfortunately, it will create one partition which covers the whole disk.
    You need to make some place, by creating partition (e.g. 20G) on the second disk and then moving group to it).
    pvcreate /dev/sdd2
    vgextend pve /dev/sdd2
    pvmove /dev/sdc3 /dev/sdd2
    And in reverse mode recover data for smaller partiotion.

  1. No trackbacks yet.