使用parted 对大容量盘进行分区
MBR分区表:(MBR含义:主引导记录)
所支持的最大卷:2T
(T; terabytes,1TB=1024GB)
对分区的设限:最多4个主分区或3个主分区加一个扩展分区。
GPT分区表:(GPT含义:GUID分区表)
支持最大卷:18EB,(E:exabytes,1EB=1024TB)
每个磁盘最多支持128个分区
使用 parted 建立大小超过2T的分区
1,parted /dev/sdb
可以输入p打印磁盘信息,查看分区的情况,找到起始和结束位置。
2,mklabel gpt
设置分区类型为gpt
3,mkpart primary 0% 100%
primary指分区类型为主分区,0是分区开始位置,100%是分区结束位置。相同的命令为:mkpart primary 0-1 或者是:mkpart primary 0 XXXXXX结束的空间
4,print
打印当前分区,查看分区设置是否正确
5,quit
完成后用quit命令退出。
6,mkfs.ext3 /dev/sdb1
格式化磁盘。如果支持EXT4可选择格式化为EXT4,格式化成ext3的时候又出现问题。Ext3默认的block size的大小为4k,最大只能支持8T的空间。格式化时指定block size的大小为8K这样最大可以支持16T的空间。相应命令:mkfs.ext3 -b 8192 /dev/sdb2
第一步,parted
[root@localhost ~]# parted /dev/md123
GNU Parted 3.1
Using /dev/md123
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) parted
第二步mklabel gpt 格式
(parted) mklabel gpt
Warning: The existing disk label on /dev/md123 will be destroyed and all data on this disk will be lost. Do you want to continue?
Yes/No? Yes
(parted) p
Model: Linux Software RAID Array (md)
Disk /dev/md123: 3801GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
第三步,分区大小
(parted) mkpart primary 0% 100%
(parted) p
Model: Linux Software RAID Array (md)
Disk /dev/md123: 3801GB
Sector size (logical/physical): 512B/512B
Partition Table: gpt
Disk Flags:
Number Start End Size File system Name Flags
1 1049kB 3801GB 3801GB primary
(parted) quit
Information: You may need to update /etc/fstab.
[root@localhost ~]# blkid
/dev/sda: TYPE="isw_raid_member"
/dev/sdf: TYPE="isw_raid_member"
/dev/sdh: TYPE="isw_raid_member"
/dev/sdd: TYPE="isw_raid_member"
/dev/sdb: TYPE="isw_raid_member"
/dev/sde: TYPE="isw_raid_member"
/dev/sdc: TYPE="isw_raid_member"
/dev/sr0: UUID="2015-12-09-23-14-10-00" LABEL="CentOS 7 x86_64" TYPE="iso9660" PTTYPE="dos"
/dev/sdg: TYPE="isw_raid_member"
/dev/md126: PTTYPE="dos"
/dev/md126p1: UUID="3fb56b78-6edc-4c97-815d-ce8b3beb32fd" TYPE="swap"
/dev/md126p2: UUID="92cc9ba5-69a5-4e14-bc98-aaaf406148bc" TYPE="xfs"
/dev/md123: PTTYPE="gpt"
/dev/md123p1: UUID="3vJEGY-xD0u-oOdB-2AMD-uYZi-EJcu-7eAgg0" TYPE="LVM2_member" PARTLABEL="primary" PARTUUID="dd206572-fc24-481e-a1e2-f8e6408c43d3"
/dev/md122: PTTYPE="gpt"
/dev/md122p1: UUID="b7879e71-b898-4926-a93c-5c43394ea69f" TYPE="ext4" PARTUUID="fde74149-63f1-4b31-80ba-a7a8ac160382"
/dev/mapper/docker-259:1-1610946489-pool: UUID="489f731f-6c9e-45a7-b2a3-0c81ba1c287a" TYPE="xfs"
isk /dev/md123: 3800.7 GB, 3800720998400 bytes, 7423283200 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x00000000
Device Boot Start End Blocks Id System
/dev/md123p1 1 4294967295 2147483647+ ee GPT
格式化
[root@localhost ~]# mkfs.ext4 /dev/md123p1
mke2fs 1.42.9 (28-Dec-2013)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
231981056 inodes, 927909888 blocks
46395494 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=3076521984
28318 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, 7962624, 11239424, 20480000, 23887872, 71663616, 78675968,
102400000, 214990848, 512000000, 550731776, 644972544
Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
[root@localhost ~]#