当前位置:网站首页>lunix重新分配root 和 home 空间内存
lunix重新分配root 和 home 空间内存
2022-07-02 06:36:00 【lucky乐琪】
查看虚拟机磁盘分布
[root@data ~]# df -lh
文件系统 容量 已用 可用 已用% 挂载点
devtmpfs 4.7G 0 4.7G 0% /dev
tmpfs 4.7G 0 4.7G 0% /dev/shm
tmpfs 4.7G 13M 4.7G 1% /run
tmpfs 4.7G 0 4.7G 0% /sys/fs/cgroup
/dev/mapper/centos-root 50G 44G 6.3G 88% /
/dev/mapper/centos-home 46G 33M 46G 1% /home
/dev/sda1 1014M 149M 866M 15% /boot
tmpfs 959M 0 959M 0% /run/user/0
overlay 50G 44G 6.3G 88% /var/lib/docker/overlay2/25621b52617632efeb043f119ed67c0a0b6c8328d7835d11fa74395d0090866d/merged
overlay 50G 44G 6.3G 88% /var/lib/docker/overlay2/4b60531fff0d2eb5abb3569ea4cd03c480b0562071782477a0da0f5bec14062c/merged
overlay 50G 44G 6.3G 88% /var/lib/docker/overlay2/00e04c30d59668fa38acee4cde5ffb17ba4783bc2a43901750199b5d6de309f9/merged
备份home分区所有文件
[root@singlelucky ~]# tar cvf /tmp/home.tar /home
--卸载/home,如果无法卸载,先终止使用/home文件系统的进程--
--最好重启虚拟机,使得虚拟机处于初始状态--
> /home/
> /home/zhaozuozuo/
> /home/zhaozuozuo/.bash_logout
> /home/zhaozuozuo/.bash_profile
> /home/zhaozuozuo/.bashrc
> ;
卸载home分区
[root@singlelucky ~]# yum install psmisc
已加载插件:fastestmirror
Determining fastest mirrors
* base: mirrors.njupt.edu.cn
* extras: mirrors.njupt.edu.cn
* updates: mirrors.njupt.edu.cn
base | 3.6 kB 00:00:00
docker-ce-stable | 3.5 kB 00:00:00
extras | 2.9 kB 00:00:00
updates | 2.9 kB 00:00:00
(1/2): docker-ce-stable/7/x86_64/primary_db | 63 kB 00:00:00
(2/2): updates/7/x86_64/primary_db | 9.6 MB 00:00:02
正在解决依赖关系
--> 正在检查事务
---> 软件包 psmisc.x86_64.0.22.20-17.el7 将被 安装
--> 解决依赖关系完成
依赖关系解决
==================================================================================================================================
Package 架构 版本 源 大小
==================================================================================================================================
正在安装:
psmisc x86_64 22.20-17.el7 base 141 k
事务概要
==================================================================================================================================
安装 1 软件包
总下载量:141 k
安装大小:475 k
Is this ok [y/d/N]: y
Downloading packages:
psmisc-22.20-17.el7.x86_64.rpm | 141 kB 00:00:00
Running transaction check
Running transaction test
Transaction test succeeded
Running transaction
正在安装 : psmisc-22.20-17.el7.x86_64 1/1
验证中 : psmisc-22.20-17.el7.x86_64 1/1
已安装:
psmisc.x86_64 0:22.20-17.el7
完毕!
[root@singlelucky ~]# fuser -km /home/
[root@singlelucky ~]# umount /home
删除/home所在的lv
[root@singlelucky ~]# lvremove /dev/mapper/centos-home
Do you really want to remove active logical volume centos/home? [y/n]: (输入)y
Logical volume "home" successfully removed
给指定分区增加指定大小的磁盘空间
--我这里指定的是root增加40G,因为home只有账号文件,不存放其他的文件
[root@singlelucky ~]# lvextend -L +40G /dev/mapper/centos-root
Size of logical volume centos/root changed from 50.00 GiB (12800 extents) to 90.00 GiB (23040 extents).
Logical volume centos/root successfully resized.
扩展/root文件系统
[root@singlelucky ~]# xfs_growfs /dev/mapper/centos-root
meta-data=/dev/mapper/centos-root isize=512 agcount=4, agsize=3276800 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=0 spinodes=0
data = bsize=4096 blocks=13107200, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=1
log =internal bsize=4096 blocks=6400, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
data blocks changed from 13107200 to 23592960
重建home分区
[root@singlelucky ~]# lvcreate -L 2G -n /dev/mapper/centos-home
Logical volume "home" created.
创建文件系统
[root@singlelucky ~]# mkfs.xfs /dev/mapper/centos-home
meta-data=/dev/mapper/centos-home isize=512 agcount=4, agsize=131072 blks
= sectsz=512 attr=2, projid32bit=1
= crc=1 finobt=0, sparse=0
data = bsize=4096 blocks=524288, imaxpct=25
= sunit=0 swidth=0 blks
naming =version 2 bsize=4096 ascii-ci=0 ftype=1
log =internal log bsize=4096 blocks=2560, version=2
= sectsz=512 sunit=0 blks, lazy-count=1
realtime =none extsz=4096 blocks=0, rtextents=0
挂载home
[root@singlelucky ~]# mount /dev/mapper/centos-home
home备份文件恢复
[root@singlelucky ~]# tar xvf /tmp/home.tar -C/
home/
home/wxl/
home/wxl/.bash_logout
home/wxl/.bash_profile
home/wxl/.bashrc
查看新的磁盘空间分布
[root@singlelucky ~]# df -lh
文件系统 容量 已用 可用 已用% 挂载点
devtmpfs 4.7G 0 4.7G 0% /dev
tmpfs 4.7G 0 4.7G 0% /dev/shm
tmpfs 4.7G 13M 4.7G 1% /run
tmpfs 4.7G 0 4.7G 0% /sys/fs/cgroup
/dev/mapper/centos-root 90G 44G 47G 49% /
/dev/sda1 1014M 149M 866M 15% /boot
tmpfs 959M 0 959M 0% /run/user/0
/dev/mapper/centos-home 2G 33M 2G 2% /home
边栏推荐
- Career planning and development
- Project practice, redis cluster technology learning (VIII)
- Blender石头雕刻
- Determine whether there are duplicate elements in the array
- Project practice, redis cluster technology learning (10)
- Mock Server基本使用方法
- Edge computing accelerates live video scenes: clearer, smoother, and more real-time
- Beautiful and intelligent, Haval H6 supreme+ makes Yuanxiao travel safer
- [visual studio] every time you open a script of unity3d, a new vs2017 will be automatically reopened
- Vscode auto format
猜你喜欢

【MySQL】连接MySQL时出现异常:Connection must be valid and open

【避坑指南】使用UGUI遇到的坑:Text组件无法首行缩进两格
![[illusory] automatic door blueprint notes](/img/7a/14a66e5b623c7740dc91a15a328b10.png)
[illusory] automatic door blueprint notes

Notes de base sur les plans illusoires d'IA (triés en 10 000 mots)

pytest框架实现前后置

webUI自动化学习

Test -- Summary of interview questions

pytest--之测试报告allure配置

虚幻——动画蓝图、状态机制作人物走跑跳动作
![[ue5] animation redirection: how to import magic tower characters into the game](/img/a0/084381493cbc3992b61ef1b8ffce36.png)
[ue5] animation redirection: how to import magic tower characters into the game
随机推荐
pytest框架实现前后置
Junit4 runs MVN test test suite upgrade scheme
2021-10-02
【Unity3D】制作进度条——让Image同时具有Filled和Sliced的功能
This monitoring system makes workers tremble: turnover intention and fishing can be monitored. After the dispute, the product page has 404
测试--面试题总结
Blender stone carving
[200 Shengxin literatures] 95 multiomics exploration TNBC
Basic usage of mock server
Project practice, redis cluster technology learning (12)
【Visual Studio】每次打开一个Unity3D的脚本,都会自动重新打开一个新的VS2017
Nonlinear optimization: steepest descent method, Newton method, Gauss Newton method, Levenberg Marquardt method
It is the most difficult to teach AI to play iron fist frame by frame. Now arcade game lovers have something
2837xd code generation module learning (1) -- GPIO module
What is call / cc- What is call/cc?
How to judge the quality of primary market projects when the market is depressed?
Determine whether there are duplicate elements in the array
pytest--之测试报告allure配置
【Unity3D】嵌套使用Layout Group制作拥有动态子物体高度的Scroll View
Applet development summary