[root@pgb ~]# pvcreate /dev/hdb1 /dev/hdd1 /dev/cdrom: open failed: Read-onlyfilesystem Attempt toclose device '/dev/cdrom' which is not open. Physical volume "/dev/hdb1" successfully created /dev/cdrom: open failed: Read-onlyfilesystem Attempt toclose device '/dev/cdrom' which is not open. Physical volume "/dev/hdd1" successfully created
[root@pgb ~]# pvscan PV /dev/hdb1 lvm2 [976.96 MB] PV /dev/hdd1 lvm2 [1023.72 MB] Total: 2[1.95 GB] / in use: 0[0 ] / in no VG: 2[1.95 GB]
备注:上面显示 /dev/hdb1, /dev/hdd1 已经创建成 PV 了。
5 创建VG ( vgcreate )
1 2 3 4 5 6 7 8 9
[root@pgb ~]# vgcreate vg01_pgdata /dev/hdb1 /dev/hdd1 /dev/cdrom: open failed: Read-onlyfilesystem /dev/cdrom: open failed: Read-onlyfilesystem Attempt toclose device '/dev/cdrom' which is not open. /dev/cdrom: open failed: Read-onlyfilesystem Attempt toclose device '/dev/cdrom' which is not open. /dev/cdrom: open failed: Read-onlyfilesystem Attempt toclose device '/dev/cdrom' which is not open. Volume group "vg01_pgdata" successfully created
[root@pgb ~]# vgdisplay --- Volume group --- VG Name vg01_pgdata 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 1.95 GB PE Size 4.00 MB Total PE 499 Alloc PE / Size 0 / 0 Free PE / Size 499 / 1.95 GB VG UUID B5pg8R-2AGm-6DEp-K7HK-TI1I-HC3h-gWx32m
[root@pgb lvm]# mkfs -t ext3 -c /dev/vg01_pgdata/lv_pgdata1 mke2fs 1.39 (29-May-2006) Filesystem label= OS type: Linux Block size=4096 (log=2) Fragment size=4096 (log=2) 131072 inodes, 262144 blocks 13107 blocks (5.00%) reserved for the super user First data block=0 Maximum filesystem blocks=268435456 8 block groups 32768 blocks per group, 32768 fragments per group 16384 inodes per group Superblock backups stored on blocks: 32768, 98304, 163840, 229376 Checking for bad blocks (read-only test): done Writing inode tables: done Creating journal (8192 blocks): done Writing superblocks and filesystem accounting information: done This filesystem will be automatically checked every 30 mounts or 180 days, whichever comes first. Use tune2fs -c or -i to override.
[root@pgb lvm]# vgdisplay
--- Volume group ---
VG Name vg01_pgdata
System ID
Format lvm2
Metadata Areas 2
Metadata Sequence No 2
VG Access read/write
VG Status resizable
MAX LV 0
Cur LV 1
Open LV 1
Max PV 0
Cur PV 2
Act PV 2
VG Size 1.95 GB
PE Size 4.00 MB
Total PE 499
Alloc PE / Size 256 / 1.00 GB
Free PE / Size 243 / 972.00 MB VG UUID B5pg8R-2AGm-6DEp-K7HK-TI1I-HC3h-gWx32m