JoeSchmuck / Multi-Report

FreeNAS/TrueNAS Script for emailed drive information.
53 stars 1 forks source link

Partition table / ZFS configuration backups #3

Closed Sophist-UK closed 4 months ago

Sophist-UK commented 5 months ago

@JoeSchmuck Joe

I was wondering whether the script has the ability to save (to a defined location) copies of the partition tables and / or ZFS configurations so that they can be restored if they get corrupted?

I am not quite sure what ZFS configurations could be backed up but SGDISK has the ability to backup the partition table to a file and then restore it.

(Currently trying to help someone else who read somewhere that he should do a sgdisk -Z and zapped the partition tables on the two disks he had just added as a 2nd mirror vDev to an existing pool - thus trashing the pool and losing access to the existing data on the 1st vDev. It occurred to me that a backup of the partition table would have made recovery much easier.)

JoeSchmuck commented 5 months ago

No sir, Multi-Report does not have that capability. If you can provide me exact details on the commands for both FreeBSD and Debian, I could generate that portion but who is going to test it to make sure it works? If I add something like that, I still need to be able to say that it will restore the partition tables without issue.

I use to manipulate partition tables using 'debug' back in the MS-DOS days. I know there have been some changes since the 1990's.

I think your idea is a good one but someone needs to test it. And would it restore both partition tables? I'm under the impression that there are two tables, one at the beginning of the disk and one at the end. I could be very wrong as well, it has been a long time for me on this topic.

Sophist-UK commented 5 months ago

sgdisk backup should be relatively easy.

I do not propose an automated restore functionality for the same reasons as the previous issue - you wouldn't want to automate restore unless there was literally 100% chance of doing the correct thing (and that is impossible). But you might want to allow the user to restore based on user input.

I would be happy to test the backup.

I am far less sure about ZFS configuration backup and restore - I will do some research when I have time.

JoeSchmuck commented 5 months ago

Hum... Okay. I added the request to my next build. I will include it in the next few days and I can forward you the script. I don't plan to send to out publicly unless there is a driver making me fix something. I am considering adding it to GitHub then anyone can try as they see fit. I'll reach out to you in the next day or two.

JoeSchmuck commented 4 months ago

I forgot to reach out to you. I implemented the partition backup a while ago, well it all seems like a long time ago when you get older. I did not test the recovery of a partition, but it is generated by the script and will go out weekly with the other reports on Monday by default. Okay, by default the "partition check" is disabled. This is because on CORE it will need to install (copy) gdisk and sgdisk to the drive and I prefer to let the end user make that choice. SCALE has the files already. "partition backup" is enabled by default so if it can run sgdisk, a backup of the partition will be created for each drive and will accompany the TrueNAS configuration backup (default is Monday).

If you give the partition recovery a test, please let me know the outcome. It would be nice to verify it really works.

-Mark

Sophist-UK commented 4 months ago

I just updated - but I didn't spot any options for enabling / disabling partition backups. I will have to wait until Monday to see what I get sent to me.

I won't be testing partition recovery for obvious reasons.

JoeSchmuck commented 4 months ago

Sorry about that, I have not added the questions in the configuration file. Currently it is a manual change in the multi_report_config.txt file. I will update that today. I am also working on addressing a problem that people with a lot of drives may have… Getting SMART tests to be configured to run as desired. One person had over 100 drives, several got missed from the TrueNAS smart self-test routine. I have a form of it implemented now however after talking to this person, trying to schedule that many drives in 1 week, a bit unrealistic. The script does it, just not practical. So I’m slowly working to make it a monthly option. Select the weeks and days for the weeks to run SMART Long self-tests.

From: Sophist @.> Sent: Saturday, June 22, 2024 12:49 PM To: JoeSchmuck/Multi-Report @.> Cc: Joe Schmuck @.>; Mention @.> Subject: Re: [JoeSchmuck/Multi-Report] Partition table / ZFS configuration backups (Issue #3)

I just updated - but I didn't spot any options for enabling / disabling partition backups. I will have to wait until Monday to see what I get sent to me.

I won't be testing partition recovery for obvious reasons.

— Reply to this email directly, view it on GitHubhttps://github.com/JoeSchmuck/Multi-Report/issues/3#issuecomment-2184095748, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AA6522QMXH7WP3VBH3XARTTZIWTJDAVCNFSM6AAAAABJA63ORKVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCOBUGA4TKNZUHA. You are receiving this because you were mentioned.Message ID: @.**@.>>