AWS EC2:如何从无法访问的实例恢复数据

AWS EC2:如何从无法访问的实例恢复数据

今天我无法通过 ssh 访问我的实例,似乎所有服务都停止了。

我决定将当前卷附加到新实例以访问数据并恢复它们。但是我无法将旧卷安装到新实例。

以下是我所做的:

  • 创建新实例。
  • 将旧卷从其自己的实例中分离。
  • 将旧卷附加到新实例(它会自动从 sdf 重命名为 xvdf)。

安装:

mkdir /oldpartition
mount /dev/xvdf2 /oldpartition

上述代码不起作用,它会抛出mount: wrong fs type, bad option, bad superblock on /dev/xvdf2

其他信息:

fdisk -l
WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.

Disk /dev/xvda: 10.7 GB, 10737418240 bytes, 20971520 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: gpt


#         Start          End    Size  Type            Name
 1         2048         4095      1M  BIOS boot parti
 2         4096     20971486     10G  Microsoft basic
WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.

Disk /dev/xvdf: 16.1 GB, 16106127360 bytes, 31457280 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: gpt


#         Start          End    Size  Type            Name
 1         2048         4095      1M  BIOS boot parti
 2         4096     31457246     15G  Microsoft basic

抱歉,这是一个愚蠢的问题,但我是 Linux 新手。

任何帮助都将不胜感激,谢谢!

答案1

您需要执行以下步骤才能从停止的 EC2 Linux 实例中恢复数据。

1. Stop the EC2 Linux Instance
2. Detach the Root Volume
3. Launch a new Temporary Instance. We need to create a new EC2 instance with exact same settings and in the same availability zone.
4. Select same Security Group that is attached to the original instance
5. Attach the Root Volume to New Instance
6. Mount the original root volume to /mnt directory of a new temporary instance.

在开始这个练习之前,我们需要记下以下关键信息:

Instance ID, AMI ID, and Availability Zone of original Instance
Name of Root Device volume such as /dev/sda1
Volume ID of Root Volume

相关内容