{"id":2882,"date":"2017-11-29T21:03:21","date_gmt":"2017-11-29T13:03:21","guid":{"rendered":"http:\/\/cn.hostease.com\/xueyuan\/?p=2882"},"modified":"2017-11-29T21:03:21","modified_gmt":"2017-11-29T13:03:21","slug":"centos7-x%e7%b3%bb%e7%bb%9f%e6%a0%b9%e7%9b%ae%e5%bd%95%e5%88%86%e5%8c%ba%e6%89%a9%e5%ae%b9","status":"publish","type":"post","link":"https:\/\/cn.hostease.com\/xueyuan\/uncategorized\/centos7-x%e7%b3%bb%e7%bb%9f%e6%a0%b9%e7%9b%ae%e5%bd%95%e5%88%86%e5%8c%ba%e6%89%a9%e5%ae%b9\/","title":{"rendered":"CentOS7.x\u7cfb\u7edf\u6839\u76ee\u5f55\u5206\u533a\u6269\u5bb9"},"content":{"rendered":"<p>\u8bf4\u660e\uff1a\u7cfb\u7edf\u7248\u672c\u4e3a Linux version 3.10.0-327.el7.x86_64<\/p>\n<p>step1. \u67e5\u770b\u73b0\u6709\u78c1\u76d8\u4fe1\u606f\uff0c\u53ef\u4ee5\u770b\u51fa\u6839\u5206\u533a\u670945G<\/p>\n<div class=\"linuxidc_code\">\n<pre>[root@www.linuxidc.com ~]# df -h\r\nFilesystem                           Size  Used Avail Use% Mounted on\r\n\/dev\/mapper\/<a title=\"CentOS\" href=\"https:\/\/www.linuxidc.com\/topicnews.aspx?tid=14\" target=\"_blank\">CentOS<\/a>_mb--centos7-root   45G  9.8G   35G  23% \/\r\ndevtmpfs                             5.9G     0  5.9G   0% \/dev\r\ntmpfs                                5.9G   84K  5.9G   1% \/dev\/shm\r\ntmpfs                                5.9G  8.9M  5.9G   1% \/run\r\ntmpfs                                5.9G     0  5.9G   0% \/sys\/fs\/cgroup\r\n\/dev\/sda1                            497M  142M  356M  29% \/boot\r\ntmpfs                                1.2G   16K  1.2G   1% \/run\/user\/42\r\ntmpfs                                1.2G     0  1.2G   0% \/run\/user\/0<\/pre>\n<\/div>\n<p>step2. \u67e5\u770b\u65b0\u589e\u52a0\u7684\u78c1\u76d8\u4fe1\u606f<\/p>\n<div class=\"linuxidc_code\">\n<pre>[root@www.linuxidc.com ~]# fdisk -l\r\n\r\nDisk \/dev\/sda: 53.7 GB, 53687091200 bytes, 104857600 sectors\r\nUnits = sectors of 1 * 512 = 512 bytes\r\nSector size (logical\/physical): 512 bytes \/ 512 bytes\r\nI\/O size (minimum\/optimal): 512 bytes \/ 512 bytes\r\nDisk label type: dos\r\nDisk identifier: 0x000e0945\r\n\r\n   Device Boot      Start         End      Blocks   Id  System\r\n\/dev\/sda1   *        2048     1026047      512000   83  Linux\r\n\/dev\/sda2         1026048   104857599    51915776   8e  Linux LVM\r\n\r\nDisk \/dev\/sdb: 107.4 GB, 107374182400 bytes, 209715200 sectors\r\nUnits = sectors of 1 * 512 = 512 bytes\r\nSector size (logical\/physical): 512 bytes \/ 512 bytes\r\nI\/O size (minimum\/optimal): 512 bytes \/ 512 bytes\r\n\r\n\r\nDisk \/dev\/mapper\/centos_mb--centos7-root: 47.7 GB, 47747956736 bytes, 93257728 sectors\r\nUnits = sectors of 1 * 512 = 512 bytes\r\nSector size (logical\/physical): 512 bytes \/ 512 bytes\r\nI\/O size (minimum\/optimal): 512 bytes \/ 512 bytes\r\n\r\n\r\nDisk \/dev\/mapper\/centos_mb--centos7-swap: 5368 MB, 5368709120 bytes, 10485760 sectors\r\nUnits = sectors of 1 * 512 = 512 bytes\r\nSector size (logical\/physical): 512 bytes \/ 512 bytes\r\nI\/O size (minimum\/optimal): 512 bytes \/ 512 bytes<\/pre>\n<\/div>\n<p>step3.\u00a0\u6839\u636e\u4ee5\u4e0a\u4fe1\u606f\uff0c\u5bf9\u65b0\u589e\u52a0\u7684\u78c1\u76d8\u8fdb\u884c\u5206\u533a<\/p>\n<div class=\"linuxidc_code\">\n<pre>[root@www.linuxidc.com ~]# fdisk \/dev\/sdb\r\nWelcome to fdisk (util-linux 2.23.2).\r\n\r\nChanges will remain in memory only, until you decide to write them.\r\nBe careful before using the write command.\r\n\r\nDevice does not contain a recognized partition table\r\nBuilding a new DOS disklabel with disk identifier 0x232defba.\r\n\r\nCommand (m for help): p\r\n\r\nDisk \/dev\/sdb: 107.4 GB, 107374182400 bytes, 209715200 sectors\r\nUnits = sectors of 1 * 512 = 512 bytes\r\nSector size (logical\/physical): 512 bytes \/ 512 bytes\r\nI\/O size (minimum\/optimal): 512 bytes \/ 512 bytes\r\nDisk label type: dos\r\nDisk identifier: 0x232defba\r\n\r\n   Device Boot      Start         End      Blocks   Id  System\r\n\r\nCommand (m for help): n\r\nPartition type:\r\n   p   primary (0 primary, 0 extended, 4 free)\r\n   e   extended\r\nSelect (default p): p\r\nPartition number (1-4, default 1): 1\r\nFirst sector (2048-209715199, default 2048): \r\nUsing default value 2048\r\nLast sector, +sectors or +size{K,M,G} (2048-209715199, default 209715199): \r\nUsing default value 209715199\r\nPartition 1 of type Linux and of size 100 GiB is set\r\n\r\nCommand (m for help): t\r\nSelected partition 1\r\nHex code (type L to list all codes): L\r\n\r\n 0  Empty           24  NEC DOS         81  Minix \/ old Lin bf  Solaris        \r\n 1  FAT12           27  Hidden NTFS Win 82  Linux swap \/ So c1  DRDOS\/sec (FAT-\r\n 2  XENIX root      39  Plan 9          83  Linux           c4  DRDOS\/sec (FAT-\r\n 3  XENIX usr       3c  PartitionMagic  84  OS\/2 hidden C:  c6  DRDOS\/sec (FAT-\r\n 4  FAT16 &lt;32M      40  Venix 80286     85  Linux extended  c7  Syrinx         \r\n 5  Extended        41  PPC PReP Boot   86  NTFS volume set da  Non-FS data    \r\n 6  FAT16           42  SFS             87  NTFS volume set db  CP\/M \/ CTOS \/ .\r\n 7  HPFS\/NTFS\/exFAT 4d  QNX4.x          88  Linux plaintext de  Dell Utility   \r\n 8  AIX             4e  QNX4.x 2nd part 8e  Linux LVM       df  BootIt         \r\n 9  AIX bootable    4f  QNX4.x 3rd part 93  Amoeba          e1  DOS access     \r\n a  OS\/2 Boot Manag 50  OnTrack DM      94  Amoeba BBT      e3  DOS R\/O        \r\n b  W95 FAT32       51  OnTrack DM6 Aux 9f  BSD\/OS          e4  SpeedStor      \r\n c  W95 FAT32 (LBA) 52  CP\/M            a0  IBM Thinkpad hi eb  BeOS fs        \r\n e  W95 FAT16 (LBA) 53  OnTrack DM6 Aux a5  FreeBSD         ee  GPT            \r\n f  W95 Ext'd (LBA) 54  OnTrackDM6      a6  OpenBSD         ef  EFI (FAT-12\/16\/\r\n10  OPUS            55  EZ-Drive        a7  NeXTSTEP        f0  Linux\/PA-RISC b\r\n11  Hidden FAT12    56  Golden Bow      a8  Darwin UFS      f1  SpeedStor      \r\n12  Compaq diagnost 5c  Priam Edisk     a9  NetBSD          f4  SpeedStor      \r\n14  Hidden FAT16 &lt;3 61  SpeedStor       ab  Darwin boot     f2  DOS secondary  \r\n16  Hidden FAT16    63  GNU HURD or Sys af  HFS \/ HFS+      fb  VMware VMFS    \r\n17  Hidden HPFS\/NTF 64  Novell Netware  b7  BSDI fs         fc  VMware VMKCORE \r\n18  AST SmartSleep  65  Novell Netware  b8  BSDI swap       fd  Linux raid auto\r\n1b  Hidden W95 FAT3 70  DiskSecure Mult bb  Boot Wizard hid fe  LANstep        \r\n1c  Hidden W95 FAT3 75  PC\/IX           be  Solaris boot    ff  BBT            \r\n1e  Hidden W95 FAT1 80  Old Minix      \r\nHex code (type L to list all codes): 8e\r\nChanged type of partition 'Linux' to 'Linux LVM'\r\n\r\nCommand (m for help): p\r\n\r\nDisk \/dev\/sdb: 107.4 GB, 107374182400 bytes, 209715200 sectors\r\nUnits = sectors of 1 * 512 = 512 bytes\r\nSector size (logical\/physical): 512 bytes \/ 512 bytes\r\nI\/O size (minimum\/optimal): 512 bytes \/ 512 bytes\r\nDisk label type: dos\r\nDisk identifier: 0x232defba\r\n\r\n   Device Boot      Start         End      Blocks   Id  System\r\n\/dev\/sdb1            2048   209715199   104856576   8e  Linux LVM\r\n\r\nCommand (m for help): w\r\nThe partition table has been altered!\r\n\r\nCalling ioctl() to re-read partition table.\r\nSyncing disks.<\/pre>\n<\/div>\n<p>step4.\u00a0\u521b\u5efa\u7269\u7406\u5377<\/p>\n<div class=\"linuxidc_code\">\n<pre>[root@www.linuxidc.com ~]# pvcreate \/dev\/sdb1\r\n  Physical volume \"\/dev\/sdb1\" successfully created<\/pre>\n<\/div>\n<p>step5.\u00a0\u67e5\u770b\u7269\u7406\u5377\u4fe1\u606f<\/p>\n<div class=\"linuxidc_code\">\n<pre>[root@www.linuxidc.com ~]# pvdisplay\r\n  --- Physical volume ---\r\n  PV Name               \/dev\/sda2\r\n  VG Name               centos_mb-centos7\r\n  PV Size               49.51 GiB \/ not usable 3.00 MiB\r\n  Allocatable           yes \r\n  PE Size               4.00 MiB\r\n  Total PE              12674\r\n  Free PE               10\r\n  Allocated PE          12664\r\n  PV UUID               8WbgjB-T1Lf-kqUD-qPFw-UwJu-B9Lc-GAUTUB\r\n   \r\n  \"\/dev\/sdb1\" is a new physical volume of \"100.00 GiB\"\r\n  --- NEW Physical volume ---\r\n  PV Name               \/dev\/sdb1\r\n  VG Name               \r\n  PV Size               100.00 GiB\r\n  Allocatable           NO\r\n  PE Size               0   \r\n  Total PE              0\r\n  Free PE               0\r\n  Allocated PE          0\r\n  PV UUID               HOknRs-TnMy-wtfX-sGqD-5RK9-dk9q-ze13fj<\/pre>\n<div class=\"linuxidc_code_toolbar\"><\/div>\n<\/div>\n<div class=\"linuxidc_code\">\n<div class=\"linuxidc_code_toolbar\"><\/div>\n<pre>[root@www.linuxidc.com ~]# vgdisplay\r\n  --- Volume group ---\r\n  VG Name               centos_mb-centos7\r\n  System ID             \r\n  Format                lvm2\r\n  Metadata Areas        1\r\n  Metadata Sequence No  3\r\n  VG Access             read\/write\r\n  VG Status             resizable\r\n  MAX LV                0\r\n  Cur LV                2\r\n  Open LV               2\r\n  Max PV                0\r\n  Cur PV                1\r\n  Act PV                1\r\n  VG Size               49.51 GiB\r\n  PE Size               4.00 MiB\r\n  Total PE              12674\r\n  Alloc PE \/ Size       12664 \/ 49.47 GiB\r\n  Free  PE \/ Size       10 \/ 40.00 MiB\r\n  VG UUID               aN2D2P-Rk1y-wGFz-5l2I-5CcD-7s88-Z8czc7<\/pre>\n<\/div>\n<p>step6.\u00a0\u5c06\u65b0\u589e\u52a0\u7684\u5206\u533a\/dev\/sdb1\u52a0\u5165\u5230\u6839\u76ee\u5f55\u5206\u533acentos_mb-centos7\u4e2d<\/p>\n<div class=\"linuxidc_code\">\n<pre>[root@www.linuxidc.com ~]# vgextend centos_mb-centos7 \/dev\/sdb1\r\n  Volume group \"centos_mb-centos7\" successfully extended<\/pre>\n<\/div>\n<p>step7.\u00a0\u91cd\u65b0\u67e5\u770b\u5377\u7ec4\u4fe1\u606f<\/p>\n<div class=\"linuxidc_code\">\n<pre>[root@www.linuxidc.com ~]# vgdisplay\r\n  --- Volume group ---\r\n  VG Name               centos_mb-centos7\r\n  System ID             \r\n  Format                lvm2\r\n  Metadata Areas        2\r\n  Metadata Sequence No  4\r\n  VG Access             read\/write\r\n  VG Status             resizable\r\n  MAX LV                0\r\n  Cur LV                2\r\n  Open LV               2\r\n  Max PV                0\r\n  Cur PV                2\r\n  Act PV                2\r\n  VG Size               149.50 GiB\r\n  PE Size               4.00 MiB\r\n  Total PE              38273\r\n  Alloc PE \/ Size       12664 \/ 49.47 GiB\r\n  Free  PE \/ Size       25609 \/ 100.04 GiB\r\n  VG UUID               aN2D2P-Rk1y-wGFz-5l2I-5CcD-7s88-Z8czc7<\/pre>\n<\/div>\n<p>step9.\u00a0\u8fdb\u884c\u5377\u6269\u5bb9<\/p>\n<div class=\"linuxidc_code\">\n<pre>[root@www.linuxidc.com ~]# lvextend -l +100%FREE \/dev\/mapper\/centos_mb--centos7-root\r\n  Size of logical volume centos_mb-centos7\/root changed from 44.47 GiB (11384 extents) to 144.50 GiB (36993 extents).\r\n  Logical volume root successfully resized.<\/pre>\n<\/div>\n<p>step10.\u00a0\u8c03\u6574\u5377\u5206\u533a\u5927\u5c0f<\/p>\n<div class=\"linuxidc_code\">\n<pre>[root@www.linuxidc.com ~]# xfs_growfs \/dev\/mapper\/centos_mb--centos7-root\r\nmeta-data=\/dev\/mapper\/centos_mb--centos7-root isize=256    agcount=4, agsize=2914304 blks\r\n         =                       sectsz=512   attr=2, projid32bit=1\r\n         =                       crc=0        finobt=0\r\ndata     =                       bsize=4096   blocks=11657216, imaxpct=25\r\n         =                       sunit=0      swidth=0 blks\r\nnaming   =version 2              bsize=4096   ascii-ci=0 ftype=0\r\nlog      =internal               bsize=4096   blocks=5692, version=2\r\n         =                       sectsz=512   sunit=0 blks, lazy-count=1\r\nrealtime =none                   extsz=4096   blocks=0, rtextents=0\r\ndata blocks changed from 11657216 to 37880832<\/pre>\n<\/div>\n<p>\u6700\u540e\uff0c\u67e5\u770b\u78c1\u76d8\u4fe1\u606f\u53ef\u4ee5\u770b\u51fa\u6839\u76ee\u5f55\u5206\u533a\u5927\u5c0f\u5df2\u6210\u529f\u6269\u5bb9<\/p>\n<div class=\"linuxidc_code\">\n<pre>[root@www.linuxidc.com ~]# df -h\r\nFilesystem                           Size  Used Avail Use% Mounted on\r\n\/dev\/mapper\/centos_mb--centos7-root  145G  9.8G  135G   7% \/\r\ndevtmpfs                             5.9G     0  5.9G   0% \/dev\r\ntmpfs                                5.9G   84K  5.9G   1% \/dev\/shm\r\ntmpfs                                5.9G  8.9M  5.9G   1% \/run\r\ntmpfs                                5.9G     0  5.9G   0% \/sys\/fs\/cgroup\r\n\/dev\/sda1                            497M  142M  356M  29% \/boot\r\ntmpfs                                1.2G   16K  1.2G   1% \/run\/user\/42\r\ntmpfs                                1.2G     0  1.2G   0% \/run\/user\/0<\/pre>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>\u8bf4\u660e\uff1a\u7cfb\u7edf\u7248\u672c\u4e3a Linux version 3.10.0-327.el7.x86_64 step1. \u67e5\u770b\u73b0 &#8230; <a title=\"CentOS7.x\u7cfb\u7edf\u6839\u76ee\u5f55\u5206\u533a\u6269\u5bb9\" class=\"read-more\" href=\"https:\/\/cn.hostease.com\/xueyuan\/uncategorized\/centos7-x%e7%b3%bb%e7%bb%9f%e6%a0%b9%e7%9b%ae%e5%bd%95%e5%88%86%e5%8c%ba%e6%89%a9%e5%ae%b9\/\" aria-label=\"\u9605\u8bfb CentOS7.x\u7cfb\u7edf\u6839\u76ee\u5f55\u5206\u533a\u6269\u5bb9\">\u9605\u8bfb\u66f4\u591a<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[1],"tags":[788],"class_list":["post-2882","post","type-post","status-publish","format-standard","hentry","category-uncategorized","tag-java"],"aioseo_notices":[],"jetpack_featured_media_url":"","jetpack-related-posts":[],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/posts\/2882","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/comments?post=2882"}],"version-history":[{"count":1,"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/posts\/2882\/revisions"}],"predecessor-version":[{"id":2883,"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/posts\/2882\/revisions\/2883"}],"wp:attachment":[{"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/media?parent=2882"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/categories?post=2882"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/cn.hostease.com\/xueyuan\/wp-json\/wp\/v2\/tags?post=2882"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}