Home Linux Backup Tools How to Backup Ext2, Ext3, or Ext4 File Systems in Linux

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

The file systems used in Linux are its primary distinction from other operating system environments. At a glance, we have Ext2 (second extended), Ext3 (third extended), and Ext4 (fourth extended) file systems.

The implementation of the Ext2 file system overcame the limitations posed by Ext; the original Linux file system. Ext2 does not support any journaling feature, has 16GB to 2TB maximum individual file size, and 2TB to 32TB being its overall file system size.

Ext3 file system availability and support are from Linux Kernel 2.4.15 to earlier versions. It accommodates the journaling feature; absent on Ext2. It also has 16GB to 2TB maximum individual file size and 2TB to 32TB overall file system size.

Ext4 file system availability and support are from Linux Kernel 2.6.19 to earlier versions. It offers immeasurable support to overall file system size (1EB) and individual file size (16GB to 16TB). The 1EB (exabyte) is the equivalent of 1024 PB (petabyte) whereas 1PB is an equivalent of 1024 TB (terabyte).

The Ideal Linux Backup Tool

When considering the creation of backups for Ext2, Ext3, and Ext4 file systems in Linux, it is important to go with an effective and reliable tool.

The dump program is an ideal candidate for creating backups of these file systems because of the following prime features:

  • Supports remote backup.
  • If you do not want to back up the whole filesystem, you can back up a section of the file system like Home, Documents, or Downloads.
  • Removable media backups span multiple volumes.
  • Supports incremental, differential, and full backups.

Install Dump Command in Linux

You can install dump utility on your Linux distribution from either of the following commands:

$ sudo apt-get install dump     [On Debian, Ubuntu and Mint]
$ sudo yum install dump         [On RHEL/CentOS/Fedora and Rocky Linux/AlmaLinux]
$ sudo emerge -a sys-apps/dump  [On Gentoo Linux]
$ sudo pacman -S dump           [On Arch Linux]
$ sudo zypper install dump      [On OpenSUSE]    

Command Structure of the Dump Backup Tool

Your dump command structure needs to check the following three steps:

  • Dump Level: It is an integer value that determines whether you want to perform incremental, differential, or full backup. A zero integer value denotes full backup.
  • Destination File: It is the destination of the to-be-created backup. It can be a device file or a regular file. The dump will use /dev/tape when no backup file is specified.
  • Files to Dump: It is the Ext2, Ext3, or Ext4 file systems.

Backup Ext2, Ext3, or Ext4 Linux File Systems

To create a full backup of a Linux filesystem like /boot, to a dump file like /my_backups/boot.0, we would implement the dump command in the following manner:

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

On my end, I made sure the backup directory /my_backups exists.

Backup Linux Filesystem
Backup Linux Filesystem

Similary you can backup /root, /home, /etc file systems.

To back up Linux partitions such as /dev/sda1, /dev/sda2, and /dev/sda3 into backup files kept in the /backup directory, use the following commands:

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

Make sure to replace the backup file with a location to a file where you want to keep the backup. Replace the device with the name of the partition you want to back up.

Partial Backup of Ext2, Ext3, or Ext4 Linux File Systems

Here, you can backup several subdirectories or portions of a Linux filesystem like /etc/default and /etc/network.

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

Viewing Created Backups of Ext2, Ext3, or Ext4 Linux File Systems

To confirm the existence of your Ext2, Ext3, or Ext4 Linux filesystem backups, use the following command. The command outputs your backup content on the terminal.

$ sudo restore -tf /my_backups/configurations.dump 
View Contents of Linux Backup
View Contents of Linux Backup

Restoring the Linux File System Backups

For full backup files restoration, you should follow the order of dump level (from the first created dump to the last one). To restore a single file or directory.

$ sudo restore -xf /my_backups/configurations.dump 
Restore Linux Filesystem Backup
Restore Linux Filesystem Backup

The above command assumes your original filesystem is lost or corrupted. Since I still have my filesystem intact, I received the terminal output cannot create a symbolic link…File exists. Choose n under set owner/mode for ‘.’?. It ensures the current directory mode remains unchanged.

To back up a Linux file system to an external device, read our article: How to Backup Linux Filesystem Using dump Command.

More command-line options on understanding and using dump and restore commands are through the man dump and man restore terminal commands.

Ravi Saive
I am an Experienced GNU/Linux expert and a full-stack software developer with over a decade in the field of Linux and Open Source technologies. Founder of TecMint.com, LinuxShellTips.com, and Fossmint.com. Over 150+ million people visited my websites.

Each tutorial at UbuntuMint is created by a team of experienced writers so that it meets our high-quality standards.

Was this article helpful? Please add a comment to show your appreciation and support.

1 thought on “How to Backup Ext2, Ext3, or Ext4 File Systems in Linux”

  1. Do people still use ext2 and ext3? I have never seen it used in the 10+ years I have been using Linux. What would be the benefits of using those file systems?

    Reply

Got something to say? Join the discussion.

Thanks for choosing to leave a comment. Please keep in mind that all comments are moderated according to our comment policy, and your email address will NOT be published or shared. Please Do NOT use keywords in the name field. Let's have a personal and meaningful conversation.