Este conteúdo não está disponível no idioma selecionado.
5.4. Backing up ext2, ext3, or ext4 File Systems
This procedure describes how to back up the content of an ext4, ext3, or ext2 file system into a file.
Prerequisites
- If the system has been running for a long time, run the
e2fsck
utility on the partitions before backup:#
e2fsck /dev/device
Procedure 5.1. Backing up ext2, ext3, or ext4 File Systems
- Back up configuration information, including the content of the
/etc/fstab
file and the output of thefdisk -l
command. This is useful for restoring the partitions.To capture this information, run thesosreport
orsysreport
utilities. For more information aboutsosreport
, 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
dump
utility, 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
dump
utility to back up the content of the partitions:#
dump -0uf backup-file /dev/device
Replace 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 Partitions
To back up the content of the/dev/sda1
,/dev/sda2
, and/dev/sda3
partitions 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/sda3
To do a remote backup, use thessh
utility or configure a password-lessssh
login. For more information onssh
and password-less login, see the Using the ssh Utility and Using Key-based Authentication sections of the System Administrator's Guide.For example, when usingssh
:Example 5.3. Performing a Remote Backup Using
ssh
#
dump -0u -f - /dev/device | ssh root@remoteserver.example.com dd of=backup-file
Note that if using standard redirection, you must pass the-f
option separately.
Additional Resources
- For more information, see the dump(8) man page.