Pvdisplay command to display the properties of a physical volume
[Root@test ~]# Pvdisplay
---Physical volume---
PV name /dev/sda2
VG name vg_test
PV Size 9.51 gib/not usable 3.00 MiB
Allocatable Yes (but full)
pe Size 4.00 MiB Total
pe 2434 free
pe 0
allocated PE 2434
PV UUID uufpno-w0l9-8tly-fait-zzil-2rh4-suvk2z
---Physical volume---
PV Name /DEV/SDB1
VG Name vg_test
PV size 10.00 gib/not usable 4.70 MiB
allocatable Yes
PE size 4.00 MiB Total
pe 2558 free
PE 128
allocated PE 2430
PV UUID Vnl3ui-v9ks-0hjy-3zsb-r6dy-hgpt-gpufnm
Lvdisplay display Logical Volume related properties
[Root@test ~]# lvdisplay---Logical volume---lv path/dev/vg_test/lv_root LV Name Lv_root VG Name vg_test lv UUID w5fawq-dsx8-77fj-3ayl-swk5-mmb5-wrzm33 LV Write Access Read/write LV Creation host, time test.com, 2017-10-16 22:49:07 +0800 LV Status available # Ope N 1 LV Size 18.00 GiB current LE 4608 segments 2 Allocati On inherit Read ahead sectors auto-currently set to 256 block device 253:0---Lo Gical Volume---LV path/dev/vg_test/lv_swap LV Name lv_swap VG Name V G_test LV UUID jbqqai-od42-pk80-pzaf-ovbi-z9vh-xzr5co LV Write Access read/write LV creation h OST, Time test.com, 2017-10-16 22:49:09 +0800 LV Status available # open 1 LV Size 1.00 GiB CuRrent LE 256 Segments 1 allocation inherit Read ahead sectors Auto-cur
Rently set to 256 block device 253:1
/dev/sdb is a newly added hard disk
First create a new partition with the FDISK command
[Root@test ~]# Fdisk/dev/sdb Device contains neither a valid DOS partition table, nor Sun, SGI or OSF Disklabel
A new DOS disklabel with disk identifier 0xf5002802.
Changes'll remain in memory only, until you decide to write them.
After this, the course, the previous content won ' t be recoverable. Warning:invalid flag 0x0000 of partition Table 4 'll be 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 (comm
and ' U '). Command (M for help): N command action E extended P primary partition (1-4) p partition number (1-4): 1 A-CY Linder (1-652, default 1): Using default value 1 last cylinder, +cylinders or +size{k,m,g} (1-652, default 652): Using D Efault value 652 Command (M for help): T #修改分区格式 Selected partition 1 Hex code (type L to list codes): L #查看分区格式列表 0 Empty NEC DOS bayi Minix/olD Lin BF Solaris 1 FAT12 9 swap/so Linux C1 drdos/sec (FAT-2 Xenix root 3c PartitionMagic c4 drdos/sec (FAT-3 xenix usr venix 80286-os/2 hidden C: C6 drdos/sec (FAT-4 FAT16 <32m, PPC PReP Boot Linux Extended C7 Syrinx 5 Extended SFS NTFS volume set da non-fs data 6 FAT16 4d qnx4.x NTFS Volume set
DB cp/m/CTOs/. 7 Hpfs/ntfs 4e qnx4.x 2nd part Linux plaintext de Dell Utility 8 AIX 4f qnx4.x 3rd part 8e Linux LVM DF bootit 9 AIX bootable Ontrack DM Amoeba E1 DOS access a O S/2 Boot manag Wuyi ontrack DM6 Aux Amoeba BBT e3 DOS r/o b W95 FAT32 9f cp/m BSD /os e4 speedstor C W95 FAT32 (LBA) Ontrack DM6 Aux A0 IBM Thinkpad hi eb BeOS fs e W95 F At(LBA) OnTrackDM6 a5 FreeBSD ee GPT f W95 Ext ' d (LBA) ez-drive A6 OpenBSD EF EFI (fat-12/16/10 OPUS Golden Bow A7 NeXTSTEP f0 linux/pa-risc B-Hidden FAT1 2 5c Priam edisk A8 Darwin UFS F1 speedstor Compaq diagnost speedstor A9 NetBSD F4 SpeedStor Hidden FAT16 <3, GNU HURD or Sys ab Darwin boot f2 DOS secondary Hidden FAT16 Novell NetWare AF hfs/hfs+ FB VMware VMFS Hidden hpfs/ntf Novell NetWare B7 BSDI FS FC VMware Vmkcore/AST smartsleep disksecure mult b8 bsdi swap fd Linux RAID Auto 1b Hidden W95 FAT3 Pc/ix bb boot Wizard hid FE lanstep 1c Hidden W95 FAT3-old Minix to Solaris boot ff BBT 1e Hidden W95 FAT1 Hex code (type L to list codes): 8e #类型修改为8e Changed system type of Partition 1 to 8e (Linux LVM) Command (M for help): P disk/dev/sdb:5368 MB, 5368709120 bytes 255 heads, sectors/track 652 = Cylinders of 16065 * 8225280 bytes Sector size (logical/physical): bytes/512 bytes I/o size (minimum/optimal ): bytes/512 bytes Disk identifier:0xf5002802 Device Boot Start end Blocks Id system/dev/ SDB1 1 652 5237158+ 8e Linux LVM Command (M for help): W #保存 the partition table has been
altered!
Calling IOCTL () to re-read partition table.
Syncing disks.
Formal expansion operation
Mkfs-t ext4/dev/sdb1
pvcreate/dev/sdb1
vgdisplay
vgextend vg_test/dev/sdb1 #先扩展VG
lvdisplay
lvextend-l 9g/dev/vg_test/lv_root #扩展LV 9G for total size if it is added 4G can be written as +4g
resize2fs/dev/vg_test/lv_root
df-h< C9/>vgdisplay
lvdisplay
resize2fs/dev/vg_test/lv_root #resizes
df-h