[root@localhost ~]# fdisk /dev/sdb #建立分区的命令省略
Command {m for help): p
Disk /dev/sdb: 21.5 GB, 21474836480 bytes 255 heads, 63 sectors/track, 2610 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: 0x00000ebd
Device Boot Start End Blocks Id System
/dev/sdbl 1 65 522081 83 Linux
/dev/sdb2 66 2610 20442712+ 5 Extended
/dev/sdb5 66 197 1060258+ 83 Linux
/dev/sdb6 198 329 1060258+ 83 Linux
/dev/sdb7 330 461 1060258+ 83 Linux
#建立了/dev/sdb5 ~ 7三个分区
Command (m for help): t
Partition number (1-7): 5
Hex code (type L to list codes): 8e
Changed system type of partition 5 to 8e (Linux LVM)
#把/dev/sdb5的分区ID改为8e,其他两个分区照做,改好后,查询结果如下:
Command (m for help): p
Disk /dev/sdb: 21.5 GB, 21474836480 bytes 255 heads, 63 sectors/track, 2610 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: 0x00000ebd
Device Boot Start End Blocks Id System
/dev/sdb1 1 65 52.2081 83 Linux
/dev/sdb2 66 2610 20442712+ 5 Extended
/dev/sdb5 66 197 1060258+ 8e Linux LVM
/dev/sdb6 198 329 1060258+ 8e Linux LVM
/dev/sdb7 330 461 1060258+ 8e Linux LVM #保存退出
[root@localhost ~]# partprobe #记得重新读取分区表,否则重启系统
[root@localhost ~]# pvcreate [设备文件名]
在建立物理卷时,我们既可以把整块硬盘都建立成物理卷,也可以把某个分区建立成物理卷。如果要把整块硬盘都建立成物理卷,则命令如下:[root@localhost ~]# pvcreate /dev/sdb
在我们的使用中要把分区建立成物理卷,所以执行以下命令:[root@localhost ~]# pvcreate /dev/sdb5
Writing physical volume data to disk "/dev/sdb5" Physical volume "/dev/sdb5" successfully created
[root@localhost ~]# pvcreate /dev/sdb6
Writing physical volume data to disk "/dev/sdb6" Physical volume "/dev/sdb6" successfully created
[root@localhost ~]# pvcreate /dev/sdb7
Writing physical volume data to disk "/dev/sdb7" Physical volume 7dev/sdb7' successfully created
[root@localhost ~]# pvscan
PV /dev/sdb5 Ivm2 [1.01 GiB]
PV /dev/sdb6 Ivm2 [1.01 GiB]
PV /dev/sdb7 Ivm2 [1.01 GiB]
Total: 3 [3.03 GiB] /in no VG: 0 [0 ] / in no VG: 3 [3.03 GiB]
[root@localhost ~]# pvdisplay
"/dev/sdb5" is a new physical volume of "1.01 GiB"
—NEW Physical volume 一
PV Name /dev/sdb5
#PV名
VG Name
#属于的VG名,还没有分配,所以空白
PV Size 1.01 GiB
#PV 的大小
Allocatable NO
#是否已经分配
PE Size 0
#PE大小,因为还没有分配,所以PE大小也没有指定
Total PE 0
#PE总数
Free PE 0
#空闲 PE数
Allocated PE 0
#可分配的PE数
PV UUID CEsVz3-t0sD-e1w0-wkHZ-iaLq-06aV-xtQNTB
#PV的UUID
…其它两个PV省略…
[root@localhost ~]# pvremove /dev/sdb7
Labels on physical volume "/dev/sdb7" successfully wiped
#当然,在我们的使中还要用到/dev/sdb7物理卷,所以实验完成后,记得把它再添加回来
新闻热点
疑难解答