Proxmox clone or transfer to new disk from 4k to 512 Sectors

pgro

Member
Oct 20, 2022
56
2
13
Hi Everyone,

I am struggling to find a solution but before doing anything wrong I'd like to know your valuable opinion guys.

We have a PVE (single) server running with 2x800GB 4K disks with ZFS-RAID with a simple DELL HBA330 controller. Often needed to clone the system to a new hardware for various reasons but always with 4K disks and so far we didn't had issues at all. In order to do that we simple pulled the disk placed a new disk in slot perform the zfs replace and the rest of uefi and swap preparation and done. The unplugged disk was used under new hardware and booted just fine and performed the similar procedure in order to zfs replace the disk , uefi boot ,etc. Now the problem is the new disks are 512 sectoring. More specifically Kingston Enterprise DC600M , so sgdisk in order to replicate the Disk partition scheme cannot work due to different start / end sector position etc. Before going on further and start answering I'd like to note that the system is heavily modified with custom crons and configs and thus I wouldn't prefer to just install a plain PVE and then just zfs send/receive the VMs that's something to avoid since I need to clone the system exactly as-is. I couldn't find any tool for Kingston that could change the LBA from 512 to 4K (some Vendors offering such option). What next? lot of forum report that cloning eg with clonezilla from 4k to 512 would either fail.

Thank you
 
I think you need to partition the new drive manually (by multiplying the sector numbers by four) using gdisk instead of using sgdisk.
Or use an interactive tool like GParted Live if you want to copy the actual partitions. But you'll probably still need to fix or reinstall the bootloader (using chroot etc.).
 
You cant transform ZFS pool from ashift 12 to 9. Just create need ZFS pool and using snapshot send data to new place.
 
I think you need to partition the new drive manually (by multiplying the sector numbers by four) using gdisk instead of using sgdisk.
Or use an interactive tool like GParted Live if you want to copy the actual partitions. But you'll probably still need to fix or reinstall the bootloader (using chroot etc.).
Thats sound cool, but once I have done that with GParted, then what? I have to chroot with zfs support import the rpool and the rest and then just execute proxmox-boot-tool init .. format .. refresh etc ? and that's all? Do somehow have to tell uefi boot what will be the start sector of part3 ?

For example current system is
Code:
Model: TOSHIBA AL14SEB18EP (scsi)
Disk /dev/sda: 1800GB
Sector size (logical/physical): 4096B/4096B
Partition Table: gpt
Disk Flags:

Number  Start   End     Size    File system     Name  Flags
 2      1049kB  538MB   537MB   fat32                 boot, esp
 3      538MB   1778GB  1778GB
 4      1778GB  1800GB  22.2GB  linux-swap(v1)        swap

Notice that boot,esp (efi) is 537MB

The below is a clean install with DC600M SSD with 512 sector

2024-09-05_12-52.png

Notice that this is 1024 MiB
 
You cant transform ZFS pool from ashift 12 to 9. Just create need ZFS pool and using snapshot send data to new place.
I need to clone the total rpool with booting too, not only the datasets where VM and data relies on.
 
Thats sound cool, but once I have done that with GParted, then what? I have to chroot with zfs support import the rpool and the rest
Yes, you'll probably want to use the Proxmox installer (in debug mode) to import the rpool and chroot (something like this https://pve.proxmox.com/wiki/Recover_From_Grub_Failure but without the LVM and GRUB part).
and then just execute proxmox-boot-tool init .. format .. refresh etc ? and that's all?
If you use format then you need to remove the old ID from /etc/kernel/proxmox-boot-uuids. And use format before init, since it wipes the ESP.
Do somehow have to tell uefi boot what will be the start sector of part3 ?
No, just make sure you boot the system in the right mode (UEF or Legacy BIOS, which every you prefer). proxmox-boot-tool should take care of all that, if you original also was under the control of proxmox-boot-tool.
For example current system is
Code:
Model: TOSHIBA AL14SEB18EP (scsi)
Disk /dev/sda: 1800GB
Sector size (logical/physical): 4096B/4096B
Partition Table: gpt
Disk Flags:

Number  Start   End     Size    File system     Name  Flags
 2      1049kB  538MB   537MB   fat32                 boot, esp
 3      538MB   1778GB  1778GB
 4      1778GB  1800GB  22.2GB  linux-swap(v1)        swap

Notice that boot,esp (efi) is 537MB

The below is a clean install with DC600M SSD with 512 sector

View attachment 74283

Notice that this is 1024 MiB
I guess you chose different sizes in the installer or used different Proxmox installer versions (as they increased the default ESP size, since Linux kernels got bigger over time). The installer does not add swap paritions (currently and v1 is rather old).
The first partition is only used by GRUB and not needed with systemd-boot (I believe), but alway added as you lose that space anyway when aligning partitions to MiBs. I guess someone deleted it from your original as that now starts with 2.
 
Wow Ieesteken was very helpful, I will reply back my results.
Yes, you'll probably want to use the Proxmox installer (in debug mode) to import the rpool and chroot (something like this https://pve.proxmox.com/wiki/Recover_From_Grub_Failure but without the LVM and GRUB part).

If you use format then you need to remove the old ID from /etc/kernel/proxmox-boot-uuids. And use format before init, since it wipes the ESP.

No, just make sure you boot the system in the right mode (UEF or Legacy BIOS, which every you prefer). proxmox-boot-tool should take care of all that, if you original also was under the control of proxmox-boot-tool.

I guess you chose different sizes in the installer or used different Proxmox installer versions (as they increased the default ESP size, since Linux kernels got bigger over time). The installer does not add swap paritions (currently and v1 is rather old).
Actually, the first one is installation from PVE 7.4 while the second from pve 8
The first partition is only used by GRUB and not needed with systemd-boot (I believe), but alway added as you lose that space anyway when aligning partitions to MiBs. I guess someone deleted it from your original as that now starts with 2.
Grub partition No.1 was deleted from me because there is no need at all. But my main consideration is if 512Mb and 1Gb is due to 512 or 4K sectoring. Also here https://pve.proxmox.com/wiki/Host_Bootloader mentions the EFI parition as 512MB, but as you said maybe the article is outdated and since the kernel tends to become bigger it hasn't been updated yet.

I will revert upon my success with steps maybe.
Thanx
 
Ok,

Sorry but I lost. Gparted Live does not offer clone. I though that I can use it for cloning too. So my understanding steps

- Put the new disk and perform the partitioning (manually)
- Next I need to copy the zfs rpool data to new disk/partition usually on -part3 ,but how this will be done ? via dd? or clonezilla ?
 
Sorry but I lost. Gparted Live does not offer clone. I though that I can use it for cloning too.
You can Copy and Paste partitions from one drive to another (but you might first have to create a partition table). That's almost like clone but you have to do it for each partition.
 
Ok that's great. At last clone was worked in partition mode from Clonezilla and I was able to success chroot to it. But now in proxmoxb-toot-tool claiming for Failed to create EFI boot variable. Is that normal ?

1725628280976.png
 
Ok that's great. At last clone was worked in partition mode from Clonezilla and I was able to success chroot to it. But now in proxmoxb-toot-tool claiming for Failed to create EFI boot variable. Is that normal ?
You need to bind-mount the efivars too when booting in UEFI mode: mount --bind /sys/firmware/efi/efivars /mnt/sys/firmware/efi/efivars (if you mounted everything on /mnt).
I think this is still missing from many guides. Sorry for not realizing this before.
 
  • Like
Reactions: pgro and _gabriel
You need to bind-mount the efivars too when booting in UEFI mode: mount --bind /sys/firmware/efi/efivars /mnt/sys/firmware/efi/efivars (if you mounted everything on /mnt).
I think this is still missing from many guides. Sorry for not realizing this before.
Thanx, that did the trick after that I was able to run proxmox-boot-tool and recognize everything.

Question: could this also be done with a simple commands within Proxmox ? For instance if you plug a new disk into running proxmox environment can you simply create the partition scheme from parted or cfdisk for part1 part2 and part3 but then how you can clone the source disk to dest disk with dd or ddrescue or any other similar tool from source 4096 bytes (sda) to dest 512 bytes (sdc) ?

Thanx
 

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!