火山引擎云服务器故障处理教程-Linux MBR与GPT格式相互转换

axin 2025-04-17 9人围观 ,发现0个评论 火山引擎云服务器云服务器云服务器教程

👉点击这里申请火山引擎VIP帐号,立即体验火山引擎产品>>>

运行环境
  • CentOS/RHEL 7

  • CentOS/RHEL 8

问题描述

由于MBR的特性,分区最大为2T,分区数量有限,具体MBR与GPT的对比请参考文档

解决方案

我们需要将MBR分区格式转换成GPT格式

方法一

使用parted命令,具体方法如下。

[root@iv-2udbhp4fw559kbyz1z88 ~]# parted /dev/vdb  GNU Parted 3.2
Using /dev/vdb
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) mklabel ## 创建新的分区表  New disk label type? gpt ## 输入新分区表格式为 GPT  Warning: The existing disk label on /dev/vdb will be destroyed and all data on this disk will be lost. Do you want to continue?
Yes/No? yes ## 输入 yes 将新的分区表写入/dev/vdb磁盘  (parted) quit ## 输入 quit 保存退出  Information: You may need to update /etc/fstab.

方法二

使用gdisk命令,如没有安装gdisk命令,则先安装相关安装包

yum install -y gdisk

安装完成后,使用gdisk命令进行转换。

[root@iv-2udbhp4fw559kbyz1z88 ~]# gdisk /dev/vdb  GPT fdisk (gdisk) version 1.0.3

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

Found valid GPT with protective MBR; using GPT.

Command (? for help): w ##输入 w 保存 Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING
PARTITIONS!!

Do you want to proceed? (Y/N): y ## 输入 y,将新的分区表写入/dev/vdb磁盘 OK; writing new GUID partition table (GPT) to /dev/vdb.
The operation has completed successfully.

检查分区格式使用命令fdisk -l。

[root@iv-2udbhp4fw559kbyz1z88 ~]# fdisk -l /dev/vdb Disk /dev/vdb: 8 TiB, 8796093022208 bytes, 17179869184 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: gpt ## 此处显示 gpt,表示转换成功 Disk identifier: B1482450-2B4D-489B-AA1E-F01AE70DE553


请关注微信公众号
微信二维码
不容错过
Powered By TOPYUN 云产品资讯