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

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

相关推荐
舒一笑1 小时前
Ubuntu系统安装CodeX出现问题
linux·后端
改一下配置文件2 小时前
Ubuntu24.04安装NVIDIA驱动完整指南(含Secure Boot解决方案)
linux
深紫色的三北六号12 小时前
Linux 服务器磁盘扩容与目录迁移:rsync + bind mount 实现服务无感迁移(无需修改配置)
linux·扩容·服务迁移
SudosuBash16 小时前
[CS:APP 3e] 关于对 第 12 章 读/写者的一点思考和题解 (作业 12.19,12.20,12.21)
linux·并发·操作系统(os)
哈基咪怎么可能是AI1 天前
为什么我就想要「线性历史 + Signed Commits」GitHub 却把我当猴耍 🤬🎙️
linux·github
十日十行2 天前
Linux和window共享文件夹
linux
木心月转码ing2 天前
WSL+Cpp开发环境配置
linux
崔小汤呀3 天前
最全的docker安装笔记,包含CentOS和Ubuntu
linux·后端
何中应3 天前
vi编辑器使用
linux·后端·操作系统
何中应3 天前
Linux进程无法被kill
linux·后端·操作系统