Move proxmox to another disk

encore

Member
May 4, 2018
107
1
23
34
Hi,

we have a Cluster with some nodes. All nodes have a 2TB local disk where proxmox is installed (with its LV). The other space is allocated as ext4 directory storage. I would like to move the OS to a new 60 gb ssd without losing any VPS information. Means the vps stay on their ext4 directory storage and only the OS with all cluster informations etc will be moved to the new 60gb ssd.

Could someone explain the steps to achieve that?
Boot in rescue and dd if it to the new disk? But how to do this exactly without moving the ext4 partition?
 

Richard

Proxmox Staff Member
Staff member
Mar 6, 2015
886
41
48
Austria
we have a Cluster with some nodes. All nodes have a 2TB local disk where proxmox is installed (with its LV). The other space is allocated as ext4 directory storage. I would like to move the OS to a new 60 gb ssd without losing any VPS information. Means the vps stay on their ext4 directory storage and only the OS with all cluster informations etc will be moved to the new 60gb ssd.

Could someone explain the steps to achieve that?
Boot in rescue and dd if it to the new disk? But how to do this exactly without moving the ext4 partition?

Depends on Proxmox's PV partition (usually sda3) size - if it's together with partition 1 and 2 less than 60GB you can move partition 1,2 and 3 as a whole via dd to the ssd and it will work. Don't forget to create a proper partition table at the ssd. For a test remove the 2 TB disk in order to avoid identical LVMs at one system. Before you put the 2TB disk back in service delete (e.g. via dd if=/dev/zero) the LVM data on it.
 

encore

Member
May 4, 2018
107
1
23
34
played arround with it some hours and I successfully moved 6 nodes to an USB drive now with these steps:
Code:
- check how much disk space is used by root partition. My USB tick has 32gb, so I made sure root partition used less than 20gb.
- start rescue (I use sysrcd)
- vgrename pve pve-old ## rename old LVM otherwise proxmox won't be able to install on USB stick
- install proxmox on USB stick with swap 1, maxroot 24, maxvz 1
- boot rescue again
- fsck -y /dev/mapper/pve--old-root
- e2fsck -f /dev/mapper/pve--old-root
- resize2fs -p /dev/mapper/pve--old-root 23G ## resize old root partition to 23G
- lvreduce -L 24G /dev/pve-old/root ## reduce old LV where root partition is stored to 24G
- lvextend -L 24G /dev/pve/root
- e2fsck -f /dev/mapper/pve-root
- resize2fs -p /dev/mapper/pve-root 23G ## resize new root partition to the exact same size as old, so dd if will work fine
- dd if=/dev/mapper/pve--old-root of=/dev/mapper/pve-root bs=4096 status=progress
- get LVM ID and LV ID of old and new LVM/LV with:
vgdisplay pve-old
vgdisplay pve
lvdisplay LV
replace old IDs with new IDs in grub config (see next steps)
- mount /dev/mapper/pve-root /mnt
- sed -i 's/OLD-LVM-OR-LV-ID/NEW-LVM-OR-LV-ID/g' /mnt/boot/grub/grub.cfg
- umount /mnt
- lvremove /dev/mapper/pve--old-root
- fck -y /dev/mapper/pve-root

Attention: Before do that stuff, make sure important files on your root partition was backed up!
 

About

The Proxmox community has been around for many years and offers help and support for Proxmox VE, Proxmox Backup Server, and Proxmox Mail Gateway.
We think our community is one of the best thanks to people like you!

Get your subscription!

The Proxmox team works very hard to make sure you are running the best software and getting stable updates and security enhancements, as well as quick enterprise support. Tens of thousands of happy customers have a Proxmox subscription. Get your own in 60 seconds.

Buy now!