1,准备工作虚拟机vmware 和RedHat6 server,模拟给redhat6添加两块SCSI硬盘大小为5G和7G 也可以自定大小,添加完成->开机,(如果开机状态添加的)# :reboot
2,查看磁盘的磁盘名 fdisk -l (确定/dev/sdb和/dev/sdc 两块磁盘)
[root@localhost ~]# ll /dev/sd*
brw-rw----. 1 root disk 8, 0 Mar 24 06:55 /dev/sda
brw-rw----. 1 root disk 8, 1 Mar 24 06:55 /dev/sda1
brw-rw----. 1 root disk 8, 2 Mar 24 06:55 /dev/sda2
brw-rw----. 1 root disk 8, 16 Mar 24 06:55 /dev/sdb
brw-rw----. 1 root disk 8, 32 Mar 24 06:55 /dev/sdc
3对/dev/sdb 和/dev/sdc 分区
[root@localhost ~]# fdisk /dev/sdb
Command (m for help): n --->命令n 创建新分区
Command action
e extended ---->e为扩展分区
p primary partition (1-4)----->p为主分区
p ----->我们这里选择主分区
Partition number (1-4): 1 ----->主分区编号,选择默认
First cylinder (1-652, default 1): ----->起始柱面号码,选择默认
Using default value 1
Last cylinder, +cylinders or +size{K,M,G} (1-652, default 652): ----->结束柱面编号,根据自己的磁盘划分,可以用+#G来确定
Using default value 652
Command (m for help): t----->命令t 改变分区类型
Selected partition 1
Hex code (type L to list codes): 8e----->类型为8e LVM 如果有不知道类型的可以L查看
Changed system type of partition 1 to 8e (Linux LVM)
Command (m for help): w----->命令w 保存退出
以同样方法创建/dev/sdc
4执行命令:partprobe ----->重新读取分区表
cat /proc/partitons ----->查看分区表是否加载创的新分区
5pv 物理卷
1:pv 创建
[root@localhost ~]# pvcreate /dev/sdb1 /dev/sdc1-----> pvcreate 跟要加入pv的设备
Physical volume "/dev/sdb1" successfully created
Physical volume "/dev/sdc1" successfully created
2:pv :查看pv信息
[root@localhost ~]# pvs -----> 查看pv信息
PV VG Fmt Attr PSize PFree
/dev/sda2 VolGroup lvm2 a-- 19.51g 0
/dev/sdb1 lvm2 a-- 4.99g 4.99g
/dev/sdc1 lvm2 a-- 6.99g 6.99g
---------------------------------------------------------------
[root@localhost ~]# pvdisplay -----> 查看pv的详细信息
--- Physical volume ---
PV Name /dev/sda2
VG Name VolGroup
PV Size 19.51 GiB / not usable 3.00 MiB
Allocatable yes (but full)
PE Size 4.00 MiB
Total PE 4994
Free PE 0
Allocated PE 4994
PV UUID NtZgu3-kqfB-HYtw-YMzu-oM6r-Fy9c-0kmeqf
"/dev/sdb1" is a new physical volume of "4.99 GiB"
--- NEW Physical volume ---
PV Name /dev/sdb1
VG Name
PV Size 4.99 GiB
Allocatable NO
PE Size 0
Total PE 0
Free PE 0
Allocated PE 0
PV UUID CCEdHk-dQJi-YfZi-SGnO-cnoc-mLgV-AqwokJ
"/dev/sdc1" is a new physical volume of "6.99 GiB"
--- NEW Physical volume ---
PV Name /dev/sdc1
VG Name
PV Size 6.99 GiB
Allocatable NO
PE Size 0
Total PE 0
Free PE 0
Allocated PE 0