We are committed to provide service 24 X 7

Deals, Shopping, Training, Tools

60
3.773.055,90

Cart

Quantity 150,00
Quantity 3.500,00
Quantity 5.100,00
Quantity 100,00
Quantity 52,00

Learn how to – How To Backup Linux and Windows Systems using Kopia

Learn how to – How To Backup Linux and Windows Systems using Kopia.

File backup is creating a replica of essential data and storing it separately. The purpose of file backup is to ensure that if the original data is lost or becomes inaccessible due to hardware failure, cyber-attacks, natural disasters, or human error, it can be quickly and easily retrieved from the backup copy.

Today, there are many different system backup tools available, each with its own set of features and capabilities. Examples of popular system backup tools are Mac Time Machine, EaseUS Todo Backup, Acronis True Image, Carbonite, Backblaze etc.

What is Kopia?

Kopia is an open-source backup and versioning system that is designed to make it easy to create and maintain encrypted snapshots of files and directories across multiple storage providers, such as local drives, network-attached storage (NAS), or cloud storage. Kopia dies not not ‘image‘ your entire system but allows you to back up and restore any and all files/directories that you deem are important or critical.

It is compatible with Linux, macOS, and Windows operating systems and comes with both CLI (command-line interface) and GUI (graphical user interface) versions. This makes it a perfect tool for advanced and ordinary system users.

The amazing features offered by Kopia are:

  • Multiple storage providers: It supports saving your encrypted and compressed snapshots to all of the following storage locations:
    • Amazon S3 and any cloud storage that is compatible with S3
    • Azure Blob Storage
    • Backblaze B2
    • Google Cloud Storage
    • Any remote server or cloud storage that supports WebDAV
    • Any remote server or cloud storage that supports SFTP
    • Some of the cloud storage options supported by Rclone
    • Your local machine and any network-attached storage or server
    • Your own server by setting up a Kopia Repository Server
    • Deduplication and compression: It uses advanced data deduplication and compression techniques to minimize the amount of storage space required for backups, making it easy to maintain multiple backup versions over time.
    • Granular retention policies: It supports granular control over retention policies, allowing users to specify how long backups are retained and how many backup versions are kept.
    • File browsing and restore: It allows users to browse and restore files from specific backups, making it easy to recover from data loss or other issues.
    • Encryption: Kopia encrypts all data at rest and in transit using strong encryption algorithms, ensuring that backups are secure and protected from unauthorized access.
    • Incremental backups: It supports efficient incremental backups that only back up changes made since the last backup, reducing backup times and storage requirements.
    • Modern technology stack: It is built on top of modern technologies such as Content-Defined Chunking (CDC), Merkle Tree, and gRPC, which allows it to be fast, secure, and scalable.
    • Extensibility: It is designed to be extensible and can be easily integrated with other tools and systems using its RESTful API and CLI.

Join me in this guide as we explore how to backup Your Linux and Windows Systems using Kopia

Step 1: Install Kopia on Linux / Windows Systems

The fires step requires us to install Kopia on our Linux/Windows system. Kopia comes in two variants:

  • kopia binary: this allows you to use Kopia via CLI
  • KopiaUI: offers a GUI for Kopia

Below are steps to install Kopia on Linux/Windows Systems.

a. Install Kopia on Windows

There are several ways to install Kopia on Windows. These include:

  • Using GUI with KopiaUI package
  • Using Scoop

To install Kopia using the GUI, download the latest packages from the Git Hub release page. On this page, there are several files, download the named KopiaUI-Setup-X.Y.Z.exe

Once downloaded, proceed with the installation as shown:

Once complete, you will see this:

You can also install Kopia using Scoop with the below commands on PowerShell:

scoop bucket add kopia https://github.com/kopia/scoop-bucket.git
scoop install kopia

b. Install Kopia on Linux

Kopia can also be installed on Linux systems. Below are the different commands to install Kopia on your Linux distribution.

  • On Debian, Ubuntu

First, obtain the GPG keys:

sudo apt update && sudo apt install curl -y
sudo -E curl -s https://kopia.io/signing-key | sudo gpg --dearmor -o /etc/apt/trusted.gpg.d/kopia-keyring.gpg

Add the repository:

echo "deb [signed-by=/etc/apt/trusted.gpg.d/kopia-keyring.gpg] http://packages.kopia.io/apt/ stable main" | sudo tee /etc/apt/sources.list.d/kopia.list
sudo apt update

Install Kopia and or Kopia UI with the command:

sudo apt install kopia
sudo apt install kopia-ui
  • On RedHat, CentOS, Fedora, Rocky Linux, Alma Linux

Import the GPG keys:

sudo rpm --import https://kopia.io/signing-key

Add the YUM repository:

cat <<EOF | sudo tee /etc/yum.repos.d/kopia.repo
[Kopia]
name=Kopia
baseurl=http://packages.kopia.io/rpm/stable/$basearch/
gpgcheck=1
enabled=1
gpgkey=https://kopia.io/signing-key
EOF

Install the Kopia/Kopia UI package:

sudo yum install kopia
sudo yum install kopia-ui
  • On Arch, Manjaro

You can also install Kopia on Arch, and Manjaro systems using an AUR helper such as yay:

yay -S kopia

You can also install a binary version with the commands:

git clone https://aur.archlinux.org/kopia-bin.git
cd kopia-bin
makepkg -si

Step 2: Backup Linux and Windows Systems using Kopia

Now once installed, you can create backups from both the UI and CLI. To run Kopia UI, find it in the App Menu on your device.

a. Create a Kopia Repository

Kopia UI starts with the below interface. You need to create a repository.

For this guide, we will create a filesystem repository. For more on how to create a different repository, visit the repositories page.

Create the repository path on your system. For example on Linux:

sudo mkdir -p /kopia/repository
sudo chmod 777 /kopia/repository

On the GUI, select Local Directory or NAS and proceed as shown. Provide the path to the created repo:

Now set a password to secure the repo:

For the CLI, you can create a repository to store the backups. For example, creating a local filesystem repository, use a command with the syntax:

kopia repository create filesystem --path /my-repository

Replace /my-repository with an existing Path for the Kopia repo on your system. For example:

b. Connecting to the Repository

Once a repository has been created, you need to connect to it. This can be an existing one or the one created above.

From the GUI, once created, you automatically connect to the repo, you can disconnect and connect to the preferred one under the repositories tab

From the CLI, use the command with the syntax:

kopia repository connect filesystem --path /my-repository

For example:

You need to provide a password to connect to the repository.

c. Create the First Backup using Kopia

Now we are set to create backups using Kopia. This is simple as you need to specify the source of the files and the destination repository.

So after connecting to the repository as shown above, proceed as shown:

On the Kopia UI:

Select new snapshot.

Provide the path you need to have the snapshot of. You can also use the folder icon to select the desired path:

Once selected, click on snapshot now. You can also define the policies that include the snapshot frequency, effective date etc.

The created snapshot will be available as shown:

From the CLI, use a command with the below syntax:

kopia snapshot create /path/to/file

For example

Now we have a snapshot of the specified Path to the Kopia repository. You can also add policies to the snapshot.

To view the Global policies, use:

$ kopia policy show --global
Policy for (global):

Retention:
  Annual snapshots:                     3   (defined for this target)
  Monthly snapshots:                   24   (defined for this target)
  Weekly snapshots:                     4   (defined for this target)
  Daily snapshots:                      7   (defined for this target)
  Hourly snapshots:                    48   (defined for this target)
  Latest snapshots:                    10   (defined for this target)
  Ignore identical snapshots:       false   (defined for this target)

Files policy:
  Ignore cache directories:          true   (defined for this target)
  No ignore rules:
  Read ignore rules from files:             (defined for this target)
    .kopiaignore
  Scan one filesystem only:         false   (defined for this target)
....

View policies for the connected repo:

$ kopia policy show ~/Downloads
Policy for ubuntu@learnhowto:/home/ubuntu/Downloads:

Retention:
  Annual snapshots:                     3   inherited from (global)
  Monthly snapshots:                   24   inherited from (global)
  Weekly snapshots:                     4   inherited from (global)
  Daily snapshots:                      7   inherited from (global)
  Hourly snapshots:                    48   inherited from (global)
  Latest snapshots:                    10   inherited from (global)
  Ignore identical snapshots:       false   inherited from (global)

Files policy:
  Ignore cache directories:          true   inherited from (global)
  No ignore rules:
  Read ignore rules from files:             inherited from (global)
    .kopiaignore

Now you can set the desired policy using the kopia policy set command. For example:

$ kopia policy set --add-ignore .png --add-ignore .zip ~/Downloads
Setting policy for ubuntu@learnhowto:/home/ubuntu/Downloads
 - adding ".png" to "ignore rules"
 - adding ".zip" to "ignore rules"

Verify:

d. Taking Incremental Snapshots

After the initial backup, you can take snapshots of the same files and directories. To do so, follow the below procedures:

On GUI

To take an incremental snapshot click on the snapshot now icon:

From the CLI

kopia snapshot create  /path/to/file

For example:

e. Managing the Kopia Backups

To view the taken backups, click on the taken snapshot.

This will show all the snapshot information, the files available and the files added in each snapshot:

On the CLI, use the command:

kopia snapshot list  /path/to/file

For example:

If you have multiple snapshots, you can compare them using the kopia diffcommand. For example:

kopia diff kb9a8420bf6b8ea280d6637ad1adbd4c5 ke2e07d38a8a902ad07eda5d2d0d3025d

Step 3: Restore Files/Directories from Kopia Snapshots

Once the snapshots have been taken, we need to know how we can restore the files and directories. To restore files, you need to mount the Kopia snapshot.

I will demonstrate two ways of doing this.

Method 1 – Mount and Restore a Snapshot

Create a mount point:

mkdir /tmp/mnt

Now use the snapshot ID obtained using the kopia snapshot listcommand or from the UI.

kopia mount ka42271ac9d59159518c2f28e98f6da3e /tmp/mnt &

Now view the content:

ls -l /tmp/mnt/

Sample Output:

Now we can restore the files using rsync:

sudo chown -R $USER:$USER /tmp/mnt
sudo rsync -av /tmp/mnt/ ~/Downloads

Method 2 – Restore Snapshot with Kopia Restore Command

The above method is the recommended way of restoring backups, although there is another way of restoring backups using the kopia snapshot restorecommand:

The restore command has the following syntax:

 kopia snapshot restore <sources>

For example:

 kopia snapshot restore ka42271ac9d59159518c2f28e98f6da3e ~/Downloads

for this case, I will restore the snapshot to the ~/Downloads folder. If you fail to specify a directory, a new directory is created and named according to your Kopia snapshot. For example, ka42271ac9d59159518c2f28e98f6da3e for my case.

Sample Output:

Recommended Linux Books  to read:

Verdict

Today, we have learned how to back up your Linux and Windows Systems using Kopia. We can all agree that Kopia is a powerful and flexible backup and versioning system that can help users protect their data from loss or corruption, whether they are working on a personal computer or managing data for an enterprise organization.

See more:

60
3.773.055,90

Cart

Quantity 150,00
Quantity 3.500,00
Quantity 5.100,00
Quantity 100,00
Quantity 52,00