User-Profile-Image
hankin
  • 5
  • centos7
  • docker
  • mysql
  • PostgreSQL
  • git/gitlab
  • ELK
  • python
    • python-Tornado
    • python-django
  • redis
  • nginx
  • kvm
  • proxmox
  • mongo
  • kubernetes
  • prometheus
  • GlusterFs
  • nfs
  • freeswitch
  • httpd
  • shell脚本
  • linux
  • fastdfs
  • nextcloud
  • openssl
  • openvpn
  • rabbitmq
  • sqlite
  • svn
  • java
  • ubuntu
  • vue2
  • wordpress
  • php
  • IOT物联网
  • 项目
  • 故障处理
  • 树莓派
  • 博客存档
  • 未分类
  • 杂项
  • #1742(无标题)
  • 新视野
  • 分类
    • 项目
    • 树莓派
    • 杂项
    • 未分类
    • 新视野
    • 故障处理
    • 博客存档
    • wordpress
    • vue2
    • ubuntu
    • svn
    • sqlite
    • shell脚本
    • redis
    • rabbitmq
    • python-django
    • python
    • proxmox
    • prometheus
    • PostgreSQL
    • php
    • openvpn
    • openssl
    • nginx
    • nfs
    • nextcloud
    • mysql
    • mongo
    • linux
    • kvm
    • kubernetes
    • java
    • IOT物联网
    • httpd
    • GlusterFs
    • git/gitlab
    • freeswitch
    • fastdfs
    • ELK
    • docker
    • centos7
  • 页面
    • #1742(无标题)
  • 友链
      请到[后台->主题设置->友情链接]中设置。
Help?

Please contact us on our email for need any support

Support
    首页   ›   centos7   ›   正文
centos7

centos7 扩容磁盘、dev、mapper、centos-root

2022-10-28 23:33:18
2041  0 0

CentOS7 /根目录空间不足,/home目录空间剩余较多。现需要将/home的空闲空间,分配给/。

基础知识:linux /dev/mapper目录浅谈
https://www.cnblogs.com/amoyzhu/p/6626423.html

0 环境

系统centos7,安装时使用的默认分区配置,磁盘使用的是本机的物理磁盘

1 查看磁盘空间情况

lsblk

2 备份后卸载/home分区

umount /home/

3 删除/home所在的lv

lvremove /dev/mapper/centos-home 
#yes

  如果提示:Logical volume centos/home contains a filesystem in use
  我的解决办法:
     1重启 
     2执行fuser -m -v -k /home 
     3重启ssh连接上,执行 lvremove -f/dev/mapper/centos-home

4 扩容/dev/mapper/centos-root分区

lvextend -L +100G /dev/mapper/centos-root
#扩展100G,#根据磁盘空间剩余情况,设置大小

5 扩展/root文件系统

xfs_growfs /dev/mapper/centos-root

6 重新创建home lv磁盘

lvcreate -L 100G -n /dev/mapper/centos-home
#指定100G 根据磁盘空间剩余情况,设置大小

7 创建文件系统,

mkfs.xfs /dev/mapper/centos-home

8 挂载/home

mount /dev/mapper/centos-home /home

9 查看

cat /etc/fstab
# 查看启动挂载

df -h
# 查看磁盘,/目录大小已由原来的50G变成150G

备用
lsblk      查看分区和磁盘
df -h   查看空间使用情况
fdisk -l   分区工具查看分区信息
cfdisk /dev/sda  查看分区
cat /etc/fstab 查看挂载

评论 (0)

点击这里取消回复。

欢迎您 游客  

Copyright © 2025 网站备案号 : 蜀ICP备2022017747号
smarty_hankin 主题. Designed by hankin
主页
页面
  • #1742(无标题)
博主
tang.show
tang.show 管理员
linux、centos、docker 、k8s、mysql等技术相关的总结文档
210 文章 2 评论 200887 浏览
测试
测试