创建操作大于2T的分区
一般情况下,我们都是选择使用fdisk工具来进行分区,但是目前在实际生产环境中使用的磁盘空间越来越大,呈TiB级别增长;而常用的fdisk这个工具对分区是有大小限制的,它只能划分小于2T的磁盘,所以在划大于2T磁盘分区的时候fdisk就无法满足要求了;这个时候有2个方法,其一是通过卷管理来实现,其二就是通过parted工具来实现对GPT磁盘进行分区操作;这里我们采用parted的方法来实现管理。
下列展示对40T的磁盘进行分区的过程:
[root@test100 ~]# fdisk -l
WARNING: fdisk GPT support is currently new, and therefore in an experimental phase. Use at your own discretion.
Disk /dev/sda: 1199.0 GB, 1198999470080 bytes, 2341795840 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 262144 bytes / 262144 bytes
Disk label type: gpt
Disk identifier: 9BD5C445-8D38-4490-8A9E-B15E9FBB8BC8
# Start End Size Type Name
1 2048 411647 200M EFI System EFI System Partition
2 411648 2508799 1G Microsoft basic
3 2508800 2341793791 1.1T Linux LVM
Disk /dev/sdb: 44000.0 GB, 43999996936192 bytes, 85937494016 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 262144 bytes / 1048576 bytes
Disk /dev/mapper/centos-root: 53.7 GB, 53687091200 bytes, 104857600 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 262144 bytes / 262144 bytes
Disk /dev/mapper/centos-swap: 4294 MB, 4294967296 bytes, 8388608 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 262144 bytes / 262144 bytes
Disk /dev/mapper/centos-home: 1139.7 GB, 1139730808832 bytes, 2226036736 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 262144 bytes / 262144 bytes
[root@test100 ~]# part
parted partprobe partx
[root@test100 ~]# 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: AVAGO HW-SAS3508 (scsi)
Disk /dev/sdb: 44.0TB
Sector size (logical/physical): 512B/512B
Partition Table: unknown
Disk Flags:
(parted) mklabel gpt
(parted) p
Model: AVAGO HW-SAS3508 (scsi)
Disk /dev/sdb: 44.0TB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
(parted) mkpart primary 0 22T
Warning: The resulting partition is not properly aligned for best performance.
Ignore/Cancel? I
(parted) p
Model: AVAGO HW-SAS3508 (scsi)
Disk /dev/sdb: 44.0TB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
1 17.4kB 22.0TB 22.0TB primary
(parted) mkpart primary 22T -1
(parted) p
Model: AVAGO HW-SAS3508 (scsi)
Disk /dev/sdb: 44.0TB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
1 17.4kB 22.0TB 22.0TB primary
2 22.0TB 44.0TB 22.0TB primary
(parted) p
Model: AVAGO HW-SAS3508 (scsi)
Disk /dev/sdb: 44.0TB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
1 17.4kB 22.0TB 22.0TB primary
2 22.0TB 44.0TB 22.0TB primary
(parted) q
Information: You may need to update /etc/fstab.
[root@test100 ~]# df
Filesystem 1K-blocks Used Available Use% Mounted on
devtmpfs 133618048 0 133618048 0% /dev
tmpfs 133633792 0 133633792 0% /dev/shm
tmpfs 133633792 97472 133536320 1% /run
tmpfs 133633792 0 133633792 0% /sys/fs/cgroup
/dev/mapper/centos-root 52403200 15015640 37387560 29% /
/dev/sda2 1038336 151480 886856 15% /boot
/dev/sda1 204580 9112 195468 5% /boot/efi
/dev/mapper/centos-home 1112474880 2396624 1110078256 1% /home
tmpfs 26726784 64 26726720 1% /run/user/42
tmpfs 26726784 576 26726208 1% /run/user/0
[root@test100 ~]# mkfs.ext
mkfs.ext2 mkfs.ext3 mkfs.ext4
[root@test100 ~]# mkfs.ext4 /dev/sdb
sdb sdb1 sdb2
[root@test100 ~]# mkfs.ext4 /dev/sdb1
mke2fs 1.42.9 (28-Dec-2013)
/dev/sdb1 alignment is offset by 244736 bytes.
This may result in very poor performance, (re)-partitioning suggested.
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=64 blocks, Stripe width=256 blocks
335693824 inodes, 5371093744 blocks
268554687 blocks (5.00%) reserved for the super user
First data block=0
163913 block groups
32768 blocks per group, 32768 fragments per group
2048 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,
102400000, 214990848, 512000000, 550731776, 644972544, 1934917632,
2560000000, 3855122432
Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
[root@test100 ~]# mkfs.ext4 /dev/sdb2
mke2fs 1.42.9 (28-Dec-2013)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=64 blocks, Stripe width=256 blocks
335693824 inodes, 5371092736 blocks
268554636 blocks (5.00%) reserved for the super user
First data block=0
163913 block groups
32768 blocks per group, 32768 fragments per group
2048 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,
102400000, 214990848, 512000000, 550731776, 644972544, 1934917632,
2560000000, 3855122432
Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information:
done
[root@test100 ~]#
[root@test100 ~]# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sdb 8:16 0 40T 0 disk
├─sdb2 8:18 0 20T 0 part
└─sdb1 8:17 0 20T 0 part
sda 8:0 0 1.1T 0 disk
├─sda2 8:2 0 1G 0 part /boot
├─sda3 8:3 0 1.1T 0 part
│ ├─centos-swap 253:1 0 4G 0 lvm [SWAP]
│ ├─centos-home 253:2 0 1T 0 lvm /home
│ └─centos-root 253:0 0 50G 0 lvm /
└─sda1 8:1 0 200M 0 part /boot/efi
[root@test100 ~]#
参考博文:https://www.cnblogs.com/wholj/p/10924129.html