1. View the newly added disks as follows:/DEV/SDE for newly added disks
The following script can be used to scanEcho '---' >/sys/class/scsi_host/host0/scan
[[email protected] ~]# fdisk-l disk/dev/sda:21.5 GB, 21474836480 bytes255 heads, sectors/track, 2610 Cylin Dersunits = Cylinders of 16065 * 8225280 bytessector size (logical/physical): bytes/512 bytesi/o Size (minimum /optimal): bytes/512 bytesdisk identifier:0x00028c6a device boot Start End blocks Id system/dev/sda1 * 1 26 204800 83 L Inuxpartition 1 does not end on cylinder boundary./dev/sda2 26   ; 2611 20765696 8e Linux lvm disk/dev/sde:8589 MB, 8589934592 bytes255 H EADS, Sectors/track, 1044 cylindersunits = cylinders of 16065 * = 8225280 bytessector size (logical/physical): 512 bytes/512 bytesi/o Size (miNimum/optimal): bytes/512 bytesdisk identifier:0x00000000 disk/dev/mapper/vg_rac01-logvol01:12.7 GB, 12670992384 bytes255 heads, sectors/track, 1540 cylindersunits = cylinders of 16065 * MB = 8225280 bytessector size (l ogical/physical): bytes/512 bytesi/o size (minimum/optimal): bytes/512 bytesdisk identifier:0x00000000 & nbsp;disk/dev/mapper/vg_rac01-logvol00:8589 MB, 8589934592 bytes255 heads, sectors/track, 1044 cylindersunits = Cylin DERs of 16065 * 8225280 = bytessector size (logical/physical): bytes/512 bytesi/o size (minimum/optimal): by tes/512 Bytesdisk identifier:0x00000000
2. Partition the disk, divide it into a primary partition, and create a PV[Email protected] ~]# Fdisk/dev/sdedevice contains neither a valid DOS partition table, nor Sun, SGI or OSF Disklabelbui Lding a new DOS disklabel with disk identifier 0X6751FD38. Changes'll remain in memory only, until the decide to write them. After that, of course, the previous content won ' t is recoverable. Warning:invalid flag 0x0000 of partition Table 4 would be a corrected by W (rite) warning:dos-compatible mode is deprecated. It ' s strongly recommended to switch off the mode (command ' C ') and change display units to sectors (comma nd ' u '). Command (M for help): N
#n为新建一个分区Command Action E Extended P primary partition (1-4) p
#p为新建一个primary partition, which is the primary partitionPartition number (1-4): Value out of range. Partition number (1-4): 1
#分区序号为1First cylinder (1-1044, default 1):
#默认从第一个柱面开始Using default value 1Last cylinder, +cylinders or +size{k,m,g} (1-1044, default 1044):
#默认到最后一个柱面结束Using Default Value 1044 Command (M for help): t
#改变分区格式为8e linux LVM Logical Volume formatSelected partition 1Hex code (type L to list codes): 8e
Changed System type of partition 1 to 8e (Linux LVM)Command (M for help): W
#保存退出The partition table has been altered! Calling IOCTL () to re-read partition table. Syncing disks.
3. View the creation situation[[email protected] ~]# fdisk-l disk/dev/sda:21.5 GB, 21474836480 bytes255 heads, sectors/track, 2610 Cylin Dersunits = Cylinders of 16065 * 8225280 bytessector size (logical/physical): bytes/512 bytesi/o Size (minimum /optimal): bytes/512 bytesdisk identifier:0x00028c6a device boot Start End blocks Id system/dev/sda1 * 1 26 204800 83 L Inuxpartition 1 does not end on cylinder boundary./dev/sda2 26   ; 2611 20765696 8e Linux lvm disk/dev/sde:8589 MB, 8589934592 bytes255 H EADS, Sectors/track, 1044 cylindersunits = cylinders of 16065 * = 8225280 bytessector size (logical/physical): 512 bytes/512 bytesi/o Size (miNimum/optimal): bytes/512 bytesdisk identifier:0x6751fd38 device Boot START&N Bsp End blocks Id system/dev/sde1 1 1044 8385898+ 8e Linux Lvm di sk/dev/mapper/vg_rac01-logvol01:12.7 GB, 12670992384 bytes255 heads, sectors/track, 1540 cylindersunits = cylinders O F 16065 * = 8225280 bytessector size (logical/physical): bytes/512 bytesi/o size (minimum/optimal): Bytes/ Bytesdisk identifier:0x00000000 disk/dev/mapper/vg_rac01-logvol00:8589 MB, 8589934592 bytes255 heads, sect Ors/track, 1044 cylindersunits = cylinders of 16065 * MB = 8225280 bytessector size (logical/physical): bytes/512 b YTESI/O size (minimum/optimal): bytes/512 bytesdisk identifier:0x00000000
4. Create a physical volume group[Email protected] ~]# pvcreate/dev/sde1 physical Volume "/dev/sde1" successfully created[[email protected] ~]# Pvdispla Y
#查看物理卷组情况 ---Physical volume--- PV name /dev/sda2 VG Name vg_rac01 PV Size &N Bsp 19.80 gib/not usable 3.00 mib allocatable Yes (but full) &NB Sp PE Size 4.00 mib Total PE 5069 free PE 0 Allo cated pe 5069 PV uuid vhmlej -baqh-yugi-ubff-oytc-31yt-xoukey "/dev/sde1" is a new physical volume of "8.00 GiB" ---new Physical vol Ume--- PV name /dev/sde1 VG name &N Bsp &NBSp PV Size 8.00 gib allocatable   ; NO PE Size 0 & nbsp; Total PE 0 free PE &N Bsp 0 allocated pe 0 PV uuid &NB Sp 7axfPk-Xxfg-HWQS-gBjj-GD0Q-xFgU-e9apR7
5. View Physical Volume groups[[email protected] ~]# pvscan pv/dev/sda2 VG vg_rac01 lvm2 [19.80 gib/0 free] pv/dev/sde1 LVM 2 [8.00 Gib] total:2 [27.80 GIB]/in use:1 [19.80 GIB]/in no vg:1 [8.00 Gib]
6. Extending the physical volume[[email protected] ~]# vgextend vg_rac01/dev/sde1 Volume Group "VG_RAC01" successfully extended[[email protected] ~]# vgdisplay ---Volume group--- VG Name & nbsp vg_rac01 System id Format &N Bsp lvm2 Metadata areas 2 Metadata Sequence No 4 VG Access read/write VG Status & nbsp resizable MAX LV and nbsp;0 Cur LV 2 Open LV &NB Sp 2 Max PV &N Bsp 0 Cur PV 2 Act PV & nbsp 2 VG Size & nbsp;27.80 gib pe Size 4.00 mib Total PE 7116 Alloc pe/size 5069 /19.80 gib free pe/size 2047/8.00 gib VG UUID &NBSP ; z1Fila-7Cwx-8m9K-XQMG-UK4a-4iLq-kibPv2
7. View logical Volumes [[email protected] ~]# lvdisplay ---Logical volume--- LV Path /dev/vg_rac01/LogVol01 LV name -Log vol01 VG Name vg_rac01 LV uuid &NB Sp mnt2gu-ofuy-sbvc-mbu3-p1gz-bjcc-s1qxcl LV Write access read/write& nbsp LV Creation host, Time rac01, 2017-03-07 14:40:50 +0800 LV Status A vailable # Open 1 LV Size 11.80 gib current le  3021&N Bsp segments 1 Allocation &NBSP ; &Nbsp;inherit Read ahead sectors auto -currently set to 256 Block D evice 253:0 ---Logical volume--- LV Path /dev/vg_rac01/LogVol00 LV name &NB Sp logvol00 VG Name vg_rac01 LV UUID ojgg6e-dgbl-rbwb-pwch-utu2-st3i-kvvt9k LV Write access &NBSP ; read/write LV Creation host, Time rac01, 2017-03-07 14:40:55 +0800 LV Status &NBSP ; available # Open 1 LV Size 8.00 gib current LE &NBS P  2048 segments 1 Allocation & nbsp inherit Read ahead sectors auto -currently set to  2 56 Block device 253:1
9. Check the situation[[email protected] ~]# VGS VG #PV #LV #SN Attr vsize vfree vg_rac01 2 2 0 wz--n-27.80g 8.00g[[email Prot Ected] ~]# LVs LV VG Attr lsize Pool Origin data% meta% Move Log cpy%sync Convert LogVol00 vg_rac01 -wi-ao----8.00g LogVol01 vg_rac01-wi-ao----11.80g
10. Extended Logical Volume expansion all , &NB Sp [[email protected] ~]# lvextend-l +100%free/dev/mapper/vg_rac01-logvol01 Size of logical volume VG_RAC01/LOGVOL01 changed from 11.80 Gib (3021 extents) to 19.80 Gib (5068 extents) . logical Volume LogVol01 successfully resized [[email protected] ~]# vgs vg #PV # LV #SN attr VSize vfree vg_rac01 2 2 0 wz--n-27.80g &n Bsp 0[[email protected] ~]# lvs lv VG Attr LSize Pool Origin data% meta% Move Log cpy%sync convert LogVol00 vg_rac01-wi-ao---- 8.00g &NBSP ;   LogVol01 vg_rac01-wi-ao----19.80g &NBS P , &NB Sp
[email protected] ~]# resize2fs/dev/mapper/vg_rac01-logvol01RESIZE2FS 1.41.12 (17-may-2010) Filesystem at/dev/mapper/vg_rac01-logvol01 is mounted on/; On-line resizing Requiredold desc_blocks = 1, new_desc_blocks = 2Performing an on-line resize OF/DEV/MAPPER/VG_RAC01-LOGV Ol01 to 5189632 (4k) blocks. The filesystem on/dev/mapper/vg_rac01-logvol01 is now 5189632 blocks long.
Linux root directory expansion