CentOS7 分区合并

[root@yunwei-machine /]# df -h

文件系统                 容量  已用  可用   已用% 挂载点
/dev/mapper/centos-root   50G  5.0G   46G   10% /
devtmpfs                 1.9G     0  1.9G    0% /dev
tmpfs                    1.9G     0  1.9G    0% /dev/shm
tmpfs                    1.9G   13M  1.9G    1% /run
tmpfs                    1.9G     0  1.9G    0% /sys/fs/cgroup
/dev/sda1               1014M  179M  836M   18% /boot
/dev/mapper/centos-home  245G   40M  245G    1% /home
tmpfs                    378M  8.0K  378M    1% /run/user/42
tmpfs                    378M   32K  378M    1% /run/user/0
/dev/sr0                 4.3G  4.3G     0  100% /run/media/root/CentOS 7 x86_64

#卸载/home分区
[root@yunwei-machine /]# umount /home
[root@yunwei-machine /]# df -h

文件系统                 容量  已用  可用   已用% 挂载点
/dev/mapper/centos-root   50G  5.0G   46G   10% /
devtmpfs                 1.9G     0  1.9G    0% /dev
tmpfs                    1.9G     0  1.9G    0% /dev/shm
tmpfs                    1.9G   13M  1.9G    1% /run
tmpfs                    1.9G     0  1.9G    0% /sys/fs/cgroup
/dev/sda1               1014M  179M  836M   18% /boot
tmpfs                    378M  8.0K  378M    1% /run/user/42
tmpfs                    378M   32K  378M    1% /run/user/0
/dev/sr0                 4.3G  4.3G     0  100% /run/media/root/CentOS 7 x86_64 

[root@yunwei-machine /]#

#删除/home分区
[root@yunwei-machine /]# lvremove /dev/centos/home
Do you really want to remove active logical volume centos/home? [y/n]: y
Logical volume “home” successfully removed
[root@yunwei-machine /]#

扩展/root 逻辑卷
[root@yunwei-machine /]# lvextend -L +245G /dev/centos/root

  Size of logical volume centos/root changed from 50.00 GiB (12800 extents) to 295.00 GiB (75520 extents).
  Logical volume centos/root successfully resized.

[root@yunwei-machine /]#
[root@yunwei-machine /]#
[root@yunwei-machine /]#
[root@yunwei-machine /]#

#重新划分/root 分区磁盘空间
[root@yunwei-machine /]# xfs_growfs /dev/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 77332480

查看现有分区
[root@yunwei-machine /]# df -h

文件系统                 容量  已用  可用   已用% 挂载点
/dev/mapper/centos-root  295G  5.0G  291G    2% /
devtmpfs                 1.9G     0  1.9G    0% /dev
tmpfs                    1.9G     0  1.9G    0% /dev/shm
tmpfs                    1.9G   13M  1.9G    1% /run
tmpfs                    1.9G     0  1.9G    0% /sys/fs/cgroup
/dev/sda1               1014M  179M  836M   18% /boot
tmpfs                    378M  8.0K  378M    1% /run/user/42
tmpfs                    378M   32K  378M    1% /run/user/0
/dev/sr0                 4.3G  4.3G     0  100% /run/media/root/CentOS 7 x86_64

[root@yunwei-machine /]#
[root@yunwei-machine /]# mkdir -p /home && cd /home
[root@yunwei-machine home]#

#大功告成

  • 2
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值