[root@localhost ~]# fdisk /dev/sdb ... Command (m for help): n Partition type: p primary (1 primary, 0 extended, 3 free) e extended Select (default p): p Partition number (2-4, default 2): 2 First sector (20973568-62914559, default 20973568): Using default value 20973568 Last sector, +sectors or +size{K,M,G} (20973568-62914559, default 62914559): +5G ... Command (m for help): t Partition number (1,2, default 2): 2 Hex code (type L to list all codes): 8e # 指定system id为8e Changed type of partition 'Linux' to 'Linux LVM' ... Command (m for help): p ... /dev/sdb1 2048 20973567 10485760 8e Linux LVM /dev/sdb2 20973568 31459327 5242880 8e Linux LVM Command (m for help): w ... 2、将各物理磁盘或分区初始化为PV(physical volume,物理卷)
[root@localhost ~]# vgcreate -s 8M myvg /dev/sdb{1,2} Volume group "myvg" successfully created [root@localhost ~]# vgscan Reading volume groups from cache. Found volume group "myvg" using metadata type lvm2 [root@localhost ~]# vgdisplay --- Volume group --- VG Name myvg System ID Format lvm2 Metadata Areas 2 Metadata Sequence No 1 VG Access read/write VG Status resizable MAX LV 0 Cur LV 0 Open LV 0 Max PV 0 Cur PV 2 Act PV 2 VG Size 14.98 GiB PE Size 8.00 MiB Total PE 1918 Alloc PE / Size 0 / 0 Free PE / Size 1918 / 14.98 GiB VG UUID aM3RND-aUbQ-7RjC-dCci-JiS4-Oj2Z-wv9poA 4、在卷组上创建LV(logical volume,逻辑卷)