[root@server0 ~]# fdisk /dev/vdb ////进入磁盘/dev/vdb
Command (m for help): n ////创建分区
Partition type:
p primary (1 primary, 1 extended, 2 free)
l logical (numbered from 5)
Select (default p): l ////选择逻辑分区
Adding logical partition 7
First sector (3809280-20971519, default 3809280):
Using default value 3809280
Last sector, +sectors or +size{K,M,G} (3809280-20971519, default 20971519): +1G ////设置分区大小1G
Partition 7 of type Linux and of size 1 GiB is set
Command (m for help): t ////修改分区类型
Partition number (1,2,5-7, default 7): 7
Hex code (type L to list all codes): 8e ////改为linux LVM类型
Changed type of partition 'Linux' to 'Linux LVM'
Command (m for help): w
[root@server0 ~]# partprobe /dev/vdb ////确认磁盘
[root@server0 ~]# pvcreate /dev/vdb7 ////创建物理卷
Physical volume "/dev/vdb7" successfully created
[root@server0 ~]# vgcreate -s 16M qagroup /dev/vdb7 ////创建卷组qagroup,设置基本扩展单元16M
[root@server0 ~]# lvcreate -l 60 -n qa qagroup ////创建逻辑卷,大小60个扩展单元
Logical volume "qa" already exists in volume group "qagroup"
[root@server0 ~]# mkfs.ext3 /dev/qagroup/qa ////用ext3文件格式化逻辑卷qa
[root@server0 ~]# mkdir /mnt/cheshi1 ////创建ceshi1目录
[root@server0 ~]# vim /etc/fstab ////挂载逻辑卷(本次使用uuid进行挂载)
/dev/qagroup/qa /mnt/ceshi1 ext3 defaults 0 0
[root@server0 ~]# mount –a ////检验挂载结果
[root@server0 ~]# df –h