Suppose for some reason that you want to back up Linux installation and configuration files to a USB drive, for example to avoid possible bad situations but do not know how to do it. Also refer to the article on backing up Linux installations to the USB drive below of Taimienphi.vn to learn how to do it.
In the following article, Taimienphi.vn will show you 2 ways to backup Linux settings to a USB drive.
Note: You must prepare a minimum size of 4 GB USB drive. The configuration directories usually contain a lot of data, so if there is not enough USB drive space, it may cause an error.
Backup Linux settings to USB drive
Method 1: Use Tar command to backup Linux installation
Using the Tar command to back up Linux installations is the ideal solution for those who want to make the process fast. To create a backup, first open the Terminal window using the key combination Ctrl + Alt + T or Ctrl + Shift + T.
On the Terminal window, use the Tar command to compress the directory – /. config /, This is the directory where most of the storage apps install:
tar czvf linux-settings.tar.gz – /. config /
The above command output is a TarGZ archive file containing most of the Linux configurations.
The next step is to plug your USB drive into the USB port on your Linux computer, then open the file manager and add linux-settings.targ.gz go there.
+, Use the Tar command to back up other installation directories
Backup directory – /. config / Into the TarGZ archive is a way to ensure most of your Linux installations are backed up. However, not all programs store settings in that directory. Some programs and applications store settings in folders – /. Run the following command to back up other installation directories:
tar czvf linux-settings.tar.gz – /
+, Encrypt backup
Linux installations often contain sensitive information, including passwords, bookmarks, and so on. If you are using the Tar command to back up Linux settings to a USB drive and you want to encrypt backups.
The simplest way to encrypt Linux backups is to use the GPG tool. To start the encryption process, run the ggp command below:
gpg -c linux-settings.tar.gz
After the archive file is encrypted, you can delete the unencrypted file by using the following command:
+, Restore from backup Tar
To restore a backup from a backup created by the Tar command, follow the steps below:
Step 1: Insert the USB drive containing the Linux backup into the USB port on the computer, then drag the archive “linux-settings.tar.gz“into the directory home (home / username /).
Step 2: Use GPG to decode TarGZ, if needed.
Step 3: Restore from backup.
tar xzvf linux-settings.tar.gz -C – / –strip-components = 2
Method 2: Backup Linux installation with Deja Dup
Deja Dup is a great backup solution for those who want to create Linux backups to their USB drives but don’t want to use Terminal. Basically, this is an easy to use tool that allows users to backup Linux settings with just a few mouse clicks.
To use Deja Dup, you will first need to install the backup tool. After the installation is complete, proceed to open the tool and plug the USB drive into the USB port on your computer.
After inserting the USB drive, click Storage location in the Deja Dup application. From the dropdown menu, find and click the option named “local folder “.
When you click the “local folder“, the file browser window will display. Your task is to browse to the main folder in the USB drive, then click OK, got it to add a folder to Deja Dup as an archive.
1. Add folders
After setting up the storage folder on the USB drive, the next step you need to do is set up the backup folder. In the Deja Dup application, find and click “Folders to save”, Then click the icon + sign to open the file browse window.
On the file browsing window, make sure you’ve enabled hidden and added folders – /. config /. Also if you can’t activate hidden files or want to back up more folders, you just need to add – / instead of adding – /. config /.
2. Start the backup process
The steps to backup Linux installation to a USB drive with Deja Dup are quite simple. To do this, click Overview, then find and click Back up Now button to start the backup process. Make sure you have checked the box Encrypt If you want to make sure your backups are safe.
3. Restore from backup Deja Dup
To restore from a backup on a USB flash drive, plug your USB drive into the USB port, then open Deja Dup, find and click Storage.
Use the Deja Dup configuration drop-down menu to use your USB drive as a storage location.
After configuring Deja Dup to recognize your USB drive, go back to the Overview window, click tifmv and click Restore button to restore the configuration files to their original locations.
The article above Taimienphi.vn has just taught you how to backup Linux installations to USB drives, you can see how to install Linux on USB here. Also readers can refer to some other articles already on Taimienphi.vn to learn more ways speed up the Fedora Linux application installer Please.