首页 > 其他 > 详细

centos根目录扩容,home目录减小容量

时间:2019-06-17 19:30:54      阅读:182      评论:0      收藏:0      [点我收藏+]

参考:

https://blog.csdn.net/evandeng2009/article/details/49814097

 

主要命令:

15  cd /
16  ll
17  mkdir backup
18  ll
20  cp -r /home/* /backup/      # 备份/home目录到/backup
21  cd /home/
22  ll
26  cd /
27  cd backup/
30  ll
31  cd /
32  ll
33  umount /home
34  w
35  reboot 
36  w
37  umount /home            #  卸载这个/home的挂载关联
38  df -h
39  lvremove /dev/centos/home   # 删除逻辑卷home
40  vgdisplay       #  查看卷组可用空间
41  lvcreate -L 200G -n home centos       # -L表示大小,默认单位为M;-n表示卷名;这里的centos是CentOS7安装系统的时候就默认建立好的卷组名
42  lvdisplay       # 查看逻辑卷home
43  vgdisplay 
44  df -h
45  vgchange -ay centos  #  可选步骤:激活卷组centos,使得这个新建的home逻辑卷生效
46  mkfs -t xfs /dev/centos/home   #  在新建的逻辑卷home上建立xfs文件系统
47  mount /dev/centos/home /home/  #  把这个新逻辑卷home挂到之前的文件夹/home中去,直接重启用fstab来挂载也行
48  df -h
49  cp -r /backup/* /home/  # 再把之前拷出来的东西拷回新建的/home中
50  cd /home/
53  ll
54  cd /
55  ll
56  lvextend -L +200G /dev/centos/root # 把释放出来多余的空间分配给root卷;+号表示在原来的基础上额外增加,不要加好则设定为具体额度,剩下那点渣渣空间让它闲着
57  df -h
58  lvdisplay 
59  vgchange -ay centos
60  df -h  
61  xfs_growfs /dev/centos/root   #  扩展root卷,xfs_growfs扩展文件系统。不使用xfs_growfs扩展文件系统,磁盘是不认得多的空间的
62  df -h  # 再看root大小已经生效,200多G了

  

centos根目录扩容,home目录减小容量

原文:https://www.cnblogs.com/andy9468/p/11041619.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!