Backing up to NAS

I have a Qnap (yes, I hear the boo’s) that I’m trying to figure out an easy way to backup my linux box to. All the solutions I find are CLI and I’d rather have a GUI to do it so I’m not fucking everything up.

I have a good nas to cloud app, but I need to get this thing on the nas first.

Happy to take suggestions on where to look. I’ve been googling for about an hour and haven’t found what I need. Either it’s just the OS or direct form the desktop to the cloud. Any ideas?

Take a look at https://freefilesync.org/.

The ones I usually rely on (SyncBackPro, SyncTime, GoodSync, etc.) have no Linux version, or are CLI only. But FreeFileSync is easy to install on Rocky and has a decent GUI.

Awesome! Thanks Jan! That worked a treat!

hate to be that guy,. but once you learn about the power of rsync youll soon preffer the cli for stuff like this

bascially

rsync -avhp /source/you/want/to/copy/ /target/you/copy/to/

I love it deeply personally.

2 Likes

Essentially what I’m looking for is getting as close as possible to a full disk clone. Will rsync copy everything on the drive? I have the nas loading on boot from the fstab so it shouldn’t be an issue, except when the copy comes to the /mnt folder. I had to filter out /mnt and /proc.

What are the -avhp tags representing?

Others can weigh in here…

But in my mind there are three data sets to worry about, and what your goal is.

  • The entire system, so you can roll back or fix a broken system drive.
  • All the interesting configuration files for reference, and all the user/app data
  • Just the user/app data

What I’m not certain about is, whether you could boot of a different drive and rsync back your NAS to your boot drive and re-establish a working system. Also keeping in mind that rsync does not keep any history, but is always just the latest, possibly too recent to recover from a failure.

For full system recovery, an actual disk snapshot seems like a more foolproof way of doing that, rather than a filesystem level rsync.

That said, and rsync of your user’s home folder, plus any data drives you have mounted, maybe even the /opt file tree with all the apps is totally usable. In that case you quickly re-install a virgin OS and rsync all the non-OS data back in, and it should fit.

That leaves a gap with all the little changes we make to the OS (tweaks, mounts, etc.). While they may not rsync back cleanly, having a copy of files like /etc/fstab for reference so you don’t do it from scratch is super valuable. As snapshots are in-time, you could keep a few of thema round for different check points.

Mac TimeMachine is great for restoring a borked OS. But that’s because it’s tightly integrated with the recovery function in the boot loader. I’m not sure if there’s a good Rocky equivalent?

PS: Was looking more into that. I’ve come across a few articles that describe full system backup/recovery with rsync. However, it think they assume the OS lives on a single disk. My Rocky 8.7 seems seems to be split over 3 filesystems (root, home, and boot). So you would have to rsync them separately, or your system will look differently afterwards. You also have to restore the LVM config on the drives.

So yes, rsync might be able to do full system recovery on a straightforward single, non-LVM disk config.

Explainshell has this awesome tool that allows you to type in a command with flags and it’ll tell you all the information you need to know about these flags.

https://explainshell.com/explain?cmd=rsync+-avhp

If you were a Synology user, I would tell you to use Synology Active Business Backup. A little Google fu tells me that Qnaps equivalent is Netbak Replicator.

Something with snapshots is ideal. They capture moments in time, each hour, then, each day, then, each week, then each month. While our Sink is super fast and dope, and I highly recommend that you just know that tool in general, you’d have to upgrade to rsnapshot in order to get snapshots of rsyncs.

This is a great way to ensure against user error, hardware failures, and malware.

Thanks Jan and Randy. I looked in to Netbak but they only have a windows option. I also really like explainshell. Takes the mystery out of things.

I think what I want is to have a full image of my new system with everything installed and all the tweaks and fidgets done to make it a workable machine before I start mucking with things. I’ll look in to finding something that does rsync copies on a daily basis. I snapshot my nas every night, but I want to make sure that I’m keeping the computer backups up to date as well.

For true, just role it back kind of backups, there a tools that come on bootable memory sticks that can clone a drive at the physical level. A bit slower, but good of you want to preserve your system in time.

Another option is Ansible. It’s an open-source and easy way to run repeatable commands to perform tasks. Once you setup an SSH key between an Ansible controller (I use a Rocky VM in VirtualBox) and your machine(s), and set a super simple Ansible hosts file that specifies groups of machines, you can create something like this…

install_step1_dku.yml
install_step2_chrome_fstab_teradici_mounts_tailscale_plugins.yml
install_step3_teradici.yml
install_step4_tailscale.yml
install_step5_flame_2023.3.yml
install_step5_flame_2024.yml
install_step6_user_mltw.yml
install_step7_zfs.yml

These are Ansible Playbook files, that I created steps…

This is what an Ansible Playbook file looks like… it magically installs the DKU

---
- name: Install DKU
  hosts: all
  become: yes
  gather_facts: no
  tasks:
    - name: Install NFS utils
      ansible.builtin.yum:
        name: nfs-utils
        state: present
      become: yes

    - name: Create /Volumes/hotstorage directory
      ansible.builtin.file:
        path: /Volumes/hotstorage
        state: directory
      become: yes

    - name: Mount NFS share
      ansible.builtin.mount:
        path: /Volumes/hotstorage
        src: '10.10.0.122:volume1/hotstorage'
        fstype: nfs
        opts: 'defaults'
        state: mounted
      become: yes

    - name: Copy DKU tarball
      ansible.builtin.copy:
        src: "/Volumes/hotstorage/02_assets/flame_versions/DKU_18.1.0.tar"
        dest: "/tmp/DKU_18.1.0.tar"
        remote_src: yes

    - name: Extract DKU tarball
      ansible.builtin.unarchive:
        src: "/tmp/DKU_18.1.0.tar"
        dest: "/tmp"
        remote_src: yes

    - name: Install DKU
      ansible.builtin.shell: "/tmp/DKU_18.1.0/INSTALL_DKU"
      args:
        chdir: "/tmp/DKU_18.1.0"
      register: install_dku_result

    - name: Reboot the system
      ansible.builtin.reboot:

This one installs all the plugins I care about…

- name: Install Chrome and update /etc/fstab
  hosts: linux
  become: true
  tasks:
    - name: Install dnf-plugins-core
      ansible.builtin.package:
        name: dnf-plugins-core
        state: present

    - name: Install epel-release
      ansible.builtin.package:
        name: epel-release
        state: present

    - name: Enable powertools repository
      ansible.builtin.command: dnf config-manager --set-enabled powertools

    - name: Install wget and dnf-utils
      ansible.builtin.package:
        name:
          - wget
          - dnf-utils
        state: present

    - name: Download Google Chrome RPM
      ansible.builtin.get_url:
        url: https://dl.google.com/linux/direct/google-chrome-stable_current_x86_64.rpm
        dest: /tmp/google-chrome-stable_current_x86_64.rpm

    - name: Install Google Chrome
      ansible.builtin.dnf:
        name: /tmp/google-chrome-stable_current_x86_64.rpm
        state: present
        disable_gpg_check: yes

    - name: Add NFS entry to /etc/fstab
      ansible.builtin.lineinfile:
        path: /etc/fstab
        line: '10.10.0.122:/volume1/hotstorage  /Volumes/hotstorage nfs soft,timeo=60,_netdev,rw 0 0'

    - name: Ensure /Volumes/hotstorage directory exists
      ansible.builtin.file:
        path: /Volumes/hotstorage
        state: directory

    - name: Mount all filesystems
      ansible.builtin.mount:
        fstype: nfs
        opts: soft,timeo=60,_netdev,rw
        src: 10.10.0.122:/volume1/hotstorage
        path: /Volumes/hotstorage
        state: mounted


    - name: Add Tailscale repository
      ansible.builtin.command: dnf config-manager --add-repo https://pkgs.tailscale.com/stable/centos/8/tailscale.repo

    - name: Install Tailscale
      ansible.builtin.package:
        name: tailscale
        state: present

    - name: Enable and start tailscaled
      ansible.builtin.systemd:
        name: tailscaled
        enabled: yes
        state: started

#    - name: Bring Tailscale up
#      ansible.builtin.shell: tailscale up
#      register: tailscale_up_output
#      changed_when: false

#    - name: Display Tailscale up output
#      ansible.builtin.debug:
#        msg: "{{ tailscale_up_output.stdout }}"

#    - name: Get Tailscale IP
#      ansible.builtin.shell: tailscale ip -4
#      register: tailscale_ip_output
#      changed_when: false

#    - name: Display Tailscale IP
#      ansible.builtin.debug:
#        msg: "{{ tailscale_ip_output.stdout }}"

#    - name: Install NeatVideo5OFX
#      ansible.builtin.shell:
#        cmd: "/Volumes/hotstorage/02_assets/installers/NeatVideo5OFX.Pro.Intel64/NeatVideo5OFX.Pro.Intel64.run"

    - name: Install SapphireOFX package
      ansible.builtin.yum:
        name: /Volumes/hotstorage/02_assets/installers/SapphireOFX-2022.500-1.0.x86_64.rpm
        state: present
        disable_gpg_check: yes

    - name: Install MochaPro2022 package
      ansible.builtin.yum:
        name: /Volumes/hotstorage/02_assets/installers/MochaPro2022-9.0.1-49.g18e5e8f59b54.x86_64.rpm
        state: present
        disable_gpg_check: yes

    - name: Install MochaPro2022-OFX package
      ansible.builtin.yum:
        name: /Volumes/hotstorage/02_assets/installers/MochaPro2022-OFX-9.0.1-49.g18e5e8f59b54.rhel.rpm
        state: present
        disable_gpg_check: yes


    - name: Check if Neat Video is already installed
      stat:
        path: "/usr/local/Neat Video v5 OFX"
      register: neat_video_installed
    
    - name: Run Neat Video installer if not installed
      ansible.builtin.shell: "/Volumes/hotstorage/02_assets/installers/NeatVideo5OFX.Pro.Intel64/NeatVideo5OFX.Pro.Intel64.run --mode silent"
      args:
        chdir: "/Volumes/hotstorage/02_assets/installers/NeatVideo5OFX.Pro.Intel64"
      when: not neat_video_installed.stat.exists

    - name: Enable chrony service
      systemd:
	name: chronyd
        enabled: yes
        state: started

    - name: Set timezone to automatic
      shell: timedatectl set-ntp true

It looks complicated but I did this entirely using Chat GPT. I kinda gave up on Linux backups because I was always tweaking and figured if the shit hits the fan, all I want is a quick way of getting up and running with repeatable steps that I could automate during a freakout. And for me, in a weird way, redoing something automatically is somehow almost as god as having a backup of it in the first place. I dunno. I’m weird like that.

I know it’s not what you were asking for, but, it might be worth thinking about long term. I mean, heck, I’ll give you these and you could change the paths.

2 Likes

Another rad ansible source…

1 Like