两块硬盘:scsi
sdb硬盘分sdb5 4G,sdb6 4G
sdc硬盘分sdc5 2G,sdc6 3G,sdc7 3G
pv1:sdb5,sdb6,sdc5---->VG01-->lvmone
pv2:sdc6,sdc4--->VG02-->lvmtwo
[root@DyRHEL ~]# fdisk -l //查看当前分区情况
Disk /dev/sda: 17.1 GB, 17179869184 bytes //第一块硬盘sda一共17.1GB
255 heads, 63 sectors/track, 2088 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System //sda1、sda2为硬盘sda的分区
/dev/sda1 * 1 13 104391 83 Linux
/dev/sda2 14 2088 16667437+ 8e Linux LVM
Disk /dev/sdb: 8589 MB, 8589934592 bytes //第二块硬盘sdb(新增加)
255 heads, 63 sectors/track, 1044 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System //没有分区
Disk /dev/sdc: 8589 MB, 8589934592 bytes //第二块硬盘sdc(新增加)
255 heads, 63 sectors/track, 1044 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System //当前硬盘没有分区
分区:
[root@DyRHEL ~]# fdisk -l
Disk /dev/sda: 17.1 GB, 17179869184 bytes
255 heads, 63 sectors/track, 2088 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sda1 * 1 13 104391 83 Linux //100MB boot分区
/dev/sda2 14 2088 16667437+ 8e Linux LVM //16G系统
Disk /dev/sdb: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdb1 1 1044 8385898+ 5 Extended
/dev/sdb5 1 499 4008154+ 83 Linux //4G
/dev/sdb6 500 1044 4377681 83 Linux //4G
Disk /dev/sdc: 8589 MB, 8589934592 bytes
255 heads, 63 sectors/track, 1044 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot Start End Blocks Id System
/dev/sdc1 1 1044 8385898+ 5 Extended
/dev/sdc5 1 250 2008062 83 Linux //2G
/dev/sdc6 251 624 3004123+ 83 Linux //3G
/dev/sdc7 625 1044 3373618+ 83 Linux //3G
[root@DyRHEL ~]# lvremove /dev/myvg/mylv //删除lvm
/dev/cdrom: open failed: Read-only file system
Do you really want to remove active logical volume "mylv"? [y/n]: y
Logical volume "mylv" successfully removed
[root@DyRHEL ~]# vgremove myvg //移除myvg
/dev/cdrom: open failed: Read-only file system
Volume group "myvg" successfully removed
[root@DyRHEL ~]# pvremove /dev/sdb6
/dev/cdrom: open failed: Read-only file system
Attempt to close device '/dev/cdrom' which is not open.
Labels on physical volume "/dev/sdb6" successfully wiped
[root@DyRHEL ~]# pvremove /dev/sdb5 //移除PV sdb5
/dev/cdrom: open failed: Read-only file system
Attempt to close device '/dev/cdrom' which is not open.
Labels on physical volume "/dev/sdb5" successfully wiped
[root@DyRHEL ~]# pvremove /dev/sdc //移除PV sdc
/dev/cdrom: open failed: Read-only file system
Attempt to close device '/dev/cdrom' which is not open.
Labels on physical volume "/dev/sdc" successfully wiped
[root@DyRHEL ~]# pvremove /dev/sdc5 //移除sdc5
/dev/cdrom: open failed: Read-only file system
Attempt to close device '/dev/cdrom' which is not open.
Labels on physical volume "/dev/sdc5" successfully wiped
[root@DyRHEL ~]# pvcreate /dev/sdb5 /dev/sdb6 //sdb5,sdb6为PV
Physical volume "/dev/sdb5" successfully created
Physical volume "/dev/sdb6" successfully created
[root@DyRHEL ~]# pvcreate /dev/sdc5 /dev/sdc6 /dev/sdc7 //第三块硬盘的分区全部加入pv中
Physical volume "/dev/sdc5" successfully created
Physical volume "/dev/sdc6" successfully created
Physical volume "/dev/sdc7" successfully created
[root@DyRHEL ~]# vgcreate 766vg01 /dev/sdb5 /dev/sdb6 /dev/sdc5 //三个分区加入766vg01卷组中
Volume group "766vg01" successfully created
[root@DyRHEL ~]# vgcreate 766vg02 /dev/sdc6 /dev/sdc7 //最后两个分区加入766vg02卷组中
Volume group "766vg02" successfully created
[root@DyRHEL ~]# lvcreate -L 9G -n 766lvm01 766vg01
/dev/cdrom: open failed: Read-only file system
Logical volume "766lvm01" created
[root@DyRHEL ~]# lvcreate -L 6G -n 766lvm02 766vg02
/dev/cdrom: open failed: Read-only file system
Logical volume "766lvm02" created
[root@DyRHEL ~]# mkfs.ext3 /dev/766vg01/766lvm01 //格式化lvm逻辑卷
[root@DyRHEL ~]# mkfs.ext3 /dev/766vg02/766lvm02 //格式化lvm逻辑卷
fstab文件如下:
/dev/VolGroup00/LogVol00 / ext3 defaults 1 1
LABEL=/boot /boot ext3 defaults 1 2
devpts /dev/pts devpts gid=5,mode=620 0 0
tmpfs /dev/shm tmpfs defaults 0 0
proc /proc proc defaults 0 0
sysfs /sys sysfs defaults 0 0
/dev/VolGroup00/LogVol01 swap swap defaults 0 0
/dev/766vg01/766lvm01 /www ext3 defaults 1 1
/dev/766vg02/766lvm02 /wwwroot ext3 defaults 1 1