操作系统由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引导信息被破坏了。

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

相关推荐
Coder个人博客5 小时前
Linux6.19-ARM64 mm mmu子模块深入分析
大数据·linux·车载系统·系统架构·系统安全·鸿蒙系统
Doro再努力8 小时前
Vim 快速上手实操手册:从入门到生产环境实战
linux·编辑器·vim
wypywyp8 小时前
8. ubuntu 虚拟机 linux 服务器 TCP/IP 概念辨析
linux·服务器·ubuntu
Doro再努力8 小时前
【Linux操作系统10】Makefile深度解析:从依赖推导到有效编译
android·linux·运维·服务器·编辑器·vim
senijusene9 小时前
Linux软件编程:IO编程,标准IO(1)
linux·运维·服务器
忧郁的橙子.9 小时前
02-本地部署Ollama、Python
linux·运维·服务器
醇氧9 小时前
【linux】查看发行版信息
linux·运维·服务器
No8g攻城狮9 小时前
【Linux】Windows11 安装 WSL2 并运行 Ubuntu 22.04 详细操作步骤
linux·运维·ubuntu
XiaoFan01210 小时前
免密批量抓取日志并集中输出
java·linux·服务器
souyuanzhanvip10 小时前
ServerBox v1.0.1316 跨平台 Linux 服务器管理工具
linux·运维·服务器