超过2T,磁盘分区

时间:2023-03-09 03:33:45
超过2T,磁盘分区

MBR:MBR分区表(即主引导记录)大家都很熟悉。所支持的最大卷:2T,而且对分区有限制:最多4个主分区或3个主分区加一个扩展分区

GPT: GPT(即GUID分区表)。是源自EFI标准的一种较新的磁盘分区表结构的标准,是未来磁盘分区的主要形式。与MBR分区方式相比,具有如下优点。突破MBR 4个主分区限制,每个磁盘最多支持128个分区。支持大于2T的分区,最大卷可达18EB。

-.使用parted

没有parted命令

#yum -y install parted

1、将、dev/sdb 分区

parted /dev/sdb

2、设置分区的类型

(parted) mklabel gpt

3、打印分区信息

(parted) p

4、分区

mkpart primary 0KB .0TB
输出:
rning: You requested a partition from 0.00B to 40.0TB.
The closest location we can manage is 17.4kB to 40.0TB.
Is this still acceptable to you?
Yes/No? yes (输入yes)
Warning: The resulting partition is not properly aligned for best performance.
Ignore/Cancel? i (输入i)

5、查看分区分区信息和退出

(parted) p
Model: HP LOGICAL VOLUME (scsi)
Disk /dev/sdb: 40.0TB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Number Start End Size File system Name Flags
1 17.4kB 40.0TB 40.0TB primary
(parted) quit

二、xfs格式化大分区

 #yum install kmod-xfs xfsprogs
#modprobe xfs //载入xfs文件系统模块
#lsmod |grep xfs //查看是否载入了xfs模块

用xfs格式化并挂载

 #mkfs.xfs -f /dev/sdb1
#mount /dev/sdb1 /data

设置系统启动自动挂载分区

#cat  /etc/fstab
/dev/sdb1 /data xfs defaults 0 0

查看所有磁盘的状态

# parted -l

删除分区

(parted) p
Model: VMware, VMware Virtual S (scsi)
Disk /dev/sdb: 21.5GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt Number Start End Size File system Name Flags
1 17.4kB 21.5GB 21.5GB gzh (parted) rm 1

把分区误删除了恢复

(parted) p
Model: VMware, VMware Virtual S (scsi)
Disk /dev/sdb: 21.5GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt Number Start End Size File system Name Flags
2 17.4kB 3000MB 3000MB xfs gzh
1 10.0GB 21.5GB 11.5GB xfs gg (parted) rm 2
(parted) p
Model: VMware, VMware Virtual S (scsi)
Disk /dev/sdb: 21.5GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt Number Start End Size File system Name Flags
1 10.0GB 21.5GB 11.5GB xfs gg (parted) rescue
Start? 0KB
End? 3GB
Information: A xfs primary partition was found at 17.4kB -> 3000MB. Do you want to add it to the partition table?
Yes/No/Cancel? yes (parted) p
Model: VMware, VMware Virtual S (scsi)
Disk /dev/sdb: 21.5GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt Number Start End Size File system Name Flags
2 17.4kB 3000MB 3000MB xfs
1 10.0GB 21.5GB 11.5GB xfs gg

rm