# 救援模式与系统重装

> 恢复无法启动或拒绝密钥的服务器，或使用全新镜像重新开始。

Source: https://docs.avenlith.com/zh/rescue-and-reinstall  
Category: 服务器与计算  
Last updated: 2026-09-22

## 何时使用救援模式

- 内核或 GRUB 更新后服务器无法启动
- 丢失 SSH 密钥，或被防火墙规则锁在门外
- 需要在未挂载状态下对文件系统执行 `fsck`

## 进入救援模式

救援模式会通过网络启动一个小型 Linux 系统，您的磁盘保持不变，可以直接挂载：

```bash
avenlith server rescue enable web-01 --image rescue-2026
# after reboot, from the rescue system:
mount /dev/md0 /mnt
nano /mnt/root/.ssh/authorized_keys
avenlith server rescue disable web-01 && avenlith server reboot web-01
```

> **Note:** > 救援系统的临时 root 密码仅在控制台显示一次，并通过邮件发送给项目所有者。

## 重装操作系统

```bash
avenlith server reinstall web-01 --image debian-13 --ssh-key default
```

可用镜像包括 Ubuntu 22.04/24.04/26.04、Debian 12/13、AlmaLinux 9/10、Rocky Linux 9、Windows Server 2022/2025 以及 Proxmox VE 9。

> **Danger:** > 重装会永久删除服务器所有磁盘上的数据。云服务器的快照会保留；独立服务器没有自动快照。
