分类: LINUX
2019-07-05 09:56:59
MBR分区标准决定了MBR只支持2TB以下的硬盘分区,为了能支持使用大于2TB硬盘空间,需使用GPT格式进行分区。创建大于2TB的分区,需使用parted工具。
在企业真实环境中,通常一台服务器有多快硬盘,整个硬盘容量为10TB,需要基于GTP格式对10TB硬盘进行分区,操作步骤如下:
[root@localhost ~]# parted
GNU Parted 3.1
使用 /dev/sda
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) select /dev/sdb
使用 /dev/sdb
(parted) mklabel gpt
警告: The existing disk label on /dev/sdb will be destroyed and all data on this disk will be lost. Do
you want to continue?
是/Yes/否/No? yes
(parted) mkpart primary 0 -1
警告: The resulting partition is not properly aligned for best performance.
忽略/Ignore/放弃/Cancel? ignore
(parted) print
Model: VMware, VMware Virtual S (scsi)
Disk /dev/sdb: 21.5GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name 标志
1 17.4kB 21.5GB 21.5GB primary
(parted) quit
信息: You may need to update /etc/fstab.
[root@localhost ~]# mkfs.ext3 /dev/sdb1
mke2fs 1.42.9 (28-Dec-2013)
文件系统标签=
OS type: Linux
块大小=4096 (log=2)
分块大小=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
1310720 inodes, 5242631 blocks
262131 blocks (5.00%) reserved for the super user
第一个数据块=0
Maximum filesystem blocks=4294967296
160 block groups
32768 blocks per group, 32768 fragments per group
8192 inodes per group
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208,
4096000
Allocating group tables: 完成
正在写入inode表: 完成
Creating journal (32768 blocks): 完成
Writing superblocks and filesystem accounting information: 完成
[root@localhost ~]# mount /dev/sdb1 /mnt/qw
查看是否成功:
[root@localhost ~]# parted –l
Model: VMware, VMware Virtual S (scsi)
Disk /dev/sdb: 21.5GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name 标志
1 17.4kB 21.5GB 21.5GB ext3 primary
[root@localhost ~]# df -h
/dev/sdb1 20G 45M 19G 1% /mnt/qw