5.4. Backing up ext2, ext3, or ext4 File Systems
- If the system has been running for a long time, run the
e2fsckutility on the partitions before backup:
Procedure 5.2. Backing up ext2, ext3, or ext4 File Systems
- Back up configuration information, including the content of the
/etc/fstabfile and the output of the
fdisk -lcommand. This is useful for restoring the partitions.To capture this information, run the
sysreportutilities. For more information about
sosreport, see the What is a sosreport and how to create one in Red Hat Enterprise Linux 4.6 and later? Kdowledgebase article.
- Depending on the role of the partition:
- If the partition you are backing up is an operating system partition, boot your system into the rescue mode. See the Booting to Rescue Mode section of the System Administrator's Guide.
- When backing up a regular, data partition, unmount it.Although it is possible to back up a data partition while it is mounted, the results of backing up a mounted data partition can be unpredictable.If you need to back up a mounted file system using the
dumputility, do so when the file system is not under a heavy load. The more activity is happening on the file system when backing up, the higher the risk of backup corruption is.
- Use the
dumputility to back up the content of the partitions:
dump -0uf backup-file /dev/deviceReplace backup-file with a path to a file where you want the to store the backup. Replace device with the name of the ext4 partition you want to back up. Make sure that you are saving the backup to a directory mounted on a different partition than the partition you are backing up.
Example 5.2. Backing up Multiple ext4 PartitionsTo back up the content of the
/dev/sda3partitions into backup files stored in the
/backup-files/directory, use the following commands:
dump -0uf /backup-files/sda1.dump /dev/sda1
dump -0uf /backup-files/sda2.dump /dev/sda2
dump -0uf /backup-files/sda3.dump /dev/sda3To do a remote backup, use the
sshutility or configure a password-less
sshlogin. For more information on
sshand password-less login, see the Using the ssh Utility and Using Key-based Authentication sections of the System Administrator's Guide.For example, when using
Example 5.3. Performing a Remote Backup Using
dump -0u -f - /dev/device | ssh email@example.com dd of=backup-fileNote that if using standard redirection, you must pass the
- For more information, see the dump(8) man page.