欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  科技

gdisk转fdisk

程序员文章站 2022-04-20 13:28:10
分区测试的时候发现之前用gdisk分区之后,就无法用fdisk进行分区了,哪怕格式化了也不行,通过fdisk 查看硬盘,发现硬盘都变成了GPT分区,无法通过fdisk进行分区操作,所以要通过parted 删除其GPT分区 [root@docker-server-1 ~]# fdisk -lDisk ......

分区测试的时候发现之前用gdisk分区之后,就无法用fdisk进行分区了,哪怕格式化了也不行,通过fdisk 查看硬盘,发现硬盘都变成了gpt分区,无法通过fdisk进行分区操作,所以要通过parted 删除其gpt分区

[root@docker-server-1 ~]# fdisk -l
disk /dev/sdb: 999.7 gb, 999653638144 bytes
255 heads, 63 sectors/track, 121534 cylinders
units = cylinders of 16065 * 512 = 8225280 bytes
sector size (logical/physical): 512 bytes / 512 bytes
i/o size (minimum/optimal): 512 bytes / 512 bytes
disk identifier: 0x000dac36

device boot start end blocks id system

disk /dev/sda: 999.7 gb, 999653638144 bytes
255 heads, 63 sectors/track, 121534 cylinders
units = cylinders of 16065 * 512 = 8225280 bytes
sector size (logical/physical): 512 bytes / 512 bytes
i/o size (minimum/optimal): 512 bytes / 512 bytes
disk identifier: 0x00048d6c

device boot start end blocks id system
/dev/sda1 * 1 1306 10485760 83 linux
/dev/sda2 1306 3346 16384000 82 linux swap / solaris
/dev/sda3 3346 121535 949353472 83 linux

1.选择sdc进行删除gpt分区操作

[root@docker-server-1 ~]# parted /dev/sdc
gnu parted 2.1
using /dev/sdc
welcome to gnu parted! type 'help' to view a list of commands.
(parted)

2.通过mklabel建立msdos分区

(parted) mklabel
new disk label type? msdos
warning: the existing disk label on /dev/sdc will be destroyed and all data on this disk will be lost. do you want to continue?
yes/no? yes
warning: /dev/sdc contains gpt signatures, indicating that it has a gpt table. however, it does not have a valid fake msdos partition table, as it should. perhaps it was corrupted -- possibly by a program that doesn't understand
gpt partition tables. or perhaps you deleted the gpt table, and are now using an msdos partition table. is this a gpt partition table?
yes/no? yes

3.再次通过fdisk 查看sdc,就不会提示gpt分区了