I have a Proxmox installation with single drive ZFS, encrypted with native ZFS encryption, and unlocking by passphrase via dropbear SSH server in the initramfs stage, by dropbear executing the zfsunlock script.
I used an unnecessary large disk and want to replace it with a smaller one?
What would be the simplest practical method for accomplishing this, preserving all settings in Proxmox? I have cloned the boot drive with dd to another identical drive that I can play with without risking data loss.
This was the method I used for encrypting the drive in the first place after installing Proxmox:
# Import the old
# Make a snapshot of the current one
# Send the snapshot to a temporary root
# Destroy the old unencrypted root
# Create a new zfs root, with encryption turned on
# Copy the files from the copy to the new encrypted zfs root
# Set the Mountpoint
# Delete the old unencrypted copy
# Export the pool again, so you can boot from it
I started with booting into proxmox debug mode serial console from USB installer. Used gdisk to create new partition table. Changed partition alignment and changed the UUID of the disk and the partitions to be exactly the same as the old disk and its partitions, so I don't have to update fstab or anything.
Used dd to clone both the sda1 and sda2 partition from the original drive.
Import the root pool 'rpool' with a new name 'rpooltemp'
Create new zpool on sda3 (the thrid partition efter BIOS and EFI partitions) called 'rpool'
Snapshot the pool rpooltemp's ROOT'-dataset
Send the pve-1 and data datasets with raw send over to the new smaller disk's rpool
I updated the zpool boot partition.
Exported both pools (and later I had to imprt rpooltemp and import again with the -f flag and old rpool name)
But when I test, the system will not boot. My motherboard can only handle BIOS boot, not GPT. But it is strange that the old drive has a GPT partition, and that boots fine. Do anyone see anything obvious? Do I need to update GRUB even though I cloned all UUIDs?
I used an unnecessary large disk and want to replace it with a smaller one?
What would be the simplest practical method for accomplishing this, preserving all settings in Proxmox? I have cloned the boot drive with dd to another identical drive that I can play with without risking data loss.
This was the method I used for encrypting the drive in the first place after installing Proxmox:
# Import the old
Code:
zpool import -f rpool
Code:
zfs snapshot -r rpool/ROOT@copy
Code:
zfs send -R rpool/ROOT@copy | zfs receive rpool/copyroot
Code:
zfs destroy -r rpool/ROOT
Code:
zfs create -o encryption=on -o keyformat=passphrase rpool/ROOT
Code:
zfs send -R rpool/copyroot/pve-1@copy | zfs receive -o encryption=on rpool/ROOT/pve-1
Code:
zfs set mountpoint=/ rpool/ROOT/pve-1
Code:
zfs destroy -r rpool/copyroot
Code:
zpool export rpool
I started with booting into proxmox debug mode serial console from USB installer. Used gdisk to create new partition table. Changed partition alignment and changed the UUID of the disk and the partitions to be exactly the same as the old disk and its partitions, so I don't have to update fstab or anything.
Used dd to clone both the sda1 and sda2 partition from the original drive.
Import the root pool 'rpool' with a new name 'rpooltemp'
Code:
zpool import -f rpool rpooltemp
Create new zpool on sda3 (the thrid partition efter BIOS and EFI partitions) called 'rpool'
Code:
zpool create sda3 rpool
Snapshot the pool rpooltemp's ROOT'-dataset
Code:
zfs snapshot -r rpooltemp/ROOT@copy
Send the pve-1 and data datasets with raw send over to the new smaller disk's rpool
Code:
zfs send -Rw rpooltemp/ROOT/pve-1@kopia | zfs receive rpool/ROOT/pve-1
zfs send -Rw rpooltemp/ROOT/data@kopia | zfs receive rpool/ROOT/data
I updated the zpool boot partition.
Code:
zpool set bootfs=rpool/ROOT/pve-1 rpool
Exported both pools (and later I had to imprt rpooltemp and import again with the -f flag and old rpool name)
Code:
zpool export rpooltemp
zpool export rpool
But when I test, the system will not boot. My motherboard can only handle BIOS boot, not GPT. But it is strange that the old drive has a GPT partition, and that boots fine. Do anyone see anything obvious? Do I need to update GRUB even though I cloned all UUIDs?