Good morning all, in today’s episode of “What I learned during work hours”…

I was playing around with wxHexEditor and realised that if something catastrophic happened, I would really struggle with any data recovery if I lost the inode tables for any drive.

A quick duckle pointed me to e2image, which says in the man:

It is a very good idea to create image files for all file systems on a system and save the partition layout (which can be generated using the fdisk -l command) at regular intervals — at boot time, and/or every week or so.

I couldn’t find any prebuilt solutions for this online, so I wrote a systemd service and timer to do this for me. I save the fdisk to a text file, run e2image on a couple drives, and compress it all together in a dated 7z that can get uploaded via rsync or Mega or Dropbox etc.

The metadata image from a 500gb drive is 8gb, but compresses down to 40mb. Backup takes a couple minutes.

Unfortunately this does not work with my raid drives, but they are RAID1 so already resilient.

Apparently I was being a derp somehow. …Anyways,

My RAID drives are 16TB, e2image of this is 125gb, and 7z’d it comes down to just 63mb.

I’ll post the service, timer, and backup script in a comment, let me know if you can spot anywhere for improvements!

    • ∟⊔⊤∦∣≶@lemmy.nzOP
      link
      fedilink
      arrow-up
      1
      ·
      11 months ago

      Great tips, thanks!

      I’m using ext4 across everything I think.

      Can you enable superblocks after you’ve already formatted the drive?

      Fdisk saves the offsets so keeping a record of that at least sounds like a good idea.

    • Violet_McQuasional@feddit.uk
      link
      fedilink
      arrow-up
      1
      ·
      11 months ago

      This is why I love having luks covering my entire system disk. If I want to upgrade the system with a new drive or move the drive to a different pc or sell it or dispose of it I just dd the first couple of gigs to obliterate the luks header.

      It’s obviously essential to have a backup strategy, of course, but full disk encryption is the only way to go for me.