Backup of partition table?

  • Hello, I'm new here and sorry if I ask a question that has already been answered somewhere but I did not find anything with google and the search here.
    Might be that I used the wrong search terms.

    Recently I had an issue where the partition on my RAID5 USB drive got messed up somehow right in the middle of watching a movie. I don't know how or why and if it can happen again. The HDDs and the RAID seem to be fine and the enclosure seems fine too. Anyway after that I suddenly had 2 unformated partitions instead of 1 NTFS and recovery tools would take like 10 days because of the size, so I started building my collection over again. But this time I want to make backups of the partition table and not the content on it (Its in a RAID5 for that reason) I found a tool on windows that lets me do that but that would require to plug the drive into my pc every time I want to make a backup.

    So my questions are:

    1. Would backing up the partition table enable me to restore the partition if this happens again?
    2. Is there a way for my pi4 with libreelec to automatically make backups of the partition table?


    Thank you

  • There are some rough edges to NTFS support since we switched from NTFS-3G to in-kernel drivers with LE11. However that should only result in the mounted NTFS volume being marked "dirty" needing chkdsk.exe to clear the dirty state. We haven't seen reports where volumes or the underlying partition data have been trashed. Most partition schemes also maintain multiple copies of tables to prevent against total loss (or to at least make restore easier) so if those are also missing I'd be suspecting a more serious problem with the storage (favourites would be power and firmware issues): I note that LE deliberately doesn't support any form of software RAID so it must be done in hardware (which means RAID config is nothing to do with our software).

    Partition data can be backed up with a script that uses "dd" to copy the first few MB of disk to a file. You then need to script that being sent off-box or stored on a separate storage device. You can automate script execution with cron or a systemd timer.

  • Thanks for the help. I'll look into that.
    I don't know how to use these tools though since I have almost no experience with linux. Just to make sure "dd" writes byte per byte to a file, right? So I would do that for the part on the partition where partition data is stored and to restore it I would use the same command to write from file back on to disk?

    I suspect the storage too but I never expected this could happen

  • Hi,

    Just to make sure I'm doing this correctly. This is the line I added in cron and its supposed to backup the MBR and partition information onto the sdcard weekly at 3 AM sundays with a timestamp in the filename. I tested it manually and it worked. Would this line work in cron?

    00 03 * * 1 dd if=/dev/sda2 of=/storage/backup/mbr_sicherung_$(date -u +\%Y\%m\%dT\%H\%M\%S) bs=512 count=1

  • Cron normally requires the full path to a binary, so "/usr/bin/dd" instead of plain "dd" but the rest should work. You might want to log output to somewhere on /storage to ensure it works fine.