概述

由于fdisk命令最多只支持2TB磁盘分区,并不支持更大的磁盘,需要使用GPT格式进行分区。

[root@localhost ~]# fdisk /dev/sdb -l
Disk /dev/sdb: 10561.8 GB, 10561795743744 bytes, 20628507312 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 262144 bytes / 2883584 bytes

[root@localhost ~]# lsblk
NAME            MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda               8:0    0 447.1G  0 disk 
├─sda1            8:1    0   500M  0 part /boot
└─sda2            8:2    0 446.6G  0 part 
  ├─centos-root 253:0    0 202.6G  0 lvm  /
  ├─centos-swap 253:1    0    64G  0 lvm  [SWAP]
  ├─centos-home 253:2    0   100G  0 lvm  /home
  └─centos-var  253:3    0    80G  0 lvm  /var
sdb               8:16   0   9.6T  0 disk 
sr0              11:0    1  1024M  0 rom

开始操作

[root@localhost ~]# parted /dev/sdb
GNU Parted 3.1
Using /dev/sdb
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) p 
Error: /dev/sdb: unrecognised disk label
Model: ZTE LOGICAL VOLUME (scsi)
Disk /dev/sdb: 10.6TB
Sector size (logical/physical): 512B/4096B
Partition Table: unknown
Disk Flags: 
(parted) mklabel gpt
(parted) p 
Model: ZTE LOGICAL VOLUME (scsi)
Disk /dev/sdb: 10.6TB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Disk Flags: 

Number  Start  End  Size  File system  Name  Flags

(parted) mkpart opt 2048s 100%
Warning: The resulting partition is not properly aligned for best performance.
Ignore/Cancel? Ignore 
(parted) p 
Model: ZTE LOGICAL VOLUME (scsi)
Disk /dev/sdb: 10.6TB
Sector size (logical/physical): 512B/4096B
Partition Table: gpt
Disk Flags: 

Number  Start   End     Size    File system  Name  Flags
 1      1049kB  10.6TB  10.6TB               opt

(parted) q 
Information: You may need to update /etc/fstab.

[root@localhost ~]# lsblk
NAME            MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda               8:0    0 447.1G  0 disk 
├─sda1            8:1    0   500M  0 part /boot
└─sda2            8:2    0 446.6G  0 part 
  ├─centos-root 253:0    0 202.6G  0 lvm  /
  ├─centos-swap 253:1    0    64G  0 lvm  [SWAP]
  ├─centos-home 253:2    0   100G  0 lvm  /home
  └─centos-var  253:3    0    80G  0 lvm  /var
sdb               8:16   0   9.6T  0 disk 
└─sdb1            8:17   0   9.6T  0 part 
sr0              11:0    1  1024M  0 rom

[root@localhost ~]# mkfs.ext4 /dev/sdb1
配置自动挂载
[root@localhost ~]# blkid /dev/sdb1
/dev/sdb1: UUID="109d8e10-b13a-4e9d-a43c-f812c9df462f" TYPE="ext4"
[root@localhost ~]# vim /etc/fstab
UUID=109d8e10-b13a-4e9d-a43c-f812c9df462f /data ext4 defaults 0 0
[root@localhost ~]# mount -a
END

本文标题:centos7大容量磁盘分区格式化

本文作者:宇宙最帅的男人

本文链接:https://lolicp.com/linux/202223406.html

版权声明:转载或者引用本文内容请注明来源及原作者,本文著作权归 (lolicp.com) 所有。

除非另有说明,本作品采用知识共享署名-非商业性使用-相同方式共享 4.0 国际许可协议

最后修改:2022 年 05 月 20 日
如果觉得我的文章对你有用,请随意赞赏