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=ordered) /dev/mapper/DATAVG-LVFTP on /ftp type ext4 (rw,relatime,data=ordered) /dev/mapper/DATAVG-LVNFS on /nfs type ext4 (rw,relatime,data=ordered)
时间: 2024-10-13 06:18:13