parted创建LinuxTB硬盘GPT分区
1、介绍2种分区表:MBR分区表:(MBR含义:主引导记录) 所支持的最大卷:2T (T; terabytes,1TB=1024GB) 对分区的设限:最多4个主分区或3个主分区加一个扩展分区。GPT分区表:(GPT含义:GUID分区表) 支持最大卷:18EB,(E:exabytes,1EB=1024TB) 每个磁盘最多支持128个分区所以如果要大于2TB的卷或分区就必须得用GPT分区表。
2、Linux下fdisk工具不支持GPT,得使用另一个GNU发布的强大分区工具parted。fdisk工具用的话,会有下面的警告信息:WARNING: GPT (GUID Partition Table) detected on '/dev/sda'! The util fdisk doesn't support GPT. Use GNU Parted.
3、parted工具对/dev/sda做GPT分区的过程:parted /dev/sdb # 使用parted来对GPT磁盘操作,进入交互式模式GNU P锾攒揉敫arted 1.8.1 Using /dev/sdb Welcome to GNU Parted! Type ‘help’ to view a list of commands.(parted) mklabel gpt # 将MBR磁盘格式化为GPT(parted) print #打印当前分区(parted) mkpart primary 0 5TB # 分一个5T的主分区(parted) mkpart primary 5TB 12TB # 分一个8T的主分区(parted) print #打印当前分区(parted) quit 退出Information: Don’t forget to update /etc/fstab, if necessary.
4、操作实例:root@node01:/mnt#parted /蟠校盯昂dev/sda GNU Parted 2.3 炽扃仄呦Using /dev/sda Welcome to GNU Parted! Type 'help' to view a list of commands.(parted)mklabel gpt Warning: The existing disk label on /dev/sda will be destroyed and all data on this disk will be lost. Do you want to continue? Yes/No?yes(parted)print Model: DELL PERC 6/i Adapter (scsi) Disk /dev/sda: 500GB Sector size (logical/physical): 512B/512B Partition Table: gpt Number Start End Size File system Name Flags(parted)mkpart primary 0KB 500GB Warning: You requested a partition from 0.00B to 500GB. The closest location we can manage is 17.4kB to 500GB. Is this still acceptable to you? Yes/No?yes Warning: The resulting partition is not properly aligned for best performance. Ignore/Cancel?Ignore(parted)print Model: DELL PERC 6/i Adapter (scsi) Disk /dev/sda: 500GB Sector size (logical/physical): 512B/512B Partition Table: gpt Number Start End Size File system Name Flags 1 17.4kB 500GB 500GB primary(parted)quit Information: You may need to update /etc/fstab. root@node01:/#fdisk -l WARNING: GPT (GUID Partition Table) detected on '/dev/sda'! The util fdisk doesn't support GPT. Use GNU Parted. Disk /dev/sda: 499.6 GB, 499558383616 bytes 255 heads, 63 sectors/track, 60734 cylinders Units = cylinders of 16065 * 512 = 8225280 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk identifier: 0x00000000 Device Boot Start End Blocks Id System /dev/sda1 1 60735 487849983+ ee GPT
5、然后格式化成ext4,需要安装包e4fsprogs.x86_64(yum install e4fsprogs.x86_64)即可。# mkfs.ext4 /dev/sdb1# mkfs.ext4 /dev/sdb2
6、接着用mount挂载分区# mount -t ext4 /dev/sdb1 /bk# mount -t ext4 /dev/sdb2 /ak#df -h
7、最后修改/etc/fstab,添加如下两行,让其开机自动挂载.#vi /etc/fstab/dev/sdb1 /bk ext4 defaults,noatime 1 2/dev/sdb2 /ak ext4 defaults,noatime 1 2
8、硬盘总分区大小10TB扩展:parted非交互分区parted /dev/sdb mklabel gptparted /dev/sdb mkpart primary 0 5000000parted /dev/sdb mkpart primary 5000000 7000001parted /dev/sdb mkpart primary 7000000 8000000parted /dev/sdb p