制作LVM

新挂载两块磁盘 各10G

fdisk -l

[root@nagios ~]# fdisk -l

Disk /dev/sda: 32.2 GB, 32212254720 bytes
255 heads, 63 sectors/track, 3916 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
  Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          13      104391   83  Linux
/dev/sda2              14        3916    31350847+  8e  Linux LVM

Disk /dev/sdb: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Disk /dev/sdb doesn't contain a valid partition table

Disk /dev/sdc: 10.7 GB, 10737418240 bytes
255 heads, 63 sectors/track, 1305 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes


fdisk /dev/sdb
n #新建
p #选择分区类型
1 #选择分区号
  #回车默认1-1305全部
t #转换分区格式
8e #输入格式
w  #保存退出

/dev/sdc
同样的操作


创建物理卷
[root@nagios ~]# pvcreate /dev/sdb1
  Physical volume "/dev/sdb1" successfully created
[root@nagios ~]# pvcreate /dev/sdc1
  Physical volume "/dev/sdc1" successfully created


创建卷组
[root@nagios ~]# vgcreate lvm_name /dev/sdb1 /dev/sdc1
创建逻辑卷
[root@nagios ~]# lvcreate -L 13G -n test lvm_name
  Logical volume "test" created

创建ext3系统
[root@nagios ~]# mkfs -t ext3 /dev/lvm_name/test
扩容:
[root@nagios ~]#  lvextend -L +5G /dev/lvm_name/test
  Extending logical volume test to 18.00 GB
  Logical volume test successfully resized
使用resize2fs命令更新系统识别的文件系统大小
[root@nagios ~]# resize2fs /dev/lvm_name/test

挂载使用:
mkdir /mnt/backup
mount /dev/lvm_name/test /mnt/backup/
[root@nagios mnt]# df -h
文件系统              容量  已用 可用 已用% 挂载点
/dev/mapper/VolGroup00-LogVol00
                       28G  2.0G   24G   8% /
/dev/sda1              99M   13M   82M  14% /boot
tmpfs                 501M     0  501M   0% /dev/shm
/dev/mapper/lvm_name-test
                       18G  164M   17G   1% /mnt/backup

设置开机自动挂载
vi /etc/fstab
/dev/lvm_name/test    /mnt/backup       ext3    defaults     0 0

设置完成。