1. LVM configuration on zzsrv2 1.1. disk configuration
# Fdisk-ldisk/dev/SDA: 21.5 GB, 21474836480 bytes, 41943040 sectorsunits = sectors of 1*512 = 512 bytessector size (logical/physical ): 512 bytes/512 bytesi/o size (minimum/optimal): 512 bytes/512 bytesdisk label type: dosdisk identifier: 0x00012974 device boot start end blocks ID system/dev/sda1 * 2048 1026047 512000 83 Linux/dev/sda2 1026048 41943039 20458496 8e Linux lvmdisk/dev/mapper/C Entos-Swap: 2147 MB, 2147483648 bytes, 4194304 sectorsunits = sectors of 1*512 = 512 bytessector size (logical/physical ): 512 bytes/512 bytesi/o size (minimum/optimal): 512 bytes/512 bytesdisk/dev/mapper/centos-root: 18.8 GB, 18798870528 bytes, 36716544 sectorsunits = sectors of 1*512 = 512 bytessector size (logical/physical): 512 bytes/512 bytesi/o size (minimum/optimal): 512 bytes/5 12 bytes to add a GB disk. Refresh the disk configuration for a Linux system scan: # echo "---">/sys/class/scsi_host/host0/scan # echo "---">/sys/class/scsi_host/host1/scan # echo "- --">/sys/class/scsi_host/host2/scan # fdisk-l: 107.4 GB, 107374182400 bytes, 209715200 sectorsunits = sectors of 1*512 = 512 bytessector size (logical/physical): 512 bytes/512 bytesi/o size (minimum/optimal ): 512 bytes/512 bytes
1.2. LVM Configuration
# Create a partition using fdisk/dev/SDB # fdisk-L/dev/sdbdisk/dev/SDB: 107.4 GB, 107374182400 bytes, 209715200 sectorsunits = sectors of 1*512 = 512 bytessector size (logical/physical): 512 bytes/512 bytesi/o size (minimum/optimal): 512 bytes/512 bytesdisk label type: dosdisk identifier: 0x8dee9f3a device boot start end blocks ID system/dev/sdb1 2048 209715199 104856576 8e Linux LVM create PV # pvcreate/dev/sdb1 physical volume "/dev/sdb1" successfully created create 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 view VG is number of unused PES # 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 will all unused PES are allocated to the last 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 all used up 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. File System Configuration
Create a File System
# Mkfs. ext4/dev/datavg/lvsmb # mkfs. ext4/dev/datavg/lvftp # mkfs. ext4/dev/datavg/lvnfs create mount point # mkdir/SMB # mkdir/FTP # mkdir/nfs # vi/etc/fstab Add/dev/datavg/lvsmb/SMB ext4 ults 0 0/dev/datavg/lvftp/FTP ext4 defaults 0 0/dev/datavg/lvnfs/nfs ext4 defaults 0 0 0 test # 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)
This article from the "Liu Qiong @ Tiandao reward diligence" blog, please be sure to keep this source http://lqiong.blog.51cto.com/8170814/1559071
Centos project instance 5-LVM Configuration