Rocky Linux and Disk Imaging

Wiki.TerraBase.info
Revision as of 08:05, 19 December 2023 by Root (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Is there an equivalent to Acronis Products, O & O BackUp, etc. for Linux? Spoiler alert! Not anymore (there was way back in the Acronis 9.5 days, O & O never supported Linux).

OK, how about Clonezilla or Rescuezilla? They're great, but one is required to boot from an ISO Image. So not so great for those nightly automated backups like Acronis, O & O, and many other do in Windows (thank you VSS (Volume Shadow Copy Service))

Let's keep looking. FSArchiver! Yup, it supports "SnapShots" (equivalent to VSS in Windows) via ruBackUp

How about Bacula or BareOS? Sure, but it's complicated. So back to something simple, so back to FSArchiver. Well, sort of. What about "live" backups? IE, no need to reboot to a Clonezilla ISO or CD. Clone a live / running OS, sort of like how Acronis and other software for Windows has been doing it for more than a decade using the VSS (Volume Shadow Copy) Service, AKA "Snap Shots".

OK, RUBackUp then. Cool.

What You'll Need

  • Of Course: https://rubackup.gitlab.io/ (This is just a simple Copy / Paste of files to "install")
    • After installing (probably to /opt/rubackup, just to keep things inline with their examples);
      • ln -s rubackup.rb rubackup (enables one to simply type rubackup instead of rubackup.rb)
      • export PATH="/opt/rubackup:$PATH" (makes the "rubackup command" available from any directory)
  • And for LVM Support, which is needed for "Live" BackUps (and snapshots): https://www.fsarchiver.org/ (for the latest version, this requires make, make config, make install, and all the associated compiling tools)

Quick Tips

  • RUBACKUP is configured to look in /etc/rubackup.d for "BackUp Scripts"
  • Also see this for addtional configuration items: Installing FSArchiver on Rocky Linux
  • ZSTD is busted in Rocky Linux 9 (and probably others) as of some time in 2023
  • https://rubackup.gitlab.io/
  • Directory for BackUp Configuration Files Default Location: /etc/rubackup.d
  • rubackup --config '/etc/rubackup.d/Rocky8_ROOT-Partition_to-FSArchive.yaml' --loglevel 6 --logfile /var/log/Rocky_ALL-Partition.log
Options:
  --config <configuration-files>: use alternative configuration file(s)
    example1: --config '/etc/rubackup/*.yaml' (config in a multiple files)
    example2: --config '/etc/rubackup.yaml' (config in a single file)
  --outlevel <level-for-output>: set verbosity of console messages (between 0 and 6)
    example: --outlevel 4 (use higer level of verbosity to get more details and debugging)
  --loglevel <level-for-logfile>: set verbosity of messages logged to file (between 0 and 6)
  --logfile <path-to-logfile>: enable logging to a file (cf --loglevel)
    example: --logfile /var/log/rubackup.log --loglevel 5
  • Example Configuration File (even though the -v (Verbose Option) is included, it doesn't really work to show progress);
global:
    day_of_week: Sun
    day_of_month: 1

schedules:
    Rocky8_ALL-Partitions_Schedule:
        daily: 7
        weekly: 0
        monthly: 0

entries:
    Rocky8_ALL-Partitions:
        backup_type: ModuleBackupFsarchiver
        backup_schedule: Rocky8_ALL-Partitions_Schedule
        backup_opts:
            description: 'BackUp of ROOT Partition on SSD (excluding BIOS, BOOT, and SWAP)'
            excludes:
                - '/tmp/*'
                - '/var/tmp/*'
            command_opts:
                - '-Z1'
                - '-j2'
                - '-v'
            filesystems:
                - block_device: /dev/rl/root
                  snapshot_type: lvm
                  snapshot_size: 1024M
        bakfile_dir: /mnt/sdd1/BackUps/ruBackUp/Rocky8_ROOT-Partition
        bakfile_owner: root
        bakfile_group: root
        bakfile_mode: 0600
        bakfile_basename: Rocky8_
  • Restore a BackUp (assumes MBR based Drive): Doing it in Linux with RUBACKUP and FSARCHIVER ain't like the end to end solutions in Windows with Acronis and similar. It's a manual process of 'building' a disk to the point where the individual Boot and Root Partitions can be put into place. There's even some argument to make an offline DD copy / clone of a physical disk and have it ready as a backup to create
    • Create MBR and GRUB 1.5
      • Windows Utility: BootIce
      • Linux Utility
    • Use CFDISK to recreate the various Partitions (ideally the same size (or bigger)), and make the first partition active (Bootable option in CFDISK)
    • Use BLIVET-GUI or equivalent VG..., LG... commands to recreate the LVM stuff.
      • ...oh, and BLIVET-GUI can't deal with any names that are duplicated among various LVM disks
    • LVRENAME VG OldLV NewLV
    • ...and if there's an error like this: Devices file WhatEverName PVID last seen on /dev/WhatEverDevice not found. (from https://serverfault.com/questions/1093110/linux-lvm-pvid-last-seen-on)
      • Edit: /etc/lvm/devices/system.devices and get rid of the offending device
      • OR Edit: /etc/lvm/lvm.conf and add this line: use_devicesfile = 0
      • ...the above two items might be very useful in consideration of restoring LVM based OSs as it allows for commands like LVDISPLAY to scan for LV Groups instead of looking to a configuration file
    • Restore: fsarchiver restfs WhatEverArchiveName id=X,dest=/dev/sdXY (get the id from fsarchiver archinfo WhatEverArchiveFile)
  • Restoring and LVM Related Stuff
    • If a duplicate partition (Volume if LMV) is mounted;
      • umount /mnt/sdb3
      • lvremove WhatEverVolumeGroupName/VolumeName (look in /dev for the Volume Group, then look in that Directory for the Volume Name): lvremove VG_01_Clone/root
    • If not, create a partition (LVM, etc) ideally equal in size to the original (it can be as small as the expanded size of the backup)
    • fsarchiver restfs /mnt/sdd1/BackUps/ruBackUp/Rocky8_ROOT-Partition/Rocky8_-20230207.fsa id=0,dest=/dev/VG_01_Clone/root