How to back up your music files on Linux
If you’re a music fan who uses Linux, you’ll no doubt have dozens, if not hundreds, of music files on your Linux PC. However, if these music files are not backed up, you could lose them if something happens to your system.
To prevent losing the music collection on your Linux PC, a backup is necessary. If you’re not sure how to back up music files on Linux, don’t worry! Follow along as we go over how to back up music files on Linux.
Method 1 – Tar backup
A quick and easy way to back up your music files on Linux is with the Tar terminal app. Tar is a robust command-line tool that users can use to compress and create backups quite easily. The best part? Tar doesn’t require any installation, as it is the backbone of many apps on Linux already!
To create a backup of your music file using Tar, open up a terminal window and follow the step-by-step instructions below.
Step 1: Open up the Linux file manager. Once it is open on your computer, use the file manager to place all music files you wish to back up on your computer in the “Music” folder in your home directory.
By placing all music files you wish to backup in this directory, you will not need to create a separate backup folder later on.
Step 2: After placing all of the music files into the “Music” folder, close your music player (if it is open) and go to the terminal you opened previously. Then, run the ls command on the “Music” directory to confirm that the terminal sees your music files.
ls ~/Music
Step 3: Using the tar czvf command, create a compressed archive of your “Music” directory. Keep in mind that compression will likely take a bit of time, especially if you have a large number of files to back up.
tar -czvf my-music-file-backup.tar.gz Music/
Step 4: When the compression is complete, the Tar command will output an archive file with the name of “my-music-file-backup.tar.gz” in the home directory. Take this file and put it in a safe place (Dropbox, Google Drive, home server, external USB, etc.)
Restore the backup
Do you wish to restore your music file backup? Here’s how to do it. First, place the “my-music-file-backup.tar.gz” archive file in the home directory (~) with the Linux file manager.
Once it is in the home directory (~), run the following command to restore the backup.
tar xvf my-music-file-backup.tar.gz
It should automatically restore the files to your “Music” directory.
Encrypt your files
While music files aren’t exactly sensitive, you may still want to encrypt them. Here’s how to do it. First, ensure you have the gpg tool installed on your Linux PC by running the gpg –help command in a terminal.
Next, after compressing the backup file, run this command to encrypt the backup archive file.
gpg -c my-music-file-backup.tar.gz
Delete the unencrypted backup using the rm command.
rm my-music-file-backup.tar.gz
Need to decrypt? Run the following command to decrypt.
gpg my-music-file-backup.tar.gz.gpg
Once decrypted, you can restore the backup with the instructions in the “Restore the backup” section.
Method 2 – Kbackup backup
If you’re not a fan of Tar, another great way to create a backup of your music files on Linux is with the Kbackup tool. It’s a simple backup utility that can compress anything into a Tar archive.
To start the backup process, you’ll need to install Kbackup on your Linux PC. To install The Kbackup program, open up a terminal window and enter the command below.
Ubuntu
sudo apt install kbackup
Debian
sudo apt-get install kbackup
Arch Linux
sudo pacman -S kbackup
Fedora
sudo dnf install kbackup
OpenSUSE
sudo zypper install kbackup
Once the Kbackup app is installed, launch it by searching for it in the app menu. When the app is open and ready to use, look to the sidebar on the app’s left-hand side.
In the sidebar, you’ll see a tree of every folder on your Linux PC. From here, find “home” and click the arrow next to it. Then, select your username folder. After selecting your username folder, you will see every folder in your home directory.
Look through your username folder for the “Music” directory, where all your music files are. After locating the “Music” folder, click on the square next to it to select it for backup.
Once the “Music” box is selected, find the “folder” icon in the “Target” section to tell Kbackup where to save your backup. Then, locate the “Start Backup” button in Kbackup, and click on it with the mouse to start the backup process.
When the backup process is complete, Kbackup will tell you that the backup is complete. From this point, you can take the backup file and upload it to Dropbox, Google Drive, etc., for safekeeping.