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

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

相关推荐
Titan20241 小时前
Linux动静态库
linux·服务器·c++
赵民勇1 小时前
Linux file命令详解
linux·运维
li-xun1 小时前
LINUX DO 社区注册机制调整与公益 AI 服务动态
linux·运维·人工智能
ba_pi1 小时前
k8s删除pod
linux·容器·kubernetes
wuminyu2 小时前
Java锁机制之park和unpark源码剖析
java·linux·c语言·jvm·c++
皆圥忈2 小时前
文件描述符与重定向
linux
实心儿儿2 小时前
Linux —— 线程池(2)
linux
AI帮小忙2 小时前
主机安全排查
linux·服务器·安全
半壶清水3 小时前
ubuntu下利用ns-3 + NetAnim搭建可视化路由选路过程的方法
linux·运维·ubuntu
程序员老舅3 小时前
从内核视角,看Linux文件读写过程
linux·服务器·c++·内核·linux内核·vfs·linux内存