HomeLinuxHow To Backup Ext2, Ext3, or Ext4 File Systems in Linux

How To Backup Ext2, Ext3, or Ext4 File Systems in Linux

In Linux, the file system is used in Ext4 format for storing the OS. Since, like Windows, Linux doesn’t use the NTFS or other conventional file types, it might be difficult for newbies to backup the Linux file systems. Now, the question might be, why do you need to back up the file system on Linux? Well, it can be answered for many different circumstances; you might need to backup your entire file system and restore it into another virtual or physical system, or you might need to preserve the entire system for some security reason. No matter what the situation is, there is always a way to backup the entire or partial Linux file system.

How To Backup Linux File system


As the OS is mounted on the file system on Linux, so you can not copy the system which is currently in use. To avoid this type of complex situation, you can use 3rd party tools that can copy the system even if it is in use.

The Dump tool has been used by many users to backup your system in Linux. The design architecture of the Dump tool allows the users to backup the running Linux files system in another drive. In this post, we will see how to backup Ext2, Ext3, or Ext4 file systems in Linux.

Step 1: Install Dump Command in Linux


Installing the Dump tool to backup Linux files is easy and hassle-free. Actually often many professional Linux users use this tool for reserving their entire system data. The Dump tool is available on the Linux repository, and you can install it through the conventional package installer commands. Please execute the following commands according to your distribution to install the Dump tool on your system.

  • Install Dump on Debian/Ubuntu Linux

install dumo on Linux

sudo apt-get install dump
  • Get the Dump tool Red Hat and Fedora Linux
sudo yum install dump  
  • Install Dump on Arch system
sudo pacman -S dump 
  • Get Dump on SuSE Linux 
sudo zypper install dump  

Step 2: Get to Know the Dump Tool on Linux


Before you start using the Dump tool on Linux, please make sure that you understand the syntaxes that we will run to backup the Linux file system. The following arguments might help you write your own dump command on the shell.

$ sudo dump options arguments filesystem

Backup Linux File system

The Dump tool can backup, record, restore, and partial backup files on Linux. The following two Dump commands will let you know if the current Linux file system was ever backed up or not. 

$ dump -W
$ dump -Ww

To know more about the dump tool, you can see the manuals for creating the backup and restoring the backup files on Linux.

$ man dump
$ man restore

Step 3: Backup System Files on Linux


Through the Dump tool, you can measure how many files you want to backup on the Linux system and set the destination. It allows the users to backup Ext2, Ext3, or Ext4 files on the Linux file system. For instance, if we want to back up the /boot file system on Linux, you can execute the following Dump command on the terminal shell.

Here, the destination of the backup file is assigned as the /my_backups/boot.0. You can set your own destination directory for backing up the files. 

In the same way, you can also backup the root, home, and etc. directories on your Linux file system. 

$ sudo dump -0f /my_backups/boot.0 /boot

my_backups boot

The above screenshot shows how the tool can store blocks through the command-line interface. This is because the original design of the Dump tool worked in a manner where the tool could backup files block-wise from the hard drive.

Despite backing up the file, you can also back up the other directories like sda1, sda2, sda3, and other folders through the Dump tool. Please do not forget to set a valid destination folder to backup files on Linux through Dump.

$ sudo dump -0uf /backup/sda1.dump /dev/sda1
$ sudo dump -0uf /backup/sda2.dump /dev/sda2
$ sudo dump -0uf /backup/sda3.dump /dev/sda3

Step 4: Partial Backup of File Systems


The Dump tool has been very useful for backing up files on Linux. It also allows the users to backup files partially so that they can just backup those files that they actually want. However, to do a partial backup on the Linux file system, run the following command shown below. 

Please note that here partial backup means that you can take the backup of a sub-directory of an entire file system, not backing up a little, then quit.

partial backup Linux File system

$ sudo dump -0f /my_backups/configurations.dump /etc/default /etc/network 

Step 5: Show Backups in Linux File Systems


Since now we have seen how to take full backup and partial backup on Linux, it’s high time we see how to see the files we had backed up. The following command will let us know the context of the Ext2 to Ext4 backup files. 

$ sudo restore -tf /my_backups/configurations.dump 

Step 6: Restoring the Linux File System Backups


Restoring the data that we took for backup refers to the process of putting the files in the same directory as they were so that the Linux system can function properly. To restore the files on a Linux file system, we will need to know if we want to restore the entire directory or a partial restore. However, you may execute the following command given below to restore files.

$ sudo restore -xf /my_backups/configurations.dump 

If you face issues restoring the files, please check if you’re a root user or not. You may use the chown commands or the chmod commands to get access for restoring. If you’re trying to restore a file that is already in the system, you might face errors to create symbolic links. 

Final Words


Once you understand all the above-explained commands, you’re ready to back up your files. With the Dump tool, backing up the Linux file system is easy and less complex than it supposed it would be. If you still need to do an extensive backup of your files, you can try booting the GParted system to take the full backup.

In the entire post, we have seen how to install the Dump tool on various distributions and backup and restore the Linux file systems. 

Please share it with your friends and the Linux community if you find this post useful and informative. You can also write down your opinions regarding this post in the comment section.

LEAVE A REPLY

Please enter your comment!
Please enter your name here

spot_img

Latest Post

Must Read