Skip to content

MrNinso/lvm-helper

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 

Repository files navigation

How to convert proxmox xfs/ext4 Install to raid5

Note

In this tutorial let's use:

  • /dev/sdX for the proxmox installed disk
  • /dev/sdY and /dev/sdZ for the other 2 disks for raid 5

you may use this tutorial for other raid levels (like raid1, raid6, raid0, etc...), but I only tested in raid5, so good luck

Copy Partition Table

Get the /dev/sdX partition table to a file

$ sfdisk -d /dev/sdX > table

Restore the partition table to /dev/sdY and /dev/sdZ

$ sfdisk /dev/sdY < table
$ sfdisk /dev/sdZ < table

Clone BIOS and UEFI partitions

$ dd if=/dev/sdX1 of=/dev/sdY1
$ dd if=/dev/sdX1 of=/dev/sdZ1
$ dd if=/dev/sdX2 of=/dev/sdY2
$ dd if=/dev/sdX2 of=/dev/sdZ2

Install Grub

$ grub-install /dev/sdY
$ grub-install /dev/sdZ

Convert Proxmox Logical volumes to raid5

Extend Volume group

$ vgextend pve /dev/sdY3 /dev/sdZ3

Recreate data Logical Volume

Based

Remove data lvm

$ lvremove pve/data

Create metadata logical volume

$ lvcreate -n meta_data --type raid5 -L 256M pve

Create data logical volume

$ lvcreate -n data --type raid5 --nosync -L 500G pve

Now let's convert to a Thinpool

$ lvconvert --thinpool pve/data --poolmetadata meta_data

Convert root and swap Logical volumes

First you need to convert from linear to raid1

$ lvconvert --type raid1 pve/root
$ lvconvert --type raid1 pve/swap

Wait the raid1 sync and convert to a raid5

$ lvconvert --type raid5 pve/root
$ lvconvert --stripes 2 pve/root

$ lvconvert --type raid5 pve/swap
$ lvconvert --stripes 2 pve/swap

Wait for sync and enjoy your raid5 in proxmox :)

(Optional) Grow root Logical Volume

$ xfs_growfs /dev/pve/root