Using Fedora ARM Server for 3-2-1 Backup Plan

Using Fedora ARM Server for 3-2-1 Backup Plan
Introduction: This article is aimed at users who want to make full use of physical server systems and use built-in tools like Cockpit for data backup and personal data recovery. It describes the three stages of backup.
Word count: 4998, estimated reading time: 7 minutes
LCTT Translator: Beiming Nange
🌟🌟🌟
Using Fedora ARM Server for 3-2-1 Backup Plan
Translation: 15.0 articles

|

Contribution: 1663 days
2017-10-08
β†’
2022-04-28
https://linux.cn/lctt/hwlife

The Fedora Server operating system can run on single-board computers (SBC) like Raspberry Pi. This article is aimed at users who want to make full use of physical server systems and use built-in tools like Cockpit for data backup and personal data recovery. It describes the three stages of backup.

Using Fedora ARM Server for 3-2-1 Backup Plan

Necessary Preparations

To use this guide, you need a running Fedora Linux workstation and the following items:

β—ˆ You should read, understand, and practice the requirements for Server InstallationπŸ”— docs.fedoraproject.org and AdministrationπŸ”— docs.fedoraproject.org in the Fedora documentation.
β—ˆ A single-board computer (SBC) for testing Fedora Linux. Check Hardware RequirementsπŸ”— docs.fedoraproject.org here.
β—ˆ The original image of Fedora ARMπŸ”— arm.fedoraproject.org ServerπŸ”— arm.fedoraproject.org & ARM image installer.
β—ˆ An SD storage card (64 GB / Class 10) or an SSD device.
β—ˆ An Ethernet/DHCP reserved IP address or a static IP address.
β—ˆ A Linux client workstation that provides SSH keys.
β—ˆ A chosen cloud storage service.
β—ˆ An additional available Linux workstation.

For this setup, at the time of writing this article, due to cost and availability reasons, I chose Raspberry Pi 3B+/4B+ (one for hot switching). When using Cockpit to remotely connect to the Raspberry Pi server, you can place the Raspberry Pi near the router for setup.

Using Fedora ARM Server for 3-2-1 Backup Plan

Enhancing Server Security

After completing the installation and management of the SBC server, it is a good practice to enhance server security with firewalld.

Before connecting storage devices to the server, once the server is online, you must set up the firewall. firewalld is a zone-based firewall. After completing the installation and management guide according to Fedora documentation, create a predefined zone named FedoraServer.

Using Fedora ARM Server for 3-2-1 Backup Plan

Rich Rules in firewalld

Rich rules(rich rule) are used to block or allow a specific IP address or range of addresses. The following rule only accepts SSH connections from registered IP addresses (client workstations) and disconnects other connections. The command is run in the Cockpit terminal or client workstation terminal to connect to the server via ssh.

firewall-cmd --add-rich-rule='rule family=ipv4 source address=<registered_ip_address>/24 service name=ssh log prefix="SSH Logs" level="notice" accept'

Using Fedora ARM Server for 3-2-1 Backup Plan

Deny All Hosts’ Ping Requests

Use this command to set icmp to reject and disallow ping requests:

firewall-cmd --add-rich-rule='rule protocol value=icmp reject'

For other firewall controls, such as managing ports and zones, please refer to the following links. Please note that misconfigured firewalls may expose security vulnerabilities to attacks.

Managing Firewalls in CockpitπŸ”— fedoramagazine.org

firewalld RulesπŸ”— www.redhat.com

Using Fedora ARM Server for 3-2-1 Backup Plan

Configuring File Server Storage

The next step is to connect the storage device to the SBC and then partition the newly inserted storage device using Cockpit. Using Cockpit’s graphical server management interface makes managing a home lab (which can be one or more servers) much easier than before. The Fedora Linux server standard provides Cockpit.

At this stage, an SSD device powered through the USB port of the SBC can work without additional power supply.

β—ˆ Connect the storage device to the USB port of the SBC.
β—ˆ After running (as set in the β€œNecessary Preparations” above), access the machine’s IP address:9090 in your client workstation’s browser.
β—ˆ After logging into Cockpit, click on the β€œTurn on administrative access(Turn on administrative access)” at the top of the Cockpit page.
β—ˆ Click the β€œStorage(Storage)” button on the left panel.
β—ˆ Select the β€œDrives(Drives)” displayed below, then partition and format a blank storage device Using Fedora ARM Server for 3-2-1 Backup Plan
β—ˆ On the selected storage device interface, create a new partition table or format and create new partitions. When initializing the disk, choose β€œGPT Partition Table” in the β€œPartitioning(Partitioning)” type option.
β—ˆ Choose a file system type, here select β€œEXT4”. This is suitable for devices with limited I/O capabilities (like USB 2.0 interfaces) and limited bandwidth (less than 200MB/s) Using Fedora ARM Server for 3-2-1 Backup Plan
β—ˆ To create a single partition that occupies the entire storage space, specify its mount point, such as /media, and then click β€œOk(Ok)”.
β—ˆ Click β€œCreate partition(Create partition)” to create a new partition with the mount point /media.

Using Fedora ARM Server for 3-2-1 Backup Plan

Creating Backups and Restoring Backups

Backup is rarely one-size-fits-all. Here are some choices regarding where to back up data, the steps for backing up data, verifying some automation, and determining how to restore backed-up data.

Using Fedora ARM Server for 3-2-1 Backup Plan

Backup workflow – version 1.0

Using Fedora ARM Server for 3-2-1 Backup Plan

Backup 1. Use rsync to remotely sync from the client to the file server (Raspberry Pi).

The command used for this transfer is:

rsync -azP ~/source syncuser@host1:/destination

Parameters:

β—ˆ -a/--archive: Archive
β—ˆ -z/--compress: Compress
β—ˆ -P/--progress: Show progress

To run rsync with more options, you can set the following options:

β—ˆ --inplace: Update target documents by replacing directly.
β—ˆ --append: Append data to shorter documents.

Before backing up documents to storage space, deduplication and compression of source documents are the most effective ways to reduce backup data capacity.

At the end of each workday, I run this manually. Once I set up the cloud backup workflow, automated scripts are an advantage.

For more details about rsync, please visit the article on Fedora Magazine hereπŸ”— fedoramagazine.org.

Using Fedora ARM Server for 3-2-1 Backup Plan

Backup 2. Use rsync to remotely sync from the file server to the primary cloud storage.

Choosing cloud storage is a factor to consider;

β—ˆ Cost: Upload, storage space, and download fees.
β—ˆ Support for rsync, sftp.
β—ˆ Data redundancy (RAID 10 or running data center redundancy plans).
β—ˆ Snapshots.

Hetzner-hosted Nextcloud meets one of these cloud storage standards – Storage BoxπŸ”— docs.hetzner.com. You won’t be vendor-locked and can switch freely without exit penalties.

Using Fedora ARM Server for 3-2-1 Backup Plan

Generate SSH keys on the file server and create an authorized keys file.

Use ssh-keygen command to generate a new pair of SSH keys for the file server and cloud storage.

ssh-keygen
Generating public/private rsa key pair.
Enter file in which to save the key . . .

Insert the required SSH public key into the new local authorized keys file.

cat .ssh/id_rsa.pub >> storagebox_authorized_keys

Using Fedora ARM Server for 3-2-1 Backup Plan

Transfer the key file to cloud storage.

The next step is to upload the generated authorized keys file to the storage box. To do this, first create a .ssh directory with 700 permissions, then create an authorized file with the SSH public key and assign it 600 permissions. Run the following command.

echo -e "mkdir .ssh 
 chmod 700 .ssh 
 put storagebox_authorized_keys .ssh/authorized_keys 
 chmod 600 .ssh/authorized_keys" | sftp <username>@<username>.your-storagebox.de

Using Fedora ARM Server for 3-2-1 Backup Plan

Using rsync over ssh

Use rsync to sync your file directory’s current state to the storage box.

rsync --progress -e 'ssh -p23' --recursive <local_directory> <username>@<username>.your-storagebox.de:<target_directory>

This process is called a push operation because it β€œpushes” a directory from the local system to a remote system.

Using Fedora ARM Server for 3-2-1 Backup Plan

Restoring a directory from cloud storage

To restore a directory from the storage box, switch to this directory:

rsync --progress -e 'ssh -p23' --recursive <username>@<username>.your-storagebox.de:<remote_directory> <local_directory>

Using Fedora ARM Server for 3-2-1 Backup Plan

Backup 3. Client backup to a second cloud storage.

Deja DupπŸ”— fedoramagazine.org is a tool that provides a quick backup solution for Fedora Workstation in the Fedora software repository. It features GPG encryption, scheduled tasks, file inclusion (which directories to back up), and more.

Using Fedora ARM Server for 3-2-1 Backup Plan

Backing up to the secondary cloud

Using Fedora ARM Server for 3-2-1 Backup Plan

Restoring files from cloud storage

Using Fedora ARM Server for 3-2-1 Backup Plan

Archiving Personal Data

Not all data requires a 3-2-1 backup strategy. This is about sharing personal data. I use a laptop with a 1TB hard drive as an archive for my personal data (family photos).

Go to β€œSharing(Sharing)” in settings (in my case, it’s the GNOME file manager) and toggle the switch to enable sharing.

Using Fedora ARM Server for 3-2-1 Backup Plan

Open β€œFile Sharing(file sharing)”, β€œNetwork(Networks)” and β€œRequired password(Required password)” to allow you to share your public folder with other workstations on your local network using the WebDAV protocol.

Using Fedora ARM Server for 3-2-1 Backup Plan

Using Fedora ARM Server for 3-2-1 Backup Plan

Preparing Rollback Options

Untested backups are no better than having no backups at all. I use a β€œhot-switching” method in my home lab environment to avoid situations like frequent power outages or liquid damage. However, my recommended solution is far from a disaster recovery plan or automated failover in enterprise IT.

β—ˆ Regularly run file recovery operations.
β—ˆ Backup ssh/GPG keys to an additional storage device.
β—ˆ Copy the original image of a Fedora ARM server to an SD card.
β—ˆ Keep full backup snapshots in the main cloud storage.
β—ˆ Automate the backup process to minimize human errors or oversights.

Using Fedora ARM Server for 3-2-1 Backup Plan

Using Cockpit to Track Activities and Troubleshoot

As your project grows, the number of servers you manage also increases. Tracking activities and alerts in Cockpit can lighten your management burden. You can archive these using Cockpit’s graphical interface in three ways.

Using Fedora ARM Server for 3-2-1 Backup Plan

SELinux Menu

How to diagnose network issues, find logs, and troubleshoot in Cockpit:

β—ˆ Check logs in SELinux.
β—ˆ Check β€œSolution details(solution details)”.
β—ˆ When necessary, select β€œApply this solution(Apply this solution)”.
β—ˆ If necessary, review automated scripts and run them.

Using Fedora ARM Server for 3-2-1 Backup Plan

SELinux logs

Using Fedora ARM Server for 3-2-1 Backup Plan

Network or Storage Logs

Server logs track detailed metrics associated with CPU load, memory usage, network activity, storage performance, and system logs. Logs will be organized and displayed in the network panel or storage panel.

Using Fedora ARM Server for 3-2-1 Backup Plan

Storage logs in Cockpit

Using Fedora ARM Server for 3-2-1 Backup Plan

Software Updates

At preset times and frequencies, Cockpit can assist with security updates. When needed, you can run all updates.

Using Fedora ARM Server for 3-2-1 Backup Plan

Software updates

Congratulations on setting up a file/backup server on Fedora ARM server version.

via: https://fedoramagazine.org/3-2-1-backup-plan-with-fedora-arm-server/

Author: Hanku Lee, Edited by: lujun9972, Translated by: hwlife, Proofread by: wxy

This article is originally compiled by LCTT and proudly presented by Linux China.

Using Fedora ARM Server for 3-2-1 Backup Plan
Welcome to reprint according to the CC-BY-SA agreement,
If you need to reprint, please leave a message “Reprint: Public Account Name” under the article,
We will add you to the whitelist, authorizing “to modify when reprinting the article“.

Leave a Comment