gdisk -- 分区工具(GPT分区表)
gdisk主要是用来划分容量大于2T的硬盘,大于2T fdisk搞不定
两种类型的分区表:GPT和MBR ; MBR不支持4T以上
GPT分区:GPT,全局唯一标识分区表(GUID Partition Table),它使用128位GUID来唯一标识每个磁盘和分区,与MBR存在单一故障点不同,GPT提供分区表信息的冗余,一个在磁盘头部一个在磁盘尾部;它通过CRC校验和来检测GPT头和分区表中的错误与损坏;默认一个硬盘支持128个分区
例:对sdb做gpt分区,创建一个sdb1
[root@xuegod63 ~]# gdisk /dev/sdb
。。。
Command (? for help): ? # 查看帮助
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 (1-128, default 1): #直接回车
First sector (34-41943006, default = 2048) or {+-}size{KMGTP}: #直接回车, 从头开始划分空间
Last sector (2048-41943006, default = 41943006) or {+-}size{KMGTP}: +1G #给1G空间
Current type is 'Linux filesystem'
Hex code or GUID (L to show codes, Enter = 8300): #分区类型直接回车
注:8300 Linux filesystem ;8e00 Linux LVM 想查看,可以按L 来显示
Changed type of partition to 'Linux filesystem'
Command (? for help): p #查看
。。。
Number Start (sector) End (sector) Size Code Name
1 2048 2099199 1024.0 MiB 8300 Linux filesystem
Command (? for help): w #保存
Do you want to proceed? (Y/N): y #确定写入
OK; writing new GUID partition table (GPT) to /dev/sdb.
The operation has completed successfully.
[root@xuegod63 ~]# mkfs.xfs /dev/sdb1 #格式化
例2: 修改fstab重启系统后,系统报错:
重启后报错:
输入root密码: 123456
把fstab中新添加开机自动加载项目删除或者用#号注释掉:
然后reboot