zoukankan      html  css  js  c++  java
  • 虚拟机扩容(/dev/mapper/centos-root 空间不足)

    1:.首先查看我们的根分区大小是多少

     df -h
    文件系统                类型      容量  已用  可用 已用% 挂载点
    /dev/mapper/centos-root xfs        18G  1.1G   17G    6% /
    devtmpfs                devtmpfs  479M     0  479M    0% /dev
    tmpfs                   tmpfs     489M     0  489M    0% /dev/shm
    tmpfs                   tmpfs     489M  6.7M  483M    2% /run
    tmpfs                   tmpfs     489M     0  489M    0% /sys/fs/cgroup
    /dev/sda1               xfs       497M  125M  373M   25% /boot
    tmpfs                   tmpfs      98M     0   98M    0% /run/user/0
     
    2:在虚拟机中添加一块物理的磁盘,重起虚拟机。
    3:查看磁盘编号
    ls /dev/sd*

    /dev/sda  /dev/sda1  /dev/sda2  /dev/sdb

    4:创建pv

    pvcreate /dev/sdb

    Physical volume "/dev/sdb" successfully created

    5:把pv加入vg中,相当于扩充vg的大小

        先使用vgs查看vg组

    vgs

    VG #PV #LV #SN Attr VSize VFree
    centos 2 2 0 wz--n- 59.50g 20.04g

     扩展vg,使用vgextend命令

     vgextend centos /dev/sdb

    6 :我们成功把vg卷扩展了,在用vgs查看一下

    vgs
    VG     #PV #LV #SN Attr   VSize  VFree
    centos   2   2   0 wz--n- 39.50g 20.04g
    lvs

    LV   VG     Attr       LSize  Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert

      root centos -wi-ao---- 17.47g                                                   
      swap centos -wi-ao----  2.00g  虽然我们把vg扩展了,但是lv还没有扩展
     
    7:扩展lv,使用lvextend命令
    lvextend -L +20G /dev/mapper/centos-root
    Size of logical volume centos/root changed from 17.47 GiB (4472 extents) to 37.47 GiB (9592 extents).
    Logical volume root successfully resized
     
    8: 命令使系统重新读取大小
    xfs_growfs /dev/mapper/centos-root
    meta-data=/dev/mapper/centos-root isize=256    agcount=4, agsize=1144832 blks
             =                       sectsz=512   attr=2, projid32bit=1
             =                       crc=0        finobt=0
    data     =                       bsize=4096   blocks=4579328, imaxpct=25
             =                       sunit=0      swidth=0 blks
    naming   =version 2              bsize=4096   ascii-ci=0 ftype=0
    log      =internal               bsize=4096   blocks=2560, version=2
             =                       sectsz=512   sunit=0 blks, lazy-count=1
    realtime =none                   extsz=4096   blocks=0, rtextents=0
    data blocks changed from 4579328 to 9822208
     
    9:再使用df  -h查看
    df -h
    文件系统                 容量  已用  可用 已用% 挂载点
    /dev/mapper/centos-root   38G  1.1G   37G    3% /
    devtmpfs                 479M     0  479M    0% /dev
    tmpfs                    489M     0  489M    0% /dev/shm
    tmpfs                    489M  6.7M  483M    2% /run
    tmpfs                    489M     0  489M    0% /sys/fs/cgroup
    /dev/sda1                497M  125M  373M   25% /boot
    tmpfs                     98M     0   98M    0% /run/user/0
     
  • 相关阅读:
    CSS3圆角详解
    纯CSS绘制三角形(各种角度)
    jquery实现文字上下无缝滚动
    选择select里面某个option触发的事件
    倒计时
    移动端弹出层加遮罩后禁止滑动
    终端连接oschina 生成SSH公钥
    兼容所有的浏览器透明度代码
    背景颜色渐变效果设置
    Linux下搜索文件命令whereis/which/find/locate
  • 原文地址:https://www.cnblogs.com/feiyun126/p/7680534.html
Copyright © 2011-2022 走看看