大于2T磁盘扩容

本文介绍了如何使用GPT分区表来解决Linux中fdisk命令对大于2TB磁盘分区限制的问题。步骤包括创建新的GPT分区表,重新分区,以及使用xfs_growfs扩容分区。此方法适用于需要对大容量硬盘进行分区管理的场景。
摘要由CSDN通过智能技术生成

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 扩容分区

 

评论 3
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值