当前位置:网站首页>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
边栏推荐
- Nonlinear optimization: steepest descent method, Newton method, Gauss Newton method, Levenberg Marquardt method
- What is the relationship between realizing page watermarking and mutationobserver?
- About the college entrance examination
- UE4 night lighting notes
- 虛幻AI藍圖基礎筆記(萬字整理)
- Postman -- use
- Ue5 - AI pursuit (blueprint, behavior tree)
- Introduction and prevention of penetration test
- Introduction et prévention des essais de pénétration
- ue虛幻引擎程序化植物生成器設置——如何快速生成大片森林
猜你喜欢

阿里云SLS日志服务

Beautiful and intelligent, Haval H6 supreme+ makes Yuanxiao travel safer

Skywalking theory and Practice

Eslint reports an error

Sil/pil test of matlab code generation

MySQL index

Blender volume fog

ue4材质的入门和原理笔记
![[ue5] two implementation methods of AI random roaming blueprint (role blueprint and behavior tree)](/img/dd/cbe608fcbbbdf187dd6f7312271d2e.png)
[ue5] two implementation methods of AI random roaming blueprint (role blueprint and behavior tree)

2837xd code generation module learning (3) -- IIC, ECAN, SCI, watchdog, ECAP modules
随机推荐
Alibaba cloud SLS log service
【Visual Studio】每次打开一个Unity3D的脚本,都会自动重新打开一个新的VS2017
Blender stone carving
【UE5】动画重定向:如何将幻塔人物导入进游戏玩耍
[illusory] automatic door blueprint notes
ue4材质的入门和原理笔记
MySQL index
It is the most difficult to teach AI to play iron fist frame by frame. Now arcade game lovers have something
Blender model import UE, collision settings
This article takes you to learn in detail what is fiber to home FTTH
pytest学习--base
【避坑指南】Unity3D项目接入腾讯Bugly工具时遇到的坑
Basic usage of mock server
ue虚幻引擎程序化植物生成器设置——如何快速生成大片森林
07数据导入Sqoop
ue虛幻引擎程序化植物生成器設置——如何快速生成大片森林
Message mechanism -- getting to know messages and message queues for the first time
Application of rxjs operator withlatestfrom in Spartacus UI of SAP e-commerce cloud
合并有序数列
How to judge the quality of primary market projects when the market is depressed?