首页 > 代码库 > CentOS项目实例之五--LVM配置
CentOS项目实例之五--LVM配置
1. ZZSRV2上的LVM配置
1.1. 磁盘配置
# fdisk -l Disk /dev/sda: 21.5 GB, 21474836480 bytes, 41943040 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk label type: dos Disk identifier: 0x00012974 Device Boot Start End Blocks Id System /dev/sda1 * 2048 1026047 512000 83 Linux /dev/sda2 1026048 41943039 20458496 8e Linux LVM Disk /dev/mapper/centos-swap: 2147 MB, 2147483648 bytes, 4194304 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk /dev/mapper/centos-root: 18.8 GB, 18798870528 bytes, 36716544 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes 添加100GB的磁盘。让Linux系统扫描刷新磁盘配置: # echo "- - -" > /sys/class/scsi_host/host0/scan # echo "- - -" > /sys/class/scsi_host/host1/scan # echo "- - -" > /sys/class/scsi_host/host2/scan # fdisk -l 看到新的盘了 Disk /dev/sdb: 107.4 GB, 107374182400 bytes, 209715200 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes
1.2. LVM配置
# fdisk /dev/sdb 创建分区 # fdisk -l /dev/sdb Disk /dev/sdb: 107.4 GB, 107374182400 bytes, 209715200 sectors Units = sectors of 1 * 512 = 512 bytes Sector size (logical/physical): 512 bytes / 512 bytes I/O size (minimum/optimal): 512 bytes / 512 bytes Disk label type: dos Disk identifier: 0x8dee9f3a Device Boot Start End Blocks Id System /dev/sdb1 2048 209715199 104856576 8e Linux LVM 创建PV # pvcreate /dev/sdb1 Physical volume "/dev/sdb1" successfully created 创建VG # vgcreate DATAVG /dev/sdb1 Volume group "DATAVG" successfully created # vgdisplay DATAVG --- Volume group --- VG Name DATAVG System ID Format lvm2 Metadata Areas 1 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 1 Act PV 1 VG Size 100.00 GiB PE Size 4.00 MiB Total PE 25599 Alloc PE / Size 0 / 0 Free PE / Size 25599 / 100.00 GiB VG UUID xxKwGK-FDbT-elLy-yU7A-gKfj-j3hc-7Cq76o # lvcreate -n LVSMB -L 40G DATAVG Logical volume "LVSMB" created # lvcreate -n LVFTP -L 30G DATAVG Logical volume "LVFTP" created 查看VG是未使用PE数量 # vgdisplay DATAVG --- Volume group --- VG Name DATAVG System ID Format lvm2 Metadata Areas 1 Metadata Sequence No 3 VG Access read/write VG Status resizable MAX LV 0 Cur LV 2 Open LV 0 Max PV 0 Cur PV 1 Act PV 1 VG Size 100.00 GiB PE Size 4.00 MiB Total PE 25599 Alloc PE / Size 17920 / 70.00 GiB Free PE / Size 7679 / 30.00 GiB VG UUID xxKwGK-FDbT-elLy-yU7A-gKfj-j3hc-7Cq76o 将所有未使用的PE全部分配给最后一个LV # lvcreate -n LVNFS -l 7679 DATAVG Logical volume "LVNFS" created # vgdisplay DATAVG --- Volume group --- VG Name DATAVG System ID Format lvm2 Metadata Areas 1 Metadata Sequence No 4 VG Access read/write VG Status resizable MAX LV 0 Cur LV 3 Open LV 0 Max PV 0 Cur PV 1 Act PV 1 VG Size 100.00 GiB PE Size 4.00 MiB Total PE 25599 Alloc PE / Size 25599 / 100.00 GiB Free PE / Size 0 / 0 全部使用完了 VG UUID xxKwGK-FDbT-elLy-yU7A-gKfj-j3hc-7Cq76o # lvscan ACTIVE ‘/dev/DATAVG/LVSMB‘ [40.00 GiB] inherit ACTIVE ‘/dev/DATAVG/LVFTP‘ [30.00 GiB] inherit ACTIVE ‘/dev/DATAVG/LVNFS‘ [30.00 GiB] inherit ACTIVE ‘/dev/centos/swap‘ [2.00 GiB] inherit ACTIVE ‘/dev/centos/root‘ [17.51 GiB] inherit
1.3. 文件系统配置
创建文件系统
# mkfs.ext4 /dev/DATAVG/LVSMB # mkfs.ext4 /dev/DATAVG/LVFTP # mkfs.ext4 /dev/DATAVG/LVNFS 创建Mount Point # mkdir /smb # mkdir /ftp # mkdir /nfs # vi /etc/fstab 添加 /dev/DATAVG/LVSMB /smb ext4 defaults 0 0 /dev/DATAVG/LVFTP /ftp ext4 defaults 0 0 /dev/DATAVG/LVNFS /nfs ext4 defaults 0 0 测试一下 # mount /smb/ # mount /ftp # mount /nfs # mount ..... /dev/mapper/DATAVG-LVSMB on /smb type ext4 (rw,relatime,data=http://www.mamicode.com/ordered)>
本文出自 “刘琼@天道酬勤” 博客,请务必保留此出处http://lqiong.blog.51cto.com/8170814/1559071
CentOS项目实例之五--LVM配置
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。