Show Table of Contents
6.5. Restore an ext2/3/4 File System
Procedure 6.2. Restore an ext2/3/4 File System Example
- If you are restoring an operating system partition, bootup your system into Rescue Mode. This step is not required for ordinary data partitions.
- Rebuild sda1/sda2/sda3/sda4/sda5 by using the
fdiskcommand.Note
If necessary, create the partitions to contain the restored file systems. The new partitions must be large enough to contain the restored data. It is important to get the start and end numbers right; these are the starting and ending sector numbers of the partitions. - Format the destination partitions by using the
mkfscommand, as shown below.Important
DO NOT format/dev/sda6in the above example because it saves backup files.# mkfs.ext3 /dev/sda1 # mkfs.ext3 /dev/sda2 # mkfs.ext3 /dev/sda3
- If creating new partitions, re-label all the partitions so they match the
fstabfile. This step is not required if the partitions are not being recreated.# e2label /dev/sda1 /boot1 # e2label /dev/sda2 / # e2label /dev/sda3 /data # mkswap -L SWAP-sda5 /dev/sda5
- Prepare the working directories.
# mkdir /mnt/sda1 # mount -t ext3 /dev/sda1 /mnt/sda1 # mkdir /mnt/sda2 # mount -t ext3 /dev/sda2 /mnt/sda2 # mkdir /mnt/sda3 # mount -t ext3 /dev/sda3 /mnt/sda3 # mkdir /backup-files # mount -t ext3 /dev/sda6 /backup-files
- Restore the data.
# cd /mnt/sda1 # restore -rf /backup-files/sda1.dump # cd /mnt/sda2 # restore -rf /backup-files/sda2.dump # cd /mnt/sda3 # restore -rf /backup-files/sda3.dump
If you want to restore from a remote host or restore from a backup file on a remote host you can use either ssh or rsh. You will need to configure a password-less login for the following examples:Login into 10.0.0.87, and restore sda1 from local sda1.dump file:# ssh 10.0.0.87 "cd /mnt/sda1 && cat /backup-files/sda1.dump | restore -rf -"
Login into 10.0.0.87, and restore sda1 from a remote 10.66.0.124 sda1.dump file:# ssh 10.0.0.87 "cd /mnt/sda1 && RSH=/usr/bin/ssh restore -r -f 10.66.0.124:/tmp/sda1.dump"
- Reboot.

Where did the comment section go?
Red Hat's documentation publication system recently went through an upgrade to enable speedier, more mobile-friendly content. We decided to re-evaluate our commenting platform to ensure that it meets your expectations and serves as an optimal feedback mechanism. During this redesign, we invite your input on providing feedback on Red Hat documentation via the discussion platform.