mirror of
https://github.com/kneutron/ansitest.git
synced 2025-01-16 04:42:55 +08:00
tested OK p2v with systemrescuecd+zfs to pve vm
This commit is contained in:
parent
b1b3bbf577
commit
0748d97ff8
@ -4,7 +4,9 @@
|
|||||||
|
|
||||||
# 2024.Jun kneutron
|
# 2024.Jun kneutron
|
||||||
|
|
||||||
# Objective: Restore a proxmox zfs boot/root disk from a mirror file over sshfs and reboot into it (Disaster Recovery)
|
# Objective: Bare-metal Restore a proxmox zfs boot/root disk from a mirror file over sshfs and reboot into it (Disaster Recovery)
|
||||||
|
# Useful for P2V or if both disks in the mirror failed
|
||||||
|
|
||||||
# NOTE - proxmox-backup-zfs-bootroot.sh should have been run beforehand!!
|
# NOTE - proxmox-backup-zfs-bootroot.sh should have been run beforehand!!
|
||||||
|
|
||||||
# Tested with "systemrescuecd + zfs" ISO
|
# Tested with "systemrescuecd + zfs" ISO
|
||||||
@ -15,7 +17,7 @@
|
|||||||
|
|
||||||
# MAKE SURE you specify the correct destination disk and other info! Author takes NO RESPONSIBILITY for data loss!!
|
# MAKE SURE you specify the correct destination disk and other info! Author takes NO RESPONSIBILITY for data loss!!
|
||||||
|
|
||||||
# This should hopefully get your full environment back online and running in a minimum amount of time
|
# This should hopefully get your full environment back online and running in a minimum amount of time :)
|
||||||
|
|
||||||
# IT IS HIGHLY RECOMMENDED to test this process in a VM first before you rely on it!
|
# IT IS HIGHLY RECOMMENDED to test this process in a VM first before you rely on it!
|
||||||
|
|
||||||
@ -25,7 +27,7 @@ destdir=/mnt/macpro-sgtera2
|
|||||||
# Will be mounted on this server / local dir
|
# Will be mounted on this server / local dir
|
||||||
|
|
||||||
sshfsmountthis=/Volumes/sgtera2
|
sshfsmountthis=/Volumes/sgtera2
|
||||||
# destination directory on the remote side
|
# destination directory on the remote side - this is where the mirror backup file lives
|
||||||
# TODO add a subdir here for different systems
|
# TODO add a subdir here for different systems
|
||||||
|
|
||||||
loginid=dave
|
loginid=dave
|
||||||
@ -35,11 +37,11 @@ destserver=172.16.25.12 # macpro-static
|
|||||||
# hostname or IP; IP is better for systemrescue environment
|
# hostname or IP; IP is better for systemrescue environment
|
||||||
|
|
||||||
# NOTE this **needs** to be the correct disk!
|
# NOTE this **needs** to be the correct disk!
|
||||||
# Default is set to proxmox restore VM with SCSI disk
|
# Default is set to be a proxmox restore-VM with a SCSI disk; virtio destination disk would be vda
|
||||||
# TODO EDITME
|
# TODO EDITME
|
||||||
zfsroot=sda
|
zfsroot=sda
|
||||||
# Obtain from /dev/disk/by-id
|
# Obtain from /dev/disk/by-id
|
||||||
|
# ALL DATA ON THIS DISK WILL BE OVERWRITTEN FOR THE RESTORE PROCESS - YOU HAVE BEEN WARNED!
|
||||||
|
|
||||||
# failexit.mrg
|
# failexit.mrg
|
||||||
function failexit () {
|
function failexit () {
|
||||||
@ -169,8 +171,8 @@ echo ''
|
|||||||
echo "$(date) - Restoring EFI to /dev/${zfsroot}2"
|
echo "$(date) - Restoring EFI to /dev/${zfsroot}2"
|
||||||
time gzip -cd $efifile |dd of=/dev/${zfsroot}2 bs=1M status=progress || failexit 101 "Failed to restore EFI partition"
|
time gzip -cd $efifile |dd of=/dev/${zfsroot}2 bs=1M status=progress || failexit 101 "Failed to restore EFI partition"
|
||||||
|
|
||||||
# NOTE I have not bothered to re-size the ZFS partition on the replacement
|
# NOTE I have not bothered to re-size the ZFS partition on the replacement disk
|
||||||
# disk to take advantage of any increased disk space
|
# to take advantage of any increased disk space
|
||||||
|
|
||||||
# Tips for resizing here:
|
# Tips for resizing here:
|
||||||
# REF: https://sirlagz.net/2023/07/03/updated-live-resize-lvm-on-linux/
|
# REF: https://sirlagz.net/2023/07/03/updated-live-resize-lvm-on-linux/
|
||||||
@ -230,12 +232,12 @@ Easy fix:
|
|||||||
(initramfs) zpool import -f
|
(initramfs) zpool import -f
|
||||||
Then hit Control+D, boot process resumes and should survive further reboots.
|
Then hit Control+D, boot process resumes and should survive further reboots.
|
||||||
|
|
||||||
If the boot process does not continue, hard reboot and issue:
|
If the boot process does NOT continue, hard reboot and issue:
|
||||||
|
|
||||||
(initramfs) rm -fv /etc/zfs/zpool.cache
|
(initramfs) rm -fv /etc/zfs/zpool.cache
|
||||||
(initramfs) zpool import -a -f -d /dev/disk/by-id
|
(initramfs) zpool import -a -f -d /dev/disk/by-id
|
||||||
|
|
||||||
Then hit ^D to continue the boot process. Further reboots should work OK.
|
Then hit ^D to continue the boot process. Further reboots should now work OK.
|
||||||
|
|
||||||
Finally, without the target/backup $destdir being mounted, you should detach the file-backed copy
|
Finally, without the target/backup $destdir being mounted, you should detach the file-backed copy
|
||||||
from the rpool to get it out of DEGRADED state:
|
from the rpool to get it out of DEGRADED state:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user