move full proxmox system from hdd to ssd

capin

New Member
Nov 12, 2020
6
0
1
45
hello
how can i copy(move) full working proxmox system from hdd to ssd same size.
with container and all configuration
 
think the author is interested if the cloned drive will boot.
The answer is: typically yes.
 
Workzilla is of course good!
But if you do not have the ability to stop the machine and remove the disk.
How to do this on a working machine, adding a disk to a hot one and copying the image using DD, and expanding the FS, using fdisk and fs2resize, next step -> chroot -> rebuildGRUB -> reboot->change boot disk to new ssd disk and remove old hdd?
 
I don´t think this is working on a running system, because you wont have a consistent filesystem.
Only chance if you are able to quiesce, snapshot and then transfer the snapshot.
Those cloning-operations usually need the system to be powered off.
 
lsblk # see what disks are there.
# connect a new SSD disk
# if it is not detected, scan ports
echo "- - -" >/sys/class/scsi_host/host0/scan # where host[0-7] is the SATA port number to which the drive is connected.
# If you specify a host with another connected drive
# nothing will happen, the system will simply check the port.
# My system disk sda. I need to replace sda on sdb.
fdisk -l /dev/sdb
# Check that the disk is larger than old disk and that it has the same type (GPT/MBR)

#Change mbr to gpt
gdisk /dev/sdb
w
y

#Change gpt to mbr
parted /dev/sdb
(parted) mklabel msdos
y
quit

#copy partitions
sfdisk -d /dev/sda | sfdisk --force /dev/sdb

#Copying data
dd if=/dev/sda1 of=/dev/sdb1
dd if=/dev/sda2 of=/dev/sdb2
dd if=/dev/sda3 of=/dev/sdb3
grub-install /dev/sdb
shutdown now
# Here I disconnected the old disk and selected the new SSD as bootable in the BIOS
Node is work normal.
Disconnecting for 30 seconds to replace the disk is not the same as disconnecting for 1-2 hours to copy partitions with a cloner.

Here are some difficulties:

1. The old disk is 80 Gb, the new one is 480 Gb.

The new disk had no free space and it was impossible to distribute it.
The sfdisk and cfdisk programs did not see any problem with this and did not react in any way, it was simply impossible to change the disk.
It was solved by the parted program:
swapoff /dev/pve/swap
parted
>>print # the program complains about the unused space, offers to fix
>>fix
>>quit
swapon /dev/pve/swap
After fixing the disk layout, cfdisk normally allowed dividing the free space into 6 partitions
for 6 connected large storage disks,
I placed ceph databases for large HDDs on the SSD partitions.

2. Proxmox not only uses GRUB, it has its own bootloader backup subsystem.
Although everything works for me, it would not be superfluous to do:
proxmox-boot-tool status
proxmox-boot-tool init /dev/sdb
grub-install /dev/sdb

That's all now.
 
Last edited:

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 yours easily in our online shop.

Buy now!