Introduction
Linux servers are the backbone of many enterprises, valued for their scalability and security. However, hardware failures, cyberattacks, or system downtime can lead to data loss, making backup and restore linux server a critical task. Below, we first explore 6 common and practical methods to achieve this, then introduce a more powerful professional solution to meet complex backup needs.
6 Common Methods for Backup and Restore Linux Server
These common methods each have their own operational logic and applicable scenarios. They can be flexibly selected based on the actual requirements of the Linux server, such as whether the backup target is a full system or specific files, whether remote transmission is needed, and the requirements for recovery efficiency.
► Method 1: Backup and Restore Linux Server Using Rsync and Cronopete
Rsync is a versatile Linux utility for file synchronization and transfer, supporting local and remote operations via shell or rsync daemon. It offers flexible parameters like verbose output (-v), backup creation (-b), file exclusion (-exclude=PATTERN), and checksum-based skipping (-c) to optimize backup processes.
Backup Steps:
- Insert the backup medium and use the fdisk -l command to confirm the drive letter.
- Open the terminal and run the root directory backup command:
sudo rsync -aAXv / –exclude={“/dev/*”,”/proc/*”,”/sys/*”,”/tmp/*”,”/run/*”,”/mnt/*”,”/media/*”,”/lost+found”} /target_folder
This backs up the entire root directory while excluding non-essential system directories.
- For backing up a home directory with large files (e.g., MS Word documents and mail folders), use:
rsync -aiz . bkhost:backup/user_name/
Recovery Steps:
Cronopete, a Linux alternative to Mac’s Time Machine, focuses on user file recovery (not full OS backup).
- Install Cronopete and launch it via the terminal with cronopete.
- Click “Configure now” on the welcome page, then connect an external HDD or USB and select “Change disk” to choose the storage device.
- Format the disk for backups and customize backup objects and intervals in the “Options” section (it defaults to backing up the $HOME directory).
- To restore, right-click the Cronopete menu icon, select “Restore files”, choose the target files/folders from the backup device, and click “Restore files”.
► Method 2: Backup and Restore Linux Server Using Bera
Bera is a streamlined backup system that simplifies backing up critical files, folders, and server configurations, supporting full backup, recovery, and server migration in just 10 minutes. It uses SSH for secure transmission and allows excluding specific domains or files.
Key Parameters:
- backupOrigin: Specifies “local” for on-server backups or “SSH” for remote backups.
- backupLocalDir: Local directory storing the backup.
- backupRemoteUser: SSH username for connecting to the remote backup server.
- Backupremoteserver: Address of the remote SSH backup server.
- backupRemotePort: SSH port number of the remote server.
- backupRemoteDir: Remote directory for storing backups.
Preparation:
Ensure the Linux server has Rsync, SSH installed, and root access to both source and target systems.
Backup Steps:
- Configure the server (install OS, set up network, and install required packages).
- Use Bera to download service configurations, files, and folders.
- Upload bera-backup.shand bera-restore.sh to the server, then set execution permissions:
chmod +x bera-backup.sh
chmod +x bera-restore.sh
Configure the scripts using the provided examples (_bera_restore_config_example and _bera_backup_config_example).
- Run the backup command with the config file:
./bera-backup.sh PATH_TO_CONFIG_FILE
Recovery Steps:
Download the backup from the server and initiate restoration with:
./bera-restore.sh PATH_TO_CONFIG_FILE
► Method 3: Backup and Restore Linux Server Using Tar
Tar (tape archive) is a classic tool for compressing and archiving files, often paired with gzip or bzip for compression. It uses simple parameters to create, extract, and list archives (known as “tarballs”).
Key Parameters:
- -c: Create a new archive.
- -v: Enable verbose output to track progress.
- -f: Specify the archive filename.
- -t: List files within an archive.
- -x: Extract files from an archive.
- -z: Compress/decompress using gzip.
Backup Steps:
- Create a basic tar archive for a user’s home directory:
tar -cvf backup_name.tar /home/user
- Create a compressed tar.gz archive:
tar -cvfz backup_name.tar.gz /home/user
- Exclude specific files from the archive:
tar –exclude file.txt –exclude file.sh -cvfz backup_name.tar.gz
- Archive the entire server (exclude existing backups) and save to a new directory (ensure the server is not in maintenance mode):
sudo tar –cvpzf backup_name.tar.gz –exclude=/home/server/backup.tar.gz –one-file-system
Recovery Steps:
Extract the tar.gz archive to restore data:tar -xvpf /media/your_harddisk/backup.tar.gz
► Method 4: Backup and Restore Linux Server Using Cpio
Cpio (copy in/out) is a file archiver for creating/extracting archives or copying files between locations. It operates via standard input/output and offers features like unconditional copying and automatic directory creation.
Key Parameters:
- -O: Read data from standard input to create an archive.
- -i: Extract files from standard input.
- -c: Use ASCII characters for header information.
- -d: Create directories if they don’t exist.
- -u: Copy files unconditionally without overwriting older files.
Backup Steps:
- Create a backup of target files:
ls file* | cpio -acvf > /root/backup.cpio
- View the contents of the archive (two alternative commands):
cpio -it </root/backup.cpio
cpio -it -I /root/backup.cpio
Recovery Steps:
Restore files from the archive:
cpio -icuvd </root/backup.cpio
► Method 5: Backup and Restore Linux Server Using DD Command
The DD (Disk to Disk) command is used for partition-level backups, directly copying data from one partition to another. It can create duplicate partitions without generating separate backup files.
Backup Step:
Backup a source partition to a destination partition:
dd if=source_partition of=destination_partition
Create a duplicate partition (no separate backup file):
dd if=existing_source_partition of=destination_partition
Recovery Step:
Restore the backup partition to another empty partition:
dd if=destination_partition of=another_empty_partition
► Method 6: Backup and Restore Linux Server Using SCP and Timeshift
SCP (Secure Copy) enables encrypted file transfer between Unix/Linux systems (local, remote, or between remote servers). Timeshift is a system restore tool (pre-installed on some distributions) that supports point-in-time recovery.
SCP Key Parameters:
- -r: Copy directories recursively.
- -q: Disable progress indicators.
- -v: Enable verbose mode for troubleshooting.
- -p: Specify a custom port for transfer.
SCP Preparation:
- Permission to copy files on the target system.
- An account or authorized public key on the target system.
- Read permission on the source and write permission on the target.
Backup Steps:
- Copy a file from local to remote server:
scp filename root@serverxxx.example.com:/root
- Copy files from remote to local server:
scp root@serverxxx.example.com:/root/backup*
- Replicate an entire directory:
scp –r directory root@serverxxx.example.com:/root
- Use blowfish/arcfour encryption for better performance:
scp -c blowfish filename root@serverxxx.example.com:
- Specify a custom port for transfer:
scp -p xxxx backup_file root@serverxxx.example.com:/tmp
Recovery Steps:
- Install Timeshift (distribution-specific commands):
- Ubuntu/derivatives:
sudo add-apt-repository -y ppa:teejee2008/timeshift && sudo apt-get update && sudo apt-get install timeshift
- Fedora/CentOS/RHEL:
sudo dnf install timeshift
- Arch Linux/Manjaro:
yay -S timeshift
- Launch Timeshift from the Applications menu, enter credentials, and authenticate.
- Follow the Setup Wizard: select snapshot type (Rsync/Btrfs), specify storage location, set snapshot frequency and levels, choose whether to back up the home folder, and click “Finish”.
- To restore, click “Restore” on the main window, select the desired snapshot, and proceed with the recovery.
i2Backup: Advanced Solution for Backup and Restore Linux Server
While the above methods are effective for basic needs, they often require memorizing complex commands and lack centralized management. For enterprises or users with large-scale data protection needs, info2Soft offers a professional, user-friendly solution tailored for backup and restore Linux server.
i2Backup is a comprehensive backup and recovery software that supports multiple platforms, including a wide range of Linux distributions (SUSE Linux 11/12/15, RedHat 6/7/8, CentOS 6/7/8, Oracle Linux 6/7/8, Ubuntu 14.04-20.04, Rocky Linux, etc.). It covers backup scenarios for Linux server systems, files, databases, and virtual machines, providing one-stop data protection with flexible scheduling, secure transmission, and efficient recovery.
- Broad Compatibility: Seamlessly works with mainstream Linux distributions and supports multiple storage media (local disk, SAN, NAS, S3-compliant object storage, tape library) for flexible backup destination choices.
- Diversified Backup Types: Offers full, incremental, differential, and forever incremental backups to balance backup speed and storage efficiency.
- Enhanced Data Security: Supports AES-128/256, SM4, and RC5 encryption for data in transit and at rest, with kernel-level immutable storage to prevent tampering (even root users cannot delete backup data).
- Efficient Data Management: Features data deduplication and compression to reduce storage usage by up to 50%, and supports LAN-Free backup transmission to avoid impacting production bandwidth.
- User-Friendly Operation: Provides a B/S architecture web console (compatible with Edge, FireFox, Chrome) for centralized management, supporting batch backup tasks, real-time monitoring, and one-click recovery.
- Non-Downtime Backup: Backs up running Linux servers without interrupting business operations, ensuring continuous service availability.
We have a professional team to provide you with technical support, ensuring you won’t encounter any issues during backup and recovery process.
Conclusion
Backup and restore linux server is essential for safeguarding enterprise data, and the 6 common methods above provide practical options for different scenarios. For users seeking a more efficient, secure, and manageable solution, info2Soft i2Backup stands out with its broad compatibility, robust features, and user-friendly interface. Whether you’re handling small-scale file backups or large-scale server clusters, i2Backup simplifies linux server backup and restore processes, ensuring data integrity and business continuity. Invest in the right backup tool to avoid irreversible data loss and protect your critical assets.