Linux没有gdisk命令,Linux命令之gdisk详解

gdisk -l [设备]

gdisk又叫GPT fdisk,算是fdisk的延伸吧,主要使用的是GPT分区类型,用来划分容量大于2T的硬盘。

扩展1:分区类型GPT和MBR。GPT最大支持18EB(1EB=1024PB,1PB=1024TB),MBR最大支持2TB。

扩展2(了解):GPT,全局唯一标识分区表(GUID Partition Table),它使用128位GUID来唯一标识每个磁盘和分区。与MBR存在单一故障点不同,GPT提供分区表信息的冗余,一个在磁盘头部,一个在磁盘尾部;它通过CRC校验来检测GPT头和分区表中错误与损坏。默认一个硬盘支持128个分区(可以更多)。

(1).选项

只有一个-l选项,列出一个磁盘的所有分区表

(2).操作菜单说明

主要用到的几个和fdisk差不多:n、p、q、w。

完整的菜单如下:

b 将GPT数据备份到一个文件

c 更改分区名称

d 删除一个分区

i 显示分区详细信息

l 列出已知分区类型。此处8200是Linux swap,8300是Linux filesystem(对应fdisk的82和83)。还有一个8e00是Linux LVM

n 增加一个新的分区

o 创建一个新的空白的GPT分区表

p 显示当前磁盘的分区表

q 退出gdisk程序,不保存任何修改

r 恢复和转换选项(仅限专家)

s 排序分区

t 改变分区的类型

v 验证磁盘分区表

w 将分区表写入裁判并退出(保存并退出)

x 额外功能(仅限专家)

? 显示帮助信息

扩展:Liunx LVM(Linux逻辑卷管理),将多个硬盘(物理盘)和硬盘分区(物理分区)做成一个逻辑卷,并把这个逻辑卷作为一个整体来统一管理,动态对分区进行扩缩空间大小,安全快捷方便管理。

(3).实例

[[email protected] ~]# gdisk /dev/sdb

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): p  //显示当前磁盘的分区表

Disk /dev/sdb: 4194304 sectors, 2.0 GiB

Logical sector size: 512 bytes

Disk identifier (GUID): 4E50861F-8360-4B97-986E-51F4080BF678

Partition table holds up to 128 entries

First usable sector is 34, last usable sector is 4194270

Partitions will be aligned on 2048-sector boundaries

Total free space is 2097085 sectors (1024.0 MiB)

Number Start (sector) End (sector) Size Code Name

1 2048 2099199 1024.0 MiB 8300 Linux filesystem

Command (? for help): d  //删除一个分区

Using 1

Command (? for help): n  //新建一个分区

Partition number (1-128, default 1):

First sector (34-4194270, default = 2048) or {+-}size{KMGTP}:    //开始扇区

Last sector (2048-4194270, default = 4194270) or {+-}size{KMGTP}: +1G  //终止扇区

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/sdb.

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.

额,好像并不需要。后面该格式化的格式化(mkfs.xfs,在此之前注意有没有挂载,挂载的需要卸载再格式化),该挂载的挂载。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值