分类: LINUX
2015-02-10 13:49:24
介绍2种分区表:
MBR分区表:(MBR含义:主引导记录)。
所支持的最大卷:2T (T; terabytes,1TB=1024GB)
对分区的设限:最多4个主分区或3个主分区加一个扩展分区。
GPT分区表:(GPT含义:GUID分区表)
全局唯一标识分区表(GUID Partition Table,缩写:GPT)是指全局唯一标示磁盘分区表格式。它是可扩展固件接口(EFI)标准(被Intel用于替代个人计算机的BIOS)的一部分,被用于替代BIOS系统中的以32bits来存储逻辑块地址和大小信息的主引导记录(MBR)分区表。
支持最大卷:18EB,(E:exabytes,1EB=1024TB)
每个磁盘最多支持128个分区
所以如果要大于2TB的卷或分区就必须得用GPT分区表。
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.
下面是用parted工具对/dev/sda做GPT分区的过程:
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 ==》这里是创建主分区,可以是“primary”,“logical”或者“extended”中的一个,分别代表“主分区”,“逻辑分区”和“扩展分区”
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
记的哦,因为fdisk是不支持GPT磁盘,所以使用fdisk -l来查看X磁盘刚才的分区是没有用的.
可以使用 ls -l /dev/sdX 查看
root@node01:/#mkfs.ext4 /dev/sda1
......
root@node01:/#mount /dev/sda1 /export/glusterfs01/
root@node01:/# df -h
Filesystem Size Used Avail Use% Mounted on
/dev/mapper/node01-root
6.8G 987M 5.5G 16% /
none 7.9G 208K 7.9G 1% /dev
none 7.9G 0 7.9G 0% /dev/shm
none 7.9G 32K 7.9G 1% /var/run
none 7.9G 0 7.9G 0% /var/lock
/dev/sdb1 228M 21M 196M 10% /boot
/dev/sda1 458G 198M 435G 1% /export/glusterfs01
root@node01:/#vi /etc/fstab
......
# /boot was on /dev/sdb1 during installation
UUID=c21707ff-ba0f-43ee-819a-8e72fa0f8500 /boot ext2 defaults 0 2
/dev/mapper/node01-swap_1 none swap sw 0 0
/dev/sda1 /export/glusterfs01 ext4 defaults 0 2
重启就可以自动挂载了!至此完成。