6.5. Restore an ext2/3/4 File System


过程 6.2. Restore an ext2/3/4 File System Example

  1. If you are restoring an operating system partition, bootup your system into Rescue Mode. This step is not required for ordinary data partitions.
  2. Rebuild sda1/sda2/sda3/sda4/sda5 by using the fdisk command.

    注意

    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.
  3. Format the destination partitions by using the mkfs command, as shown below.

    重要

    DO NOT format /dev/sda6 in the above example because it saves backup files.
    # mkfs.ext3 /dev/sda1
    # mkfs.ext3 /dev/sda2
    # mkfs.ext3 /dev/sda3
    
  4. If creating new partitions, re-label all the partitions so they match the fstab file. 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
    
  5. 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
    
  6. 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"
    
  7. Reboot.
Red Hat logoGithubRedditYoutubeTwitter

学习

尝试、购买和销售

社区

关于红帽文档

通过我们的产品和服务,以及可以信赖的内容,帮助红帽用户创新并实现他们的目标。

让开源更具包容性

红帽致力于替换我们的代码、文档和 Web 属性中存在问题的语言。欲了解更多详情,请参阅红帽博客.

關於紅帽

我们提供强化的解决方案,使企业能够更轻松地跨平台和环境(从核心数据中心到网络边缘)工作。

© 2024 Red Hat, Inc.