zoukankan      html  css  js  c++  java
  • LVM扩容根分区

    LVM扩容根分区

    原/目录有100G,现将根目录增加至150G

    [root@proftp ~]# df -Th
    文件系统                类型      容量  已用  可用 已用% 挂载点
    /dev/mapper/centos-root xfs        92G  3.0G   89G    4% /
    devtmpfs                devtmpfs  3.9G     0  3.9G    0% /dev
    tmpfs                   tmpfs     3.9G     0  3.9G    0% /dev/shm
    tmpfs                   tmpfs     3.9G   25M  3.8G    1% /run
    tmpfs                   tmpfs     3.9G     0  3.9G    0% /sys/fs/cgroup
    /dev/vda1               xfs      1014M  143M  872M   15% /boot
    tmpfs                   tmpfs     781M     0  781M    0% /run/user/0
    [root@proftp ~]# lsblk
    NAME            MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
    fd0               2:0    1    4K  0 disk
    sr0              11:0    1 1024M  0 rom
    vda             252:0    0  150G  0 disk
    ├─vda1          252:1    0    1G  0 part /boot
    └─vda2          252:2    0   99G  0 part
      ├─centos-root 253:0    0 91.1G  0 lvm  /
      └─centos-swap 253:1    0  7.9G  0 lvm  [SWAP]
    [root@proftp ~]# fdisk /dev/vda
    欢迎使用 fdisk (util-linux 2.23.2)。
    
    更改将停留在内存中,直到您决定将更改写入磁盘。
    使用写入命令前请三思。
    
    
    命令(输入 m 获取帮助):n
    Partition type:
       p   primary (2 primary, 0 extended, 2 free)
       e   extended
    Select (default p):
    Using default response p
    分区号 (3,4,默认 3):
    起始 扇区 (209715200-314572799,默认为 209715200):
    将使用默认值 209715200
    Last 扇区, +扇区 or +size{K,M,G} (209715200-314572799,默认为 314572799):
    将使用默认值 314572799
    分区 3 已设置为 Linux 类型,大小设为 50 GiB
    
    命令(输入 m 获取帮助):w
    The partition table has been altered!
    
    Calling ioctl() to re-read partition table.
    
    WARNING: Re-reading the partition table failed with error 16: 设备或资源忙.
    The kernel still uses the old table. The new table will be used at
    the next reboot or after you run partprobe(8) or kpartx(8)
    正在同步磁盘。
    [root@proftp ~]# lsblk
    NAME            MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
    fd0               2:0    1    4K  0 disk
    sr0              11:0    1 1024M  0 rom
    vda             252:0    0  150G  0 disk
    ├─vda1          252:1    0    1G  0 part /boot
    └─vda2          252:2    0   99G  0 part
      ├─centos-root 253:0    0 91.1G  0 lvm  /
      └─centos-swap 253:1    0  7.9G  0 lvm  [SWAP]
    [root@proftp ~]# partprobe /dev/vda
    [root@proftp ~]#
    [root@proftp ~]# lsblk
    NAME            MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
    fd0               2:0    1    4K  0 disk
    sr0              11:0    1 1024M  0 rom
    vda             252:0    0  150G  0 disk
    ├─vda1          252:1    0    1G  0 part /boot
    ├─vda2          252:2    0   99G  0 part
    │ ├─centos-root 253:0    0 91.1G  0 lvm  /
    │ └─centos-swap 253:1    0  7.9G  0 lvm  [SWAP]
    └─vda3          252:3    0   50G  0 part
    [root@proftp ~]#
    [root@proftp ~]# vgs
      VG     #PV #LV #SN Attr   VSize   VFree
      centos   1   2   0 wz--n- <99.00g 4.00m
    [root@proftp ~]# vgextend centos /dev/vda3
      Physical volume "/dev/vda3" successfully created.
      Volume group "centos" successfully extended
    [root@proftp ~]# lvs
      LV   VG     Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
      root centos -wi-ao---- <91.12g
      swap centos -wi-ao----  <7.88g
    [root@proftp ~]#
    [root@proftp ~]# lvextend -l +100%FREE /dev/centos/root
      Size of logical volume centos/root changed from <91.12 GiB (23326 extents) to <141.12 GiB (36126 extents).
      Logical volume centos/root successfully resized.
    [root@proftp ~]# 
    [root@proftp ~]# lsblk
    NAME            MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
    fd0               2:0    1     4K  0 disk
    sr0              11:0    1  1024M  0 rom
    vda             252:0    0   150G  0 disk
    ├─vda1          252:1    0     1G  0 part /boot
    ├─vda2          252:2    0    99G  0 part
    │ ├─centos-root 253:0    0 141.1G  0 lvm  /
    │ └─centos-swap 253:1    0   7.9G  0 lvm  [SWAP]
    └─vda3          252:3    0    50G  0 part
      └─centos-root 253:0    0 141.1G  0 lvm  /
    [root@proftp ~]#
    [root@proftp ~]# xfs_growfs /dev/centos/root
    meta-data=/dev/mapper/centos-root isize=512    agcount=4, agsize=5971456 blks
             =                       sectsz=512   attr=2, projid32bit=1
             =                       crc=1        finobt=0 spinodes=0
    data     =                       bsize=4096   blocks=23885824, imaxpct=25
             =                       sunit=0      swidth=0 blks
    naming   =version 2              bsize=4096   ascii-ci=0 ftype=1
    log      =internal               bsize=4096   blocks=11663, version=2
             =                       sectsz=512   sunit=0 blks, lazy-count=1
    realtime =none                   extsz=4096   blocks=0, rtextents=0
    data blocks changed from 23885824 to 36993024
    [root@proftp ~]# lsblk
    NAME            MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
    fd0               2:0    1     4K  0 disk
    sr0              11:0    1  1024M  0 rom
    vda             252:0    0   150G  0 disk
    ├─vda1          252:1    0     1G  0 part /boot
    ├─vda2          252:2    0    99G  0 part
    │ ├─centos-root 253:0    0 141.1G  0 lvm  /
    │ └─centos-swap 253:1    0   7.9G  0 lvm  [SWAP]
    └─vda3          252:3    0    50G  0 part
      └─centos-root 253:0    0 141.1G  0 lvm  /
    [root@proftp ~]# df -Th
    文件系统                类型      容量  已用  可用 已用% 挂载点
    /dev/mapper/centos-root xfs       142G  3.0G  139G    3% /
    devtmpfs                devtmpfs  3.9G     0  3.9G    0% /dev
    tmpfs                   tmpfs     3.9G     0  3.9G    0% /dev/shm
    tmpfs                   tmpfs     3.9G   25M  3.8G    1% /run
    tmpfs                   tmpfs     3.9G     0  3.9G    0% /sys/fs/cgroup
    /dev/vda1               xfs      1014M  143M  872M   15% /boot
    tmpfs                   tmpfs     781M     0  781M    0% /run/user/0
    [root@proftp ~]#
    

      

  • 相关阅读:
    概率论基础
    感知机
    CSS3实现jquery的特效
    有品质的生活
    table点击一行显示下一行的特效
    colspan在浏览器中失效的问题
    css的框架——common.css
    使用 document.onreadystatechange()来判断页面加载完
    iframe中子页面通过js计算高度(使得页面不会显示不全)
    js返回上一页并刷新的多种方法
  • 原文地址:https://www.cnblogs.com/yizhipanghu/p/14333501.html
Copyright © 2011-2022 走看看