In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-04-05 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
In this issue, the editor will bring you about how to dynamically expand LVM in CentOS7. The article is rich in content and analyzes and narrates it from a professional point of view. I hope you can get something after reading this article.
problem
The disk space on CentOS7 is a little tight and needs to be expanded.
Solve the problem of querying the current disk status [root@xxx ~] # lsblkNAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTfd0 2:0 1 4K 0 disk sda 8:0 0200G 0 disk ├─ sda1 8:1 0500M 0 part / boot └─ sda2 8:2 015.5G 0 part ├─ centos-swap 253G01.6G 0 lvm [SWAP] └─ centos-root 253 lvm 1 0 13.9 G 0 lvm / sr0 11:0 1 1024M 0 rom loop0 7:0 0 4.3G 0 loop / mnt/iso query current file system status [root@xxx] # df-h File system capacity used available mount point / dev/mapper/centos-root 14G 14G 20K 100% / Devtmpfs 3.8G 0 3.8G 0% / devtmpfs 3.9G 0 3.9G 0% / dev/shmtmpfs 3.9G 442M 3.4G 12% / runtmpfs 3.9G 03.9G 0% / sys/fs/cgroup/dev/sda1 497M 295m 202m 60% / boottmpfs 782m 12K 782m 1% / run/user/42/dev/loop0 4.3G 4.3G 0% / mnt/isotmpfs 782m 0782m 0% / run/user/0 View current disk partitions [root@xxx ~] # gdisk / dev/sdaGPT fdisk (gdisk) version 0.8.10Partition table scan: MBR: MBR only BSD: not present APM: Not present GPT: not present***Found invalid GPT and valid MBR Converting MBR to GPT formatin memory. THIS OPERATION IS POTENTIALLY DESTRUCTIVE! Exit bytyping 'q' if you don't want to convert your MBR partitionsto GPT formatting commands (? For help): pDisk / dev/sda: 419430400 sectors, 200.0 GiBLogical sector size: 512 bytesDisk identifier (GUID): FE64D670-2841-445E-974F-12A258105C57Partition table holds up to 128 entriesFirst usable sector is 34 Last usable sector is 419430366Partitions will be aligned on 2048-sector boundariesTotal free space is 385877949 sectors (184.0 GiB) Number Start (sector) End (sector) Size Code Name 1 2048 1026047 500.0 MiB 8300 Linux filesystem 2 1026048 33554431 15.5 GiB 8E00 Linux LVMlvm expansion create 8e [root@xxx] # gdisk / dev/sdaGPT fdisk (gdisk) version 0.8.10Partition table scan: MBR: MBR only BSD : not present APM: not present GPT: not present***Found invalid GPT and valid MBR Converting MBR to GPT formatin memory. THIS OPERATION IS POTENTIALLY DESTRUCTIVE! Exit bytyping 'q' if you don't want to convert your MBR partitionsto GPT formatting commands (? For help): nPartition number (3128, default 3): First sector (34-419430366, default = 33554432) or {+ -} size {KMGTP}: Last sector (33554432-419430366, default = 419430366) or {+ -} size {KMGTP}: + 84GCurrent type is' Linux filesystem'Hex code or GUID (L to show codes) Enter = 8300): L0700 Microsoft basic data 0c01 Microsoft reserved 2700 Windows RE 3000 ONIE boot 3001 ONIE config 4100 PowerPC PReP boot 4200 Windows LDM data 4201 Windows LDM metadata 7501 IBM GPFS 7f00 ChromeOS kernel 7f01 ChromeOS root 7f02 ChromeOS reserved 8200 Linux swap 8300 Linux filesystem 8301 Linux reserved 8302 Linux / home 8400 Intel Rapid Start 8e00 Linux LVM a500 FreeBSD Disklabel a501 FreeBSD boot a502 FreeBSD swap a503 FreeBSD UFS a504 FreeBSD ZFS a505 FreeBSD Vinum/RAID a580 Midnight BSD data a581 Midnight BSD boot a582 Midnight BSD swap a583 Midnight BSD UFS a584 Midnight BSD ZFS a585 Midnight BSD Vinum a800 Apple UFS a901 NetBSD swap a902 NetBSD FFS a903 NetBSD LFS a904 NetBSD concatenated a905 NetBSD encrypted a906 NetBSD RAID ab00 Apple Boot af00 Apple HFS/HFS+ af01 Apple RAID af02 Apple RAID offline af03 Apple label af04 AppleTV recovery af05 Apple Core Storage be00 Solaris boot bf00 Solaris root bf01 Solaris / usr & Mac Z bf02 Solaris swap bf03 Solaris backup bf04 Solaris / var bf05 Solaris / home bf06 Solaris alternate se bf07 Solaris Reserved 1 bf08 Solaris Reserved 2 bf09 Solaris Reserved 3 bf0a Solaris Reserved 4 bf0b Solaris Reserved 5 c001 HP- UX data c002 HP-UX service ea00 Freedesktop $BOOT eb00 Haiku BFS ed00 Sony system partitio ed01 Lenovo system partitPress the key to see more codes: 8e00ef00 EFI System ef01 MBR partition scheme ef02 BIOS boot partition fb00 VMWare VMFS fb01 VMWare reserved fc00 VMWare kcore crash pfd00 Linux RAID Hex code or GUID (L to show codes Enter = 8300): 8e00Changed type of partition to 'Linux LVM'Command (? For help): pDisk / dev/sda: 419430400 sectors, 200.0 GiBLogical sector size: 512 bytesDisk identifier (GUID): F8A75D30-20AF-412A-A7CD-F66D4A57D232Partition table holds up to 128 entriesFirst usable sector is 34 Last usable sector is 419430366Partitions will be aligned on 2048-sector boundariesTotal free space is 209717181 sectors (100.0 GiB) Number Start (sector) End (sector) Size Code Name 1 2048 1026047 500.0 MiB 8300 Linux filesystem 2 1026048 33554431 15.5 GiB 8E00 Linux LVM 3 33554432 209715199 84.0 GiB 8E00 Linux LVMCommand (? For help): wFinal checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTINGPARTITIONS!!Do you want to proceed? (y) N: yOK; writing new GUID partition table (GPT) to / dev/sda.Warning: The kernel is still using the old partition table.The new table will be used at the next reboot.The operation has completed successfully.
What needs to be noted here is the expansion of 84G and the use of 8e00.
Update 8e [root@xxx ~] # partprobe-s/dev/sda: gpt partitions 1 2 3 [root@xxx ~] # lsblkNAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTfd0 2:0 1 4K 0 disk sda 8:0 0200G 0 disk ├─ sda1 8:1 0500M 0 part / boot ├─ sda2 8:2 015.5G 0 part │ ├─ centos-swap : 0 01.6G 0 lvm [SWAP] │ └─ centos-root 253 lvm 1 013.9G 0 lvm / └─ sda3 8:3 084G 0 part sr0 11:0 1 1024M 0 rom loop0 7:0 04.3G 0 loop / mnt/iso Verification 8e [root @ xxx ~] # gdisk-l / dev/sdaGPT fdisk (gdisk) version 0.8.10Partition table scan: MBR: protective BSD : not present APM: not present GPT: presentFound valid GPT with protective MBR Using GPT.Disk / dev/sda: 419430400 sectors, 200.0 GiBLogical sector size: 512 bytesDisk identifier (GUID): F8A75D30-20AF-412A-A7CD-F66D4A57D232Partition table holds up to 128 entriesFirst usable sector is 34 Last usable sector is 419430366Partitions will be aligned on 2048-sector boundariesTotal free space is 209717181 sectors (100.0 GiB) Number Start (sector) End (sector) Size Code Name 1 2048 1026047 500.0 MiB 8300 Linux filesystem 2 1026048 33554431 15.5 GiB 8E00 Linux LVM 3 33554432 209715199 84.0 GiB 8E00 Linux LVMPV stage existing PV [root@xxx] # pvdisplay-- Physical volume-PV Name / dev/sda2 VG Name centos PV Size 15.51 GiB / not usable 3.00 MiB Allocatable yes (but full) PE Size 4.00 MiB Total PE 3970 Free PE 0 Allocated PE 3970 PV UUID S13vMN-W0wQ-HCae-fPKa-bClZ-RzW0-39xc9C
Now the size of the PV is 15G.
Create PV [root@xxx ~] # pvcreate / dev/sda3 Physical volume "/ dev/sda3" successfully created. Verify PV[ xxx @ root ~] # pvdisplay-Physical volume-PV Name / dev/sda2 VG Name centos PV Size 15.51 GiB / not usable 3.00 MiB Allocatable yes (but full) PE Size 4.00 MiB Total PE 3970 Free PE 0 Allocated PE 3970 PV UUID S13vMN-W0wQ-HCae-fPKa-bClZ-RzW0-39xc9C "/ dev/sda3" is a new physical volume of "84.00 GiB"-NEW Physical volume-PV Name / dev/sda3 VG Name PV Size 84.00 GiB Allocatable NO PE Size 0 Total PE 0 Free PE 0 Allocated PE 0 PV UUID Ssb5Y6-gD5q-heAE-sil9-oIU3-kdX8-B0pqLSVG stage VG [root@xxx] # vgdisplay-Volume group-VG Name centos 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 2 Max PV 0 Cur PV 1 Act PV 1 VG Size
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.