点击此处以注册 Hetzner (Referral Link) 账号

进入 rescue 系统

Hetzner Dedicated Server Rescue 系统

救援模式下执行 Installimage 并配置

执行命令 installimage,进入到的是 Midnight Commander 编辑器。此时鼠标或上下键选择所需安装的镜像,此处选择 Ubuntu,然后进行下一步

选择合适的OS

默认选择最新的代系,此处选择 Ubuntu 24.04 LTS (Base)

选择Ubuntu 24.04 LTS Base

然后进入配置文件审阅检查并根据情况修改部分配置内容,注意读注释内容

编辑InstallImage配置文件

  1. 硬盘驱动器配置 (HARD DISK DRIVE)
DRIVE1 /dev/sda - ST4000NM0024-1HT178 (4TB)
DRIVE2 /dev/sdb - ST4000NM0024-1HT178 (4TB)

这里是指的 2 块 4TB HDD 硬盘

  1. 软 RAID 配置 (SOFTWARE RAID)
SWRAID 1
SWRAIDLEVEL 1
  • 启用了软 RAID(值为1表示启用)
  • RAID 级别设置为1(镜像模式),这意味着两个硬盘将互为镜像,提供数据冗余保护
  1. 主机名配置 (HOSTNAME)
HOSTNAME Ubuntu-2404-noble-amd64-base

设置系统主机名为"Ubuntu-2404-noble-amd64-base",这表明是一个基于 Ubuntu 24.04 (Noble) AMD64 架构的系统。

  1. 网络配置 (NETWORK CONFIG)
IPV4_ONLY no

系统不限制只使用 IPv4,也支持 IPv6。

  1. 其他配置 (MISC CONFIG)
USE_KERNEL_MODE_SETTING no

禁用了内核模式设置(KMS),这可能与显示驱动有关。

  1. 分区和文件系统配置 (PARTITIONS / FILESYSTEMS)
PART swap swap 32G
PART /boot ext3 1024M
PART / ext4 2014G
PART /home ext4 all

分区方案如下:

  • swap(交换分区):32 GB
  • /boot(引导分区):1024 MB,使用 ext3 文件系统
  • /(根分区):2014 GB,使用 ext4 文件系统
  • /home(用户目录):使用剩余所有空间,使用 ext4 文件系统
  1. 操作系统镜像 (OPERATING SYSTEM IMAGE)
IMAGE /root/.oldroot/nfs/install/../images/Ubuntu-2404-noble-amd64-base.tar.gz

指定了系统安装镜像的位置,使用的是 Ubuntu 24.04 的基础镜像。

## ======================================================


## ====================
##  HARD DISK DRIVE(S):
## ====================


# Device Model: ST4000NM0024-1HT178, Serial Number: Z4F129ST
DRIVE1 /dev/sda
# Device Model: ST4000NM0024-1HT178, Serial Number: Z4F12K21
DRIVE2 /dev/sdb



## ===============
##  SOFTWARE RAID:
## ===============

## activate software RAID?  < 0 | 1 >

SWRAID 1

## Choose the level for the software RAID < 0 | 1 | 10 >

SWRAIDLEVEL 1

## ==========
##  HOSTNAME:
## ==========

## which hostname should be set?
##

HOSTNAME Ubuntu-2404-noble-amd64-base


## ================
##  NETWORK CONFIG:
## ================

# IPV4_ONLY no


## =============
##  MISC CONFIG:
## =============

USE_KERNEL_MODE_SETTING no

## ==========================
##  PARTITIONS / FILESYSTEMS:
## ==========================

## define your partitions and filesystems like this:
##
## PART  <mountpoint/lvm/btrfs.X>  <filesystem/VG>  <size in MB>
##
## * <mountpoint/lvm/btrfs.X>
##            mountpoint for this filesystem *OR*
##            keyword 'lvm' to use this PART as volume group (VG) for LVM *OR*
##            identifier 'btrfs.X' to use this PART as volume for
##            btrfs subvolumes. X can be replaced with a unique
##            alphanumeric keyword
##            NOTE: no support btrfs multi-device volumes
##            NOTE: reiserfs support is deprecated and will be removed in a future version
## * <filesystem/VG>
##            can be ext2, ext3, ext4, btrfs, reiserfs, xfs, swap  *OR*  name
##            of the LVM volume group (VG), if this PART is a VG.
## * <size>
##            you can use the keyword 'all' to assign all the
##            remaining space of the drive to the *last* partition.
##            you can use M/G/T for unit specification in MiB/GiB/TiB
##
## notes:
##   - extended partitions are created automatically
##   - '/boot' cannot be on a xfs filesystem
##   - '/boot' cannot be on LVM!
##   - when using software RAID 0, you need a '/boot' partition
##
## example without LVM (default):
## -> 4GB   swapspace
## -> 1024MB /boot
## -> 10GB  /
## -> 5GB   /tmp
## -> all the rest to /home
#PART swap   swap        4G
#PART /boot  ext2      1024M
#PART /      ext4       10G
#PART /tmp   xfs         5G
#PART /home  ext3       all
#
##
## to activate LVM, you have to define volume groups and logical volumes
##
## example with LVM:
#
## normal filesystems and volume group definitions:
## -> 1024MB boot  (not on lvm)
## -> all the rest for LVM VG 'vg0'
#PART /boot  ext3     1024M
#PART lvm    vg0       all
#
## logical volume definitions:
#LV <VG> <name> <mount> <filesystem> <size>
#
#LV vg0   root   /        ext4         10G
#LV vg0   swap   swap     swap          4G
#LV vg0   home   /home    xfs          20G
#
##
## to use btrfs subvolumes, define a volume identifier on a partition
##
## example with btrfs subvolumes:
##
## -> all space on one partition with volume 'btrfs.1'
#PART btrfs.1    btrfs       all
##
## btrfs subvolume definitions:
#SUBVOL <volume> <subvolume> <mount>
#
#SUBVOL btrfs.1  @           /
#SUBVOL btrfs.1  @/usr       /usr
#SUBVOL btrfs.1  @home       /home
#
## your system has the following devices:
#
# Disk /dev/sda: 4.01 TB (=> 3.64 TiB)
# Disk /dev/sdb: 4.01 TB (=> 3.64 TiB)
# 
## Based on your disks and which RAID level you will choose you have
## the following free space to allocate (in GiB):
# RAID  0: ~7452
# RAID  1: ~3726
# 

PART swap swap 32G
PART /boot ext3 1024M
PART / ext4 2014G
PART /home ext4 all


## ========================
##  OPERATING SYSTEM IMAGE:
## ========================

## full path to the operating system image
##   supported image sources:  local dir,  ftp,  http,  nfs
##   supported image types: tar, tar.gz, tar.bz, tar.bz2, tar.xz, tgz, tbz, txz
## examples:
#
# local: /path/to/image/filename.tar.gz
# ftp:   ftp://<user>:<password>@hostname/path/to/image/filename.tar.bz2
# http:  http://<user>:<password>@hostname/path/to/image/filename.tbz
# https: https://<user>:<password>@hostname/path/to/image/filename.tbz
# nfs:   hostname:/path/to/image/filename.tgz
#
# for validation of the image, place the detached gpg-signature
# and your public key in the same directory as your image file.
# naming examples:
#  signature:   filename.tar.bz2.sig
#  public key:  public-key.asc

IMAGE /root/.oldroot/nfs/install/../images/Ubuntu-2404-noble-amd64-base.tar.gz

完成 Installimage 安装并重启

完成对配置文件的修改后,F10 保存退出并进行下一步操作,擦除硬盘上的所有数据

擦除第1块硬盘硬盘数据

擦除第2块硬盘数据

在一小会儿等待输出结束后,若无误则可以 reboot 重启

Hetzner installimage输出

Hetzner Online GmbH - installimage

  Your server will be installed now, this will take some minutes
             You can abort at any time with CTRL+C ...

         :  Reading configuration                           done 
         :  Loading image file variables                    done 
         :  Loading ubuntu specific functions               done 
   1/16  :  Deleting partitions                             done 
   2/16  :  Test partition size                             done 
   3/16  :  Creating partitions and /etc/fstab              done 
   4/16  :  Creating software RAID level 1                  done 
   5/16  :  Formatting partitions
         :    formatting /dev/md/0 with swap                done 
         :    formatting /dev/md/1 with ext3                done 
         :    formatting /dev/md/2 with ext4                done 
         :    formatting /dev/md/3 with ext4                done 
   6/16  :  Mounting partitions                             done 
   7/16  :  Sync time via ntp                               done 
         :  Importing public key for image validation       done 
   8/16  :  Validating image before starting extraction     done 
   9/16  :  Extracting image (local)                        done 
  10/16  :  Setting up network config                       done 
  11/16  :  Executing additional commands
         :    Setting hostname                              done 
         :    Generating new SSH keys                       done 
         :    Generating mdadm config                       done 
         :    Generating ramdisk                            done 
         :    Generating ntp config                         done 
  12/16  :  Setting up miscellaneous files                  done 
  13/16  :  Configuring authentication
         :    Setting root password                         done 
                                                            done 
         :    Enabling SSH root login with password         done 
  14/16  :  Installing bootloader grub                      done 
  15/16  :  Running some ubuntu specific functions          done 
  16/16  :  Clearing log files                              done 

                  INSTALLATION COMPLETE
   You can now reboot and log in to your new system with the
 same credentials that you used to log into the rescue system.

root@rescue ~ #

重启后使用刚刚使用到的救援系统密码或密钥进行登录主机

重启后进入主机

Welcome to Ubuntu 24.04.1 LTS (GNU/Linux 6.8.0-52-generic x86_64)

 * Documentation:  https://help.ubuntu.com
 * Management:     https://landscape.canonical.com
 * Support:        https://ubuntu.com/pro

 System information as of Tue Apr  8 04:45:58 PM CEST 2025

  System load:                2.26
  Usage of /home:             0.0% of 1.61TB
  Memory usage:               0%
  Swap usage:                 0%
  Temperature:                40.0 C
  Processes:                  184
  Users logged in:            0
  IPv4 address for enp0s31f6: 138.201.196.165
  IPv6 address for enp0s31f6: 2a01:4f8:172:3e6c::2


Expanded Security Maintenance for Applications is not enabled.

0 updates can be applied immediately.

Enable ESM Apps to receive additional future security updates.
See https://ubuntu.com/esm or run: sudo pro status


The list of available updates is more than a week old.
To check for new updates run: sudo apt update

root@Ubuntu-2404-noble-amd64-base ~ #

查看硬盘 smart 情况

root@Ubuntu-2404-noble-amd64-base ~ # smartctl -a /dev/sda
smartctl 7.4 2023-08-01 r5530 [x86_64-linux-6.8.0-52-generic] (local build)
Copyright (C) 2002-23, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Model Family:     Seagate Enterprise Capacity 3.5 HDD
Device Model:     ST4000NM0024-1HT178
Serial Number:    Z4F12K21
LU WWN Device Id: 5 000c50 091cb7b6b
Firmware Version: SN06
User Capacity:    4,000,787,030,016 bytes [4.00 TB]
Sector Sizes:     512 bytes logical, 4096 bytes physical
Rotation Rate:    7200 rpm
Form Factor:      3.5 inches
Device is:        In smartctl database 7.3/5528
ATA Version is:   ACS-3 (minor revision not indicated)
SATA Version is:  SATA 3.1, 6.0 Gb/s (current: 6.0 Gb/s)
Local Time is:    Tue Apr  8 17:07:34 2025 CEST
SMART support is: Available - device has SMART capability.
SMART support is: Enabled

=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED

General SMART Values:
Offline data collection status:  (0x82) Offline data collection activity
                                        was completed without error.
                                        Auto Offline Data Collection: Enabled.
Self-test execution status:      (   0) The previous self-test routine completed
                                        without error or no self-test has ever 
                                        been run.
Total time to complete Offline 
data collection:                (  575) seconds.
Offline data collection
capabilities:                    (0x7b) SMART execute Offline immediate.
                                        Auto Offline data collection on/off support.
                                        Suspend Offline collection upon new
                                        command.
                                        Offline surface scan supported.
                                        Self-test supported.
                                        Conveyance Self-test supported.
                                        Selective Self-test supported.
SMART capabilities:            (0x0003) Saves SMART data before entering
                                        power-saving mode.
                                        Supports SMART auto save timer.
Error logging capability:        (0x01) Error logging supported.
                                        General Purpose Logging supported.
Short self-test routine 
recommended polling time:        (   1) minutes.
Extended self-test routine
recommended polling time:        ( 415) minutes.
Conveyance self-test routine
recommended polling time:        (   2) minutes.
SCT capabilities:              (0x50bd) SCT Status supported.
                                        SCT Error Recovery Control supported.
                                        SCT Feature Control supported.
                                        SCT Data Table supported.

SMART Attributes Data Structure revision number: 10
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE
  1 Raw_Read_Error_Rate     0x000f   079   064   044    Pre-fail  Always       -       79461098
  3 Spin_Up_Time            0x0003   096   096   000    Pre-fail  Always       -       0
  4 Start_Stop_Count        0x0032   100   100   020    Old_age   Always       -       48
  5 Reallocated_Sector_Ct   0x0033   100   100   010    Pre-fail  Always       -       0
  7 Seek_Error_Rate         0x000f   096   060   045    Pre-fail  Always       -       4081605708
  9 Power_On_Hours          0x0032   017   017   000    Old_age   Always       -       73113
 10 Spin_Retry_Count        0x0013   100   100   097    Pre-fail  Always       -       0
 12 Power_Cycle_Count       0x0032   100   100   020    Old_age   Always       -       47
184 End-to-End_Error        0x0032   100   100   099    Old_age   Always       -       0
187 Reported_Uncorrect      0x0032   100   100   000    Old_age   Always       -       0
188 Command_Timeout         0x0032   100   099   000    Old_age   Always       -       0 0 2
189 High_Fly_Writes         0x003a   100   100   000    Old_age   Always       -       0
190 Airflow_Temperature_Cel 0x0022   056   049   040    Old_age   Always       -       44 (Min/Max 32/44)
191 G-Sense_Error_Rate      0x0032   100   100   000    Old_age   Always       -       0
192 Power-Off_Retract_Count 0x0032   095   095   000    Old_age   Always       -       11743
193 Load_Cycle_Count        0x0032   095   095   000    Old_age   Always       -       11807
194 Temperature_Celsius     0x0022   044   051   000    Old_age   Always       -       44 (0 24 0 0 0)
195 Hardware_ECC_Recovered  0x001a   079   001   000    Old_age   Always       -       79461098
197 Current_Pending_Sector  0x0012   100   100   000    Old_age   Always       -       0
198 Offline_Uncorrectable   0x0010   100   100   000    Old_age   Offline      -       0
199 UDMA_CRC_Error_Count    0x003e   200   200   000    Old_age   Always       -       0

SMART Error Log Version: 1
No Errors Logged

SMART Self-test log structure revision number 1
Num  Test_Description    Status                  Remaining  LifeTime(hours)  LBA_of_first_error
# 1  Extended offline    Completed without error       00%      7566         -
# 2  Extended offline    Completed without error       00%      7199         -
# 3  Extended offline    Completed without error       00%     39487         -
# 4  Extended offline    Completed without error       00%     39468         -
# 5  Extended offline    Completed without error       00%     32494         -
# 6  Extended offline    Completed without error       00%     32475         -
# 7  Short offline       Completed without error       00%     32413         -
# 8  Short offline       Completed without error       00%     32389         -
# 9  Short offline       Completed without error       00%     32365         -
#10  Short offline       Completed without error       00%     32341         -
#11  Extended offline    Completed without error       00%     32327         -
#12  Short offline       Completed without error       00%     32317         -
#13  Short offline       Completed without error       00%     32293         -
#14  Short offline       Completed without error       00%     32269         -
#15  Short offline       Completed without error       00%     32245         -
#16  Short offline       Completed without error       00%     32221         -
#17  Short offline       Completed without error       00%     32197         -
#18  Short offline       Completed without error       00%     32173         -
#19  Extended offline    Completed without error       00%     32163         -
#20  Short offline       Completed without error       00%     32149         -
#21  Short offline       Completed without error       00%     32125         -

SMART Selective self-test log data structure revision number 1
 SPAN  MIN_LBA  MAX_LBA  CURRENT_TEST_STATUS
    1        0        0  Not_testing
    2        0        0  Not_testing
    3        0        0  Not_testing
    4        0        0  Not_testing
    5        0        0  Not_testing
Selective self-test flags (0x0):
  After scanning selected spans, do NOT read-scan remainder of disk.
If Selective self-test is pending on power-up, resume after 0 minute delay.

The above only provides legacy SMART information - try 'smartctl -x' for more
root@Ubuntu-2404-noble-amd64-base ~ # smartctl -a /dev/sdb
smartctl 7.4 2023-08-01 r5530 [x86_64-linux-6.8.0-52-generic] (local build)
Copyright (C) 2002-23, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Model Family:     Seagate Enterprise Capacity 3.5 HDD
Device Model:     ST4000NM0024-1HT178
Serial Number:    Z4F129ST
LU WWN Device Id: 5 000c50 091da3cc6
Firmware Version: SN06
User Capacity:    4,000,787,030,016 bytes [4.00 TB]
Sector Sizes:     512 bytes logical, 4096 bytes physical
Rotation Rate:    7200 rpm
Form Factor:      3.5 inches
Device is:        In smartctl database 7.3/5528
ATA Version is:   ACS-3 (minor revision not indicated)
SATA Version is:  SATA 3.1, 6.0 Gb/s (current: 6.0 Gb/s)
Local Time is:    Tue Apr  8 17:08:55 2025 CEST
SMART support is: Available - device has SMART capability.
SMART support is: Enabled

=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED

General SMART Values:
Offline data collection status:  (0x82) Offline data collection activity
                                        was completed without error.
                                        Auto Offline Data Collection: Enabled.
Self-test execution status:      (   0) The previous self-test routine completed
                                        without error or no self-test has ever 
                                        been run.
Total time to complete Offline 
data collection:                (  575) seconds.
Offline data collection
capabilities:                    (0x7b) SMART execute Offline immediate.
                                        Auto Offline data collection on/off support.
                                        Suspend Offline collection upon new
                                        command.
                                        Offline surface scan supported.
                                        Self-test supported.
                                        Conveyance Self-test supported.
                                        Selective Self-test supported.
SMART capabilities:            (0x0003) Saves SMART data before entering
                                        power-saving mode.
                                        Supports SMART auto save timer.
Error logging capability:        (0x01) Error logging supported.
                                        General Purpose Logging supported.
Short self-test routine 
recommended polling time:        (   1) minutes.
Extended self-test routine
recommended polling time:        ( 413) minutes.
Conveyance self-test routine
recommended polling time:        (   2) minutes.
SCT capabilities:              (0x50bd) SCT Status supported.
                                        SCT Error Recovery Control supported.
                                        SCT Feature Control supported.
                                        SCT Data Table supported.

SMART Attributes Data Structure revision number: 10
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE
  1 Raw_Read_Error_Rate     0x000f   080   064   044    Pre-fail  Always       -       97463513
  3 Spin_Up_Time            0x0003   094   094   000    Pre-fail  Always       -       0
  4 Start_Stop_Count        0x0032   100   100   020    Old_age   Always       -       48
  5 Reallocated_Sector_Ct   0x0033   100   100   010    Pre-fail  Always       -       0
  7 Seek_Error_Rate         0x000f   095   060   045    Pre-fail  Always       -       3510550657
  9 Power_On_Hours          0x0032   017   017   000    Old_age   Always       -       73112
 10 Spin_Retry_Count        0x0013   100   100   097    Pre-fail  Always       -       0
 12 Power_Cycle_Count       0x0032   100   100   020    Old_age   Always       -       47
184 End-to-End_Error        0x0032   100   100   099    Old_age   Always       -       0
187 Reported_Uncorrect      0x0032   100   100   000    Old_age   Always       -       0
188 Command_Timeout         0x0032   100   100   000    Old_age   Always       -       0 0 0
189 High_Fly_Writes         0x003a   100   100   000    Old_age   Always       -       0
190 Airflow_Temperature_Cel 0x0022   058   053   040    Old_age   Always       -       42 (Min/Max 32/42)
191 G-Sense_Error_Rate      0x0032   100   100   000    Old_age   Always       -       0
192 Power-Off_Retract_Count 0x0032   095   095   000    Old_age   Always       -       11774
193 Load_Cycle_Count        0x0032   095   095   000    Old_age   Always       -       11851
194 Temperature_Celsius     0x0022   042   047   000    Old_age   Always       -       42 (0 24 0 0 0)
195 Hardware_ECC_Recovered  0x001a   033   001   000    Old_age   Always       -       97463513
197 Current_Pending_Sector  0x0012   100   100   000    Old_age   Always       -       0
198 Offline_Uncorrectable   0x0010   100   100   000    Old_age   Offline      -       0
199 UDMA_CRC_Error_Count    0x003e   200   200   000    Old_age   Always       -       0

SMART Error Log Version: 1
No Errors Logged

SMART Self-test log structure revision number 1
Num  Test_Description    Status                  Remaining  LifeTime(hours)  LBA_of_first_error
# 1  Extended offline    Completed without error       00%      7566         -
# 2  Short offline       Aborted by host               10%      7211         -
# 3  Short offline       Interrupted (host reset)      10%      7206         -
# 4  Extended offline    Completed without error       00%      7199         -
# 5  Extended offline    Completed without error       00%     39487         -
# 6  Extended offline    Completed without error       00%     39468         -
# 7  Extended offline    Completed without error       00%     32494         -
# 8  Extended offline    Completed without error       00%     32475         -
# 9  Short offline       Completed without error       00%     32413         -
#10  Short offline       Completed without error       00%     32389         -
#11  Short offline       Completed without error       00%     32365         -
#12  Short offline       Completed without error       00%     32341         -
#13  Extended offline    Completed without error       00%     32326         -
#14  Short offline       Completed without error       00%     32317         -
#15  Short offline       Completed without error       00%     32293         -
#16  Short offline       Completed without error       00%     32269         -
#17  Short offline       Completed without error       00%     32245         -
#18  Short offline       Completed without error       00%     32221         -
#19  Short offline       Completed without error       00%     32197         -
#20  Short offline       Completed without error       00%     32173         -
#21  Extended offline    Completed without error       00%     32163         -

SMART Selective self-test log data structure revision number 1
 SPAN  MIN_LBA  MAX_LBA  CURRENT_TEST_STATUS
    1        0        0  Not_testing
    2        0        0  Not_testing
    3        0        0  Not_testing
    4        0        0  Not_testing
    5        0        0  Not_testing
Selective self-test flags (0x0):
  After scanning selected spans, do NOT read-scan remainder of disk.
If Selective self-test is pending on power-up, resume after 0 minute delay.

The above only provides legacy SMART information - try 'smartctl -x' for more

参考资料

Dedicated Server - Hetzner Docs

Installimage - Hetzner Docs

Hetzner Rescue System - Hetzner Docs

最后修改:2025 年 04 月 13 日
如果觉得我的文章对你有用,请随意赞赏