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

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

相关推荐
王九思2 小时前
Linux cgroup 简介
linux·运维·服务器
皓月盈江2 小时前
个人计算机Linux Debian桌面操作系统上网安全防护措施
linux·ubuntu·网络安全·debian·桌面操作系统·上网安全防护措施
zl_dfq2 小时前
Linux 之 【文件】(动静态库的制作与使用、ar、ldconfig)
linux
久绊A2 小时前
磁盘故障处理
linux·运维·服务器
JANG10243 小时前
【Linux】进程通信
linux·运维·chrome
viqjeee3 小时前
RK3288设备树介绍和配置
linux·设备树
末日汐3 小时前
Linux进程信号
linux·运维·服务器
无垠的广袤4 小时前
【工业树莓派 CM0 NANO 单板计算机】YOLO26 部署方案
linux·python·opencv·yolo·树莓派·目标识别
皮蛋sol周4 小时前
嵌入式学习数据结构(二)双向链表 内核链表
linux·数据结构·学习·嵌入式·arm·双向链表