Linux dump restore ext4

Which tool to backup an ext4 partition?

I’m searching for a tool to backup a whole ext4 partition to an image. I tried the latest version of mondo, which is not working. What are good alternatives?

8 Answers 8

It can be found on the latest SystemRescueCD

Reportedly made by the same guy who authored partimage.

It sports a lot of improvements including: — ext4 support — ntfs support — file-level instead of block-level — compression using multiple cores

Basically, after a partition is saved/compressed it can be restored to different size partitions, and partitions of different formats (so you can use it to convert a partition’s format too), and if part of the backup gets corrupted it doesn’t destroy the whole image (like it would on a block-level backup.

The only downside (if you consider it a downside) is, it’s only a command line app at the moment (but it should get a gui eventually).

The command line entries are really simple.

fsarchiver savefs /mnt/backup/gentoo-rootfs.fsa /dev/sda1 

Where ‘/mnt/backup/gentoo-rootfs.fsa’ is the path being saved to and ‘/dev/sda1’ is the partition being cloned.

fsarchiver restfs /mnt/backup/gentoo-rootfs.fsa >Just reverse the options above. From what I understand (in the documentation), it looks like the is necessary because an image can contain multiple partitions. For more directions on usage (such as saving multiple partitions) checkout the QuickStart guide.

As it turns out, I’m actually writing this (as entertainment) from a Linux Mint LiveCD while I’m cloning a newly updated windows factory install clone. I scoured the net earlier looking for a better partition cloning alternative because I want to finally trash this Ghose ’03 disc that I’ve been using for years. I’ll drop a note to let you know how it went after I finish the restore.

Just finished the backup with no errors. It took a little while because I didn’t know about the options to make it multi-threaded when I started. The compression was set to the default value (equivalent to gzip -6), the partition was 4.48GB on disk (highly trimmed/updated XP + Chrome) and the output file weighs in at 2.3GB. No complaints here.

Источник

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.

Читайте также:  Total network inventory linux

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

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

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

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

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.

Читайте также:  Linux закрыть активное окно

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.

Источник

How to Backup Linux Filesystem Using dump Command

On a Linux operating system environment, mastering how to create and restore backups is a very important skill set. It is easier for well-versed Linux user to attain their data backup goals from the terminal environment without the need for a GUI-oriented application package.

The Linux dump utility is effective in creating filesystem backups on an availed storage device. However, the filesystem supported by this backup utility disregards the likes of ReiserFS and FAT.

The dump command only supports ext4, ext3, and ext2 filesystem and incremental backups. Under incremental backup support, a Linux user can flexibly execute their backup operations on daily, weekly, or monthly time frames.

It makes it easy to decide when and how you want your backups done. You get to decide which files should be involved in the scheduled backup process. Therefore, a Linux user can only focus on backing up files with significant changes or the ones that were recently added to the targeted filesystem.

How to Install Dump Utility in Linux

If you do not have the dump utility installed on your Linux machine, you can install it by executing one of the following installation commands in regards to the Linux operating system distribution you are using.

$ 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]

Linux Dump Command Usage

Once you run the dump backup utility, it first examines your existing Linux filesystem files and points out the ones that are worthy of any backup effort. The dump command needs several parameters for it to execute successfully:

  • The targeted dump level.
  • The media to host the created filesystem backup.
  • The filesystem to backup.

The dump command also accommodates optional parameters pointing to:

  • Specific backup media size.
  • Next tape request method.
  • Times and status of filesystem dump recording.

A typical dump command string adheres to the following syntax:

$ sudo dump options arguments filesystem

The dump command options:

  • 0-9 – This range signifies available dump levels. 0 caters for full filesystem backup while a higher number like 9 only prioritizes the backup of modified filesystem files.
  • -B records – Highlights how many dump records should exist in a single volume.
  • -b kbperdump – Highlights the number of kilobytes within a single dumb record.
  • -h level – With this option, a nodump attribute is associated with your backup files.
  • -f file – Points to a file or device name that will accommodate the created dump.
  • -d destiny – Defines the needed tape density.
  • -n – Use to alert operator group users when something like a tape change is required by the dump operation.
  • -s feet: Specifies the dump tape length in feet.
  • -u – Creates a record of all successful backups under the file /etc/dumpdates.
  • -t date – Specifies the date and time values associated with incremental backups.
  • -W – This option references the /etc/fstab and /etc/dumpdates files and highlights filesystem files that need backup.
  • -w – Goes hand in hand with the W option and highlights specific/individual files that need backup.
Читайте также:  Установка сертификатов vipnet csp linux

How to Backup Linux System using Dump Command

To determine the files that need backup on your Linux system, you will run a command similar to the following:

List Linux Filesystem to Backup

To back up the above filesystem (/dev/sda5) to an external device like /dev/sdb5 (identified by running the command sudo fdisk -l ), I would implement a dump command similar to the following:

$ sudo dump 0uaf /dev/sdb5 /dev/sda5

Backup Linux Filesystem Using Dump Command

The dump command has the dump option 0 since it’s a first-time backup attempt.

If you need your backup compressed, you would run the above command in the following manner:

$ sudo dump 0ufz /dev/sdb5 /dev/sda5

The created backup will be compressed with the z library. The dump backup command updates the system user as it continues to execute:

Compressed Linux Filesystem Backup Using Dump Command

Backup Linux Home Directory

To back up the files from a specific filesystem directory like your Home directory:

$ sudo dump 0ufz /dev/sdb5 /home

To back up files to a remote machine named linuxshelltips or identified by an IP address and with the tape device named /dev/sdb5, we will use the rdump command.

$ sudo rdump 0uf linuxshelltips:/dev/sdb5 /home

Backing Up Data to a Regular File

Supposing we want to back up the home directory to an existing regular file called 10g.img, we would implement the needed command in the following manner:

$ sudo dump 0f /media/dnyce/4E6A2E2E6A2E136F/10g.img /home

Backup Linux Data to File

To create such a writable image file to hold your backup data, run the following command. Also, specify the size of this writable image file.

$ dd if=/dev/zero of=10g.img bs=1 count=0 seek=10G

Afterward, check the created backup file:

Check Backup File

The created .img file backup can now be written to a disk device of your choice with this command:

$ sudo dd if=10g.img of=/dev/sdb5 bs=1M

How to Restore Linux System using Dump Command

To fully restore the above-created backup, we would run a command similar to the following:

The restored files will be written on the current directory path of the active Linux system user.

To restore filesystem backups from a remote machine we will use the rrestore command:

$ sudo rrestore tf linuxshelltips:/dev/sdb5

With the dump command, you can easily achieve full and incremental backups of your Linux filesystem files. The restore command reverses or does the opposite of the dump command to successfully re-instate your filesystem backups.

To learn more about these two commands and their usage, run:

Источник

Оцените статью
Adblock
detector