<output id="qn6qe"></output>

    1. <output id="qn6qe"><tt id="qn6qe"></tt></output>
    2. <strike id="qn6qe"></strike>

      亚洲 日本 欧洲 欧美 视频,日韩中文字幕有码av,一本一道av中文字幕无码,国产线播放免费人成视频播放,人妻少妇偷人无码视频,日夜啪啪一区二区三区,国产尤物精品自在拍视频首页,久热这里只有精品12

      linux centos8 系統擴容 VMware Centos---VMware ESXi

      linux 系統擴容 VMware Centos---VMware ESXi

      用到的命令

      df  fdisk  pvcreate   pvdisplay    vgdisplay    vgextend    lvdisplay    lvextend  resize2fs

      01) 使用了一段時間虛擬機后發現磁盤不夠用了,需要擴容。在客戶端操作擴容出現磁盤已成功擴展。

      您必須從客戶機操作系統內部對磁盤重新進行分區和擴展文件系統。 然后進centos7系統進行操作

       

      02)  使用 df -h 查看磁盤空間大小

      1
      2
      3
      4
      5
      6
      7
      8
      9
      10
      ### 掛載跟目錄節點的 /dev/mapper/centos-root 只有23容量
      [root@localhost ~]# df -h
      Filesystem               Size  Used Avail Use% Mounted on
      /dev/mapper/centos-root   23G   23G   20K 100% /
      devtmpfs                  20G     0   20G   0% /dev
      tmpfs                     20G  4.0K   20G   1% /dev/shm
      tmpfs                     20G  8.5M   20G   1% /run
      tmpfs                     20G     0   20G   0% /sys/fs/cgroup
      /dev/sda1                497M  120M  378M  25% /boot
      [root@localhost ~]#

      03) 使用 fdisk -l 命令查看磁盤信息

      復制代碼
       1 ### 第一行 Disk /dev/sda: 107.4 GB 與實際 df -好現實內容不符,說明增加磁盤成功
       2 
       3 [root@localhost ~]# fdisk -l
       4 
       5 Disk /dev/sda: 107.4 GB, 107374182400 bytes, 209715200 sectors  ---與上面(df -h)不符,說明新增成功
       6 Units = sectors of 1 * 512 = 512 bytes
       7 Sector size (logical/physical): 512 bytes / 512 bytes
       8 I/O size (minimum/optimal): 512 bytes / 512 bytes
       9 Disk label type: dos
      10 Disk identifier: 0x0004148c
      11 
      12    Device Boot      Start         End      Blocks   Id  System
      13 /dev/sda1   *        2048     1026047      512000   83  Linux
      14 /dev/sda2         1026048    41943039    20458496   8e  Linux LVM
      15 /dev/sda3        41943040    52428799     5242880   8e  Linux LVM
      16 
      17 Disk /dev/mapper/centos-root: 24.1 GB, 24121442304 bytes, 47112192 sectors
      18 Units = sectors of 1 * 512 = 512 bytes
      19 Sector size (logical/physical): 512 bytes / 512 bytes
      20 I/O size (minimum/optimal): 512 bytes / 512 bytes
      21 
      22 
      23 Disk /dev/mapper/centos-swap: 2147 MB, 2147483648 bytes, 4194304 sectors
      24 Units = sectors of 1 * 512 = 512 bytes
      25 Sector size (logical/physical): 512 bytes / 512 bytes
      26 I/O size (minimum/optimal): 512 bytes / 512 bytes
      27 
      28 [root@localhost ~]#
      復制代碼

      04) 使用 fdisk /dev/sda 創建新的分區

      復制代碼
       1 ### 注意:不同操作系統的磁盤命名方式不同,有些是/dev/vda。
       2 ### 具體使用方式參考第三步中fdisk -l首行顯示Disk。
       3 ### 如筆者在該系統中首行顯示為Disk /dev/sda: 107.4 GB, 107374182400 bytes ,故使用命令fdisk /dev/sda)
       4 
       5 
       6 [root@localhost ~]# fdisk /dev/sda
       7 Welcome to fdisk (util-linux 2.23.2).
       8 
       9 Changes will remain in memory only, until you decide to write them.
      10 Be careful before using the write command.
      11 
      12 
      13 Command (m for help): m   ---------#幫助命令
      14 Command action
      15    a   toggle a bootable flag
      16    b   edit bsd disklabel
      17    c   toggle the dos compatibility flag
      18    d   delete a partition
      19    g   create a new empty GPT partition table
      20    G   create an IRIX (SGI) partition table
      21    l   list known partition types
      22    m   print this menu
      23    n   add a new partition
      24    o   create a new empty DOS partition table
      25    p   print the partition table
      26    q   quit without saving changes
      27    s   create a new empty Sun disklabel
      28    t   change a partition's system id
      29    u   change display/entry units
      30    v   verify the partition table
      31    w   write table to disk and exit
      32    x   extra functionality (experts only)
      33 
      34 Command (m for help): n  -----------#創建新分區
      35 Partition type:
      36    p   primary (3 primary, 0 extended, 1 free)
      37    e   extended
      38 Select (default e): p      -------#選擇主分區
      39 Selected partition 4
      40 First sector (52428800-209715199, default 52428800):   ---#回車使用默認
      41 Using default value 52428800
      42 Last sector, +sectors or +size{K,M,G} (52428800-209715199, default 209715199): ---#回車使用默認
      43 Using default value 209715199
      44 Partition 4 of type Linux and of size 75 GiB is set
      45 
      46 
      47 Command (m for help): t   --------------#修改分區類型
      48 Partition number (1-4, default 4):   ----------#回車使用默認值
      49 Hex code (type L to list all codes): 8e    -----#說明: 8e 是lvm磁盤類型
      50 Changed type of partition 'Linux' to 'Linux LVM'
      51 
      52 
      53 
      54 Command (m for help): p  ------#打印分區表
      55 
      56 Disk /dev/sda: 107.4 GB, 107374182400 bytes, 209715200 sectors
      57 Units = sectors of 1 * 512 = 512 bytes
      58 Sector size (logical/physical): 512 bytes / 512 bytes
      59 I/O size (minimum/optimal): 512 bytes / 512 bytes
      60 Disk label type: dos
      61 Disk identifier: 0x0004148c
      62 
      63    Device Boot      Start         End      Blocks   Id  System
      64 /dev/sda1   *        2048     1026047      512000   83  Linux
      65 /dev/sda2         1026048    41943039    20458496   8e  Linux LVM
      66 /dev/sda3        41943040    52428799     5242880   8e  Linux LVM
      67 /dev/sda4        52428800   209715199    78643200   8e  Linux LVM
      68 
      69 Command (m for help): w   -------#保存退出
      70 The partition table has been altered!
      71 
      72 Calling ioctl() to re-read partition table.
      73 
      74 WARNING: Re-reading the partition table failed with error 16: Device or resource busy.
      75 The kernel still uses the old table. The new table will be used at
      76 the next reboot or after you run partprobe(8) or kpartx(8)  ---#這里提示重啟系統
      77 Syncing disks
      復制代碼

      05)  重啟系統

      1
      [root@localhost ~]# reboot

      06)  查看磁盤情況

      復制代碼
       1 ### 核對剛才所做的分區操作是否保存成功
       2 
       3 [root@localhost ~]# fdisk -l
       4 
       5 Disk /dev/sda: 107.4 GB, 107374182400 bytes, 209715200 sectors
       6 Units = sectors of 1 * 512 = 512 bytes
       7 Sector size (logical/physical): 512 bytes / 512 bytes
       8 I/O size (minimum/optimal): 512 bytes / 512 bytes
       9 Disk label type: dos
      10 Disk identifier: 0x0004148c
      11 
      12    Device Boot      Start         End      Blocks   Id  System
      13 /dev/sda1   *        2048     1026047      512000   83  Linux
      14 /dev/sda2         1026048    41943039    20458496   8e  Linux LVM
      15 /dev/sda3        41943040    52428799     5242880   8e  Linux LVM
      16 /dev/sda4        52428800   209715199    78643200   8e  Linux LVM   ----#這里多出一塊,說明保存成功
      17 
      18 Disk /dev/mapper/centos-root: 24.1 GB, 24121442304 bytes, 47112192 sectors
      19 Units = sectors of 1 * 512 = 512 bytes
      20 Sector size (logical/physical): 512 bytes / 512 bytes
      21 I/O size (minimum/optimal): 512 bytes / 512 bytes
      22 
      23 
      24 Disk /dev/mapper/centos-swap: 2147 MB, 2147483648 bytes, 4194304 sectors
      25 Units = sectors of 1 * 512 = 512 bytes
      26 Sector size (logical/physical): 512 bytes / 512 bytes
      27 I/O size (minimum/optimal): 512 bytes / 512 bytes
      28 
      29 [root@localhost ~]#
      復制代碼

      07) 查看當前分區類型( 這里的類型會影響最后一步調整文件系統大小命令 xfs_growfs 還是  resize2fs  )

      [root@localhost ~]# df -T /dev/sda1
      Filesystem     Type 1K-blocks   Used Available Use% Mounted on
      /dev/sda1      xfs     508588 122080    386508  25% /boot
      [root@localhost ~]#

      08) 使用 pvcreate /dev/sda4 創建物理卷

      1 ###  /dev/sda4  這里的4是上面剛才新增的分區
      2 [root@localhost ~]# pvcreate /dev/sda4
      3   Physical volume "/dev/sda4" successfully created
      4 [root@localhost ~]#

      09)  使用pvdisplay 查看新建的物理卷大小

      復制代碼
       1 [root@localhost ~]# pvdisplay
       2   --- Physical volume ---
       3   PV Name               /dev/sda2
       4   VG Name               centos
       5   PV Size               19.51 GiB / not usable 3.00 MiB
       6   Allocatable           yes (but full)
       7   PE Size               4.00 MiB
       8   Total PE              4994
       9   Free PE               0
      10   Allocated PE          4994
      11   PV UUID               7q1DBZ-n5ZX-1OPX-IN9w-SdAp-qekM-BfpVbc
      12    
      13   --- Physical volume ---
      14   PV Name               /dev/sda3
      15   VG Name               centos
      16   PV Size               5.00 GiB / not usable 4.00 MiB
      17   Allocatable           yes 
      18   PE Size               4.00 MiB
      19   Total PE              1279
      20   Free PE               10
      21   Allocated PE          1269
      22   PV UUID               eOLd2K-aXSx-cA1M-hwJc-zqdq-7U4Y-ZE8d2R
      23    
      24   "/dev/sda4" is a new physical volume of "75.00 GiB"  ----------#可以看到新增的75G
      25   --- NEW Physical volume ---
      26   PV Name               /dev/sda4
      27   VG Name               
      28   PV Size               75.00 GiB
      29   Allocatable           NO
      30   PE Size               0   
      31   Total PE              0
      32   Free PE               0                    --------#現在這里看到的是0,在 lvextend 的時候還要重新查看
      33   Allocated PE          0
      34   PV UUID               wyG3ZO-e1a0-3OHW-6afy-u90w-7Lc8-ddMnJL
      35    
      36 [root@localhost ~]#
      復制代碼

      10)  使用 vgdisplay 查看 vg 狀態

      復制代碼
       1 [root@localhost ~]# vgdisplay 
       2   --- Volume group ---
       3   VG Name               centos    --------------#這個名字在下面會用到
       4   System ID             
       5   Format                lvm2
       6   Metadata Areas        2
       7   Metadata Sequence No  5
       8   VG Access             read/write
       9   VG Status             resizable
      10   MAX LV                0
      11   Cur LV                2
      12   Open LV               2
      13   Max PV                0
      14   Cur PV                2
      15   Act PV                2
      16   VG Size               24.50 GiB
      17   PE Size               4.00 MiB
      18   Total PE              6273
      19   Alloc PE / Size       6263 / 24.46 GiB
      20   Free  PE / Size       10 / 40.00 MiB
      21   VG UUID               q6Omkk-sEkn-Ex9Y-gfSY-0URm-4z2E-0u9Euj
      22    
      23 [root@localhost ~]#
      復制代碼

      11)  使用 vgextend centos /dev/sda4 將添加新的物理卷加載到 centos 卷組

      復制代碼
       1 ### centos 是我的服務器vg名稱,可以通過vgdisplay查看vg狀態得到名稱
       2 ### /dev/sda4 是我剛剛新增的物理卷
       3 [root@localhost ~]# vgextend centos /dev/sda4
       4   Volume group "centos" successfully extended
       5 [root@localhost ~]# 
       6 
       7 ###---------- 注意這里可以由于系統空間不足出現報錯 ------------
       8 ###---------- 手動去刪除些沒有用的文件 ------------
       9 ### 報錯內容
      10 ### [root@localhost ~]# vgextend centos /dev/sda4
      11 ###  Couldn't create temporary archive name.
      12 ###  Volume group "centos" metadata archive failed.
      13 ###  Internal error: Attempt to unlock unlocked VG #orphans.
      14 ### [root@localhost ~]# 
      15 ###
      16 
      17 [root@localhost ~]# vgextend centos /dev/sda4
      18   Couldn't create temporary archive name.
      19   Volume group "centos" metadata archive failed.
      20   Internal error: Attempt to unlock unlocked VG #orphans.
      21 [root@localhost ~]#
      復制代碼

      12)  使用 lvdisplay 查看 lv 狀態

      復制代碼
       1 [root@localhost ~]# lvdisplay
       2   --- Logical volume ---
       3   LV Path                /dev/centos/swap
       4   LV Name                swap
       5   VG Name                centos
       6   LV UUID                d39rhF-bGNs-fWPE-ItwX-FNQe-QJ4h-taAm94
       7   LV Write Access        read/write
       8   LV Creation host, time localhost, 2019-05-09 03:42:09 -0400
       9   LV Status              available
      10   # open                 2
      11   LV Size                2.00 GiB
      12   Current LE             512
      13   Segments               1
      14   Allocation             inherit
      15   Read ahead sectors     auto
      16   - currently set to     8192
      17   Block device           253:1
      18    
      19   --- Logical volume ---
      20   LV Path                /dev/centos/root
      21   LV Name                root
      22   VG Name                centos
      23   LV UUID                rvepaR-xSYs-hPOy-vPWA-Oiuh-A0Je-j29Gk1
      24   LV Write Access        read/write
      25   LV Creation host, time localhost, 2019-05-09 03:42:10 -0400
      26   LV Status              available
      27   # open                 1
      28   LV Size                22.46 GiB
      29   Current LE             5751
      30   Segments               2
      31   Allocation             inherit
      32   Read ahead sectors     auto
      33   - currently set to     8192
      34   Block device           253:0
      35    
      36 [root@localhost ~]#
      復制代碼

      13)   使用 lvextend 增加容量

      復制代碼
       1 ## 使用 df -h 可以看到 /dev/mapper/centos-root 的名字
       2  ## 使用 pvdisplay 再次查看 free 的PE數量
       3  [root@localhost data]# df -h
       4 Filesystem               Size  Used Avail Use% Mounted on
       5 /dev/mapper/centos-root   23G   23G   52K 100% /     -------# /dev/mapper/centos-root 這個名字要用
       6 devtmpfs                  20G     0   20G   0% /dev
       7 tmpfs                     20G  4.0K   20G   1% /dev/shm
       8 tmpfs                     20G  8.5M   20G   1% /run
       9 tmpfs                     20G     0   20G   0% /sys/fs/cgroup
      10 /dev/sda1                497M  120M  378M  25% /boot
      11 [root@localhost data]# 
      12 [root@localhost data]# pvdisplay
      13   --- Physical volume ---
      14   PV Name               /dev/sda2
      15   VG Name               centos
      16   PV Size               19.51 GiB / not usable 3.00 MiB
      17   Allocatable           yes (but full)
      18   PE Size               4.00 MiB
      19   Total PE              4994
      20   Free PE               0
      21   Allocated PE          4994
      22   PV UUID               7q1DBZ-n5ZX-1OPX-IN9w-SdAp-qekM-BfpVbc
      23    
      24   --- Physical volume ---
      25   PV Name               /dev/sda3
      26   VG Name               centos
      27   PV Size               5.00 GiB / not usable 4.00 MiB
      28   Allocatable           yes 
      29   PE Size               4.00 MiB
      30   Total PE              1279
      31   Free PE               10
      32   Allocated PE          1269
      33   PV UUID               eOLd2K-aXSx-cA1M-hwJc-zqdq-7U4Y-ZE8d2R
      34    
      35   --- Physical volume ---
      36   PV Name               /dev/sda4
      37   VG Name               centos
      38   PV Size               75.00 GiB / not usable 4.00 MiB
      39   Allocatable           yes 
      40   PE Size               4.00 MiB
      41   Total PE              19199
      42   Free PE               19199         --------#這個大小要用
      43   Allocated PE          0
      44   PV UUID               wyG3ZO-e1a0-3OHW-6afy-u90w-7Lc8-ddMnJL
      45    
      46 [root@localhost data]# 
      47 
      48  
      49 ###---------- 注意這里可以由于系統空間不足出現報錯 ------------
      50 ###---------- 手動去刪除些沒有用的文件 ------------
      51 ### 報錯內容
      52 ### [root@localhost ~]# lvextend -l +19199 /dev/mapper/centos-root 
      53 ###  Couldn't create temporary archive name.
      54 ###  Volume group "centos" metadata archive failed.
      55 ### [root@localhost ~]# 
      56 ###
      57 [root@localhost ~]# lvextend -l +19199 /dev/mapper/centos-root 
      58 Size of logical volume centos/root changed from 22.46 GiB (5751 extents) to 97.46 GiB (24950 extents).
      59   Logical volume root successfully resized
      60 [root@localhost ~]#
      復制代碼

      14-01)  查看當前分區類型(在下一步會用到)

      復制代碼
       1 ### 我的是 xfs 類型(centos7系統)
       2 [root@localhost ~]# df -T /dev/sda1
       3 Filesystem     Type 1K-blocks   Used Available Use% Mounted on
       4 /dev/sda1      xfs     508588 122080    386508  25% /boot
       5 [root@localhost ~]#
       6 
       7 ###-----------或者使用
       8 [root@localhost ~]# cat /etc/fstab | grep centos-root
       9 /dev/mapper/centos-root /                       xfs     defaults        0 0
      10 [root@localhost ~]# 
      復制代碼

      14-02)  使用 xfs_growfs (centos7)重新調整文件系統大小

      復制代碼
       1 ### centos7中用 xfs_growfs
       2 [root@localhost ~]# xfs_growfs /dev/mapper/centos-root
       3 meta-data=/dev/mapper/centos-root isize=256    agcount=6, agsize=1144832 blks
       4          =                       sectsz=512   attr=2, projid32bit=1
       5          =                       crc=0        finobt=0
       6 data     =                       bsize=4096   blocks=5889024, imaxpct=25
       7          =                       sunit=0      swidth=0 blks
       8 naming   =version 2              bsize=4096   ascii-ci=0 ftype=0
       9 log      =internal               bsize=4096   blocks=2560, version=2
      10          =                       sectsz=512   sunit=0 blks, lazy-count=1
      11 realtime =none                   extsz=4096   blocks=0, rtextents=0
      12 data blocks changed from 5889024 to 25548800
      13 [root@localhost ~]# 
      14 
      15 ### centos6中用 resize2fs
      16 [root@localhost ~]# resize2fs /dev/mapper/centos-root
      復制代碼

      15) 最后一步檢查磁盤空間,確認是否新增成功

      復制代碼
      1 root@localhost ~]# df -h
      2 Filesystem               Size  Used Avail Use% Mounted on
      3 /dev/mapper/centos-root   98G   23G   75G  24% /               ----#新增成功
      4 devtmpfs                  20G     0   20G   0% /dev
      5 tmpfs                     20G  4.0K   20G   1% /dev/shm
      6 tmpfs                     20G  8.5M   20G   1% /run
      7 tmpfs                     20G     0   20G   0% /sys/fs/cgroup
      8 /dev/sda1                497M  120M  378M  25% /boot
      9 [root@localhost ~]#
      復制代碼

       

      其他參考文章:    

      posted on   大飛_dafei  閱讀(753)  評論(0編輯  收藏  舉報

      	</p>
      </div>
      
      posted @ 2024-04-25 14:32  熱愛技術的小牛  閱讀(325)  評論(0)    收藏  舉報
      熱愛技術的小牛
      主站蜘蛛池模板: 国产精品中出一区二区三区| 人妻激情偷乱视频一区二区三区| 性xxxx视频播放免费| 久99久热精品免费视频| 亚洲伊人精品久视频国产| 精品人妻系列无码天堂| 99RE8这里有精品热视频| 韩国一级毛片中文字幕| 国产精品中文字幕av| 亚洲色av天天天天天天| 亚洲第一香蕉视频啪啪爽| 亚洲a免费| 强奷乱码欧妇女中文字幕熟女| 精品无码国产一区二区三区AV| 精品国产午夜福利在线观看| 欧美性受xxxx白人性爽| 四虎永久精品在线视频| 亚洲高清最新AV网站| 国产不卡一区二区在线| 国产精品黄色一区二区三区| 国产精品1区2区3区在线观看| 国产自产一区二区三区视频| 九九综合va免费看| 欧美牲交a欧美牲交aⅴ图片| 日韩有码中文字幕av| 四川丰满少妇无套内谢| 国产亚洲精品成人av一区| 日本丰满的人妻hd高清在线| 国产福利永久在线视频无毒不卡 | 精品人妻伦一二三区久久| 三上悠亚精品一区二区久久| 中文字幕亚洲综合第一页| 日韩精品一区二区三区激情视频 | 赣州市| 亚洲乱色一区二区三区丝袜| 91精品国产午夜福利| 国产AV福利第一精品| 国产精品国产精品无卡区| 国产成人a∨激情视频厨房| 国产在线精品一区二区夜色| 商洛市|