操作系统由MBR->GPT,导致系统黑屏是怎么回事?

bash 复制代码
login as: root
    ┌──────────────────────────────────────────────────────────────────────┐
    │                 • MobaXterm Personal Edition v25.2 •                 │
    │               (SSH client, X server and network tools)               │
    │                                                                      │
    │ ⮞ SSH session to root@192.168.75.102                                 │
    │   • Direct SSH      :  ✓                                             │
    │   • SSH compression :  ✓                                             │
    │   • SSH-browser     :  ✓                                             │
    │   • X11-forwarding  :  ✓  (remote display is forwarded through SSH)  │
    │                                                                      │
    │ ⮞ For more info, ctrl+click on help or visit our website.            │
    └──────────────────────────────────────────────────────────────────────┘

Last login: Fri Jan 16 23:53:00 2026 from 192.168.75.1
[root@rac2 ~]# lsblk
NAME        MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sdd           8:48   0   10G  0 disk
└─sdd1        8:49   0   10G  0 part
sdb           8:16   0   10G  0 disk
└─sdb1        8:17   0   10G  0 part
sr0          11:0    1  4.3G  0 rom
sdc           8:32   0   10G  0 disk
└─sdc1        8:33   0   10G  0 part
sda           8:0    0   32G  0 disk
├─sda2        8:2    0   24G  0 part
│ ├─ol-swap 252:1    0  2.5G  0 lvm  [SWAP]
│ └─ol-root 252:0    0 21.5G  0 lvm  /
└─sda1        8:1    0    1G  0 part /boot
[root@rac2 ~]# lsblk
NAME        MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sdd           8:48   0   10G  0 disk
└─sdd1        8:49   0   10G  0 part
sdb           8:16   0   10G  0 disk
└─sdb1        8:17   0   10G  0 part
sr0          11:0    1  4.3G  0 rom
sdc           8:32   0   10G  0 disk
└─sdc1        8:33   0   10G  0 part
sda           8:0    0   32G  0 disk
├─sda2        8:2    0   24G  0 part
│ ├─ol-swap 252:1    0  2.5G  0 lvm  [SWAP]
│ └─ol-root 252:0    0 21.5G  0 lvm  /
└─sda1        8:1    0    1G  0 part /boot
[root@rac2 ~]# fdisk /dev/sda2
Welcome to fdisk (util-linux 2.23.2).

Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

Device does not contain a recognized partition table
Building a new DOS disklabel with disk identifier 0xb89de9ce.

Command (m for help): n
Partition type:
   p   primary (0 primary, 0 extended, 4 free)
   e   extended
Select (default p): ^Z
[1]+  Stopped                 fdisk /dev/sda2
[root@rac2 ~]# gdisk /dev/sda
GPT fdisk (gdisk) version 0.8.10

Partition table scan:
  MBR: MBR only
  BSD: not present
  APM: not present
  GPT: not present


***************************************************************
Found invalid GPT and valid MBR; converting MBR to GPT format
in memory. THIS OPERATION IS POTENTIALLY DESTRUCTIVE! Exit by
typing 'q' if you don't want to convert your MBR partitions
to GPT format!
***************************************************************


Command (? for help): m
b       back up GPT data to a file
c       change a partition's name
d       delete a partition
i       show detailed information on a partition
l       list known partition types
n       add a new partition
o       create a new empty GUID partition table (GPT)
p       print the partition table
q       quit without saving changes
r       recovery and transformation options (experts only)
s       sort partitions
t       change a partition's type code
v       verify disk
w       write table to disk and exit
x       extra functionality (experts only)
?       print this menu

Command (? for help): n
Partition number (3-128, default 3):
First sector (34-67108830, default = 52428800) or {+-}size{KMGTP}:
Last sector (52428800-67108830, default = 67108830) or {+-}size{KMGTP}:
Current type is 'Linux filesystem'
Hex code or GUID (L to show codes, Enter = 8300):
Changed type of partition to 'Linux filesystem'

Command (? for help): w

Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING
PARTITIONS!!

Do you want to proceed? (Y/N): y
OK; writing new GUID partition table (GPT) to /dev/sda.
Warning: The kernel is still using the old partition table.
The new table will be used at the next reboot.
The operation has completed successfully.
[root@rac2 ~]# lsblk
NAME        MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sdd           8:48   0   10G  0 disk
└─sdd1        8:49   0   10G  0 part
sdb           8:16   0   10G  0 disk
└─sdb1        8:17   0   10G  0 part
sr0          11:0    1  4.3G  0 rom
sdc           8:32   0   10G  0 disk
└─sdc1        8:33   0   10G  0 part
sda           8:0    0   32G  0 disk
├─sda2        8:2    0   24G  0 part
│ ├─ol-swap 252:1    0  2.5G  0 lvm  [SWAP]
│ └─ol-root 252:0    0 21.5G  0 lvm  /
└─sda1        8:1    0    1G  0 part /boot
[root@rac2 ~]# reboot

Remote side unexpectedly closed network connection

──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

Session stopped
    - Press <Return> to exit tab
    - Press R to restart session
    - Press S to save terminal output to file

Network error: Connection timed out

──────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────

Session stopped
    - Press <Return> to exit tab
    - Press R to restart session
    - Press S to save terminal output to file

以上我们最开始有一个fdisk由变成gdisk的操作,这会将原MBR磁盘转换为GPT分区表,但MBR和GPT是不兼容的分区表格式。此时接入操作系统大屏,会发现大屏为黑屏,这是因为操作系统无法从GPT磁盘启动,而原来的MBR引导信息被破坏了。

这个时候情况比较严重了,通常只能说重装系统了,所以在操作之前一定务必谨慎又谨慎。

相关推荐
Fanfanaas7 小时前
Linux 基础开发工具(二)
linux·运维·服务器·c语言
雾岛听蓝7 小时前
Linux线程基础
linux·开发语言·经验分享
齐落山大勇7 小时前
Linux的文件IO
linux·运维·服务器
tod1138 小时前
深入解析ext2文件系统架构
linux·服务器·c++·文件系统·ext
萧行之8 小时前
FRP 0.62.0 + Mac Ollama 公网穿透部署+排障实录(标准 TOML 格式)
linux·服务器
齐潇宇8 小时前
文件共享服务器
linux·运维·网络·文件共享
顺顺 尼8 小时前
进程(从操作系统的状态到linux的进程状态一步到位)
linux·服务器
x-cmd9 小时前
[260412] x-cmd v0.8.13:x free 新增进程内存显示,feishu、telegram REPL 机器人齐上线!
linux·macos·机器人·内存·x-cmd·telegram·feishu
昔我往昔9 小时前
Linux修改静态ip
linux·服务器·tcp/ip