Linux命令fdisk 分区最大只能分2T的空间,若是大于2T的磁盘该如何分区
1、先fdisk 进行分区,分一个2T的分区,格式化挂载,并写入一个文件测试
假设磁盘3T
fdisk /dev/sde
mkfs.xfs /dev/sde1
mount /dev/sde1 /test
df -h
2、创建一个新的空GPT分区表
使用 fdisk 命令,然后选择 g ,最后保存退出
[root@dn15 ~]# fdisk /dev/sde
WARNING: The size of this disk is 3.3 TB (3298534883328 bytes).
DOS partition table format can not be used on drives for volumes
larger than (2199023255040 bytes) for 512-byte sectors. Use parted(1) and GUID
partition table format (GPT).
欢迎使用 fdisk (util-linux 2.23.2)。
更改将停留在内存中,直到您决定将更改写入磁盘。
使用写入命令前请三思。
命令(输入 m 获取帮助):m
命令操作
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition
g create a new empty GPT partition table
G create an IRIX (SGI) partition table
l list known partition types
m print this menu
n add a new partition
o create a new empty DOS partition table
p print the partition table
q quit without saving changes
s create a new empty Sun disklabel
t change a partition's system id
u change display/entry units
v verify the partition table
w write table to disk and exit
x extra functionality (experts only)
命令(输入 m 获取帮助):g
Building a new GPT disklabel (GUID: 051EE8F1-D143-4F30-B238-5E8D28D54BC0)
命令(输入 m 获取帮助):wq
The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition table failed with error 16: 设备或资源忙.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
3、重新进行分区
[root@dn15 ~]# fdisk /dev/sde
WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.
欢迎使用 fdisk (util-linux 2.23.2)。
更改将停留在内存中,直到您决定将更改写入磁盘。
使用写入命令前请三思。
命令(输入 m 获取帮助):n
分区号 (1-128,默认 1):
第一个扇区 (2048-6442450910,默认 2048):
Last sector, +sectors or +size{K,M,G,T,P} (2048-6442450910,默认 6442450910):
已创建分区 1
命令(输入 m 获取帮助):wq
The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: Re-reading the partition table failed with error 16: 设备或资源忙.
The kernel still uses the old table. The new table will be used at
the next reboot or after you run partprobe(8) or kpartx(8)
正在同步磁盘。
4、分区完成后前面挂载的磁盘要先卸载,然后使用 partpore 命令刷新分区,这时候lsblk 会发现 sde1分区已变为3T ,当时将分区挂在后,发现,显示容量还是2T,需要使用xfs_growfs /dev/sde1 扩容分区