C/C++教程

将centos-home的空间给centos-root扩容

本文主要是介绍将centos-home的空间给centos-root扩容,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

在安装CentOS的时候,采用默认磁盘分区安装,往往会将centos-root分区不大,剩余的空间全划分给centos-home,可以在后期将空间再调整。

[root@localhost ~]# umount /home/
[root@localhost ~]# 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@localhost ~]# lvextend -L +120G  /dev/mapper/centos-root #具体的数量可通过输入df -h查看
  Size of logical volume centos/root changed from 50.00 GiB (12800 extents) to 170.00 GiB (43520 extents).
  Logical volume centos/root successfully resized.
[root@localhost ~]# 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 44564480
[root@localhost ~]# lvcreate -L 100%FREE -n home centos
  Logical volume "home" created.
[root@localhost ~]# mkfs.xfs  /dev/mapper/centos-home
meta-data=/dev/mapper/centos-home isize=512    agcount=4, agsize=3080192 blks
         =                       sectsz=512   attr=2, projid32bit=1
         =                       crc=1        finobt=0, sparse=0
data     =                       bsize=4096   blocks=12320768, imaxpct=25
         =                       sunit=0      swidth=0 blks
naming   =version 2              bsize=4096   ascii-ci=0 ftype=1
log      =internal log           bsize=4096   blocks=6016, version=2
         =                       sectsz=512   sunit=0 blks, lazy-count=1
realtime =none                   extsz=4096   blocks=0, rtextents=0
[root@localhost ~]# mount  /dev/mapper/centos-home  /home
[root@localhost ~]# df -h
文件系统                 容量  已用  可用 已用% 挂载点
/dev/mapper/centos-root  170G  899M  170G    1% /
devtmpfs                  63G     0   63G    0% /dev
tmpfs                     63G     0   63G    0% /dev/shm
tmpfs                     63G  9.5M   63G    1% /run
tmpfs                     63G     0   63G    0% /sys/fs/cgroup
/dev/sda2               1014M  135M  880M   14% /boot
/dev/sda1                200M  9.8M  191M    5% /boot/efi
tmpfs                     13G     0   13G    0% /run/user/0
/dev/mapper/centos-home   47G   33M   47G    1% /home
[root@localhost ~]# lsblk 
NAME            MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda               8:0    0   223G  0 disk 
├─sda1            8:1    0   200M  0 part /boot/efi
├─sda2            8:2    0     1G  0 part /boot
└─sda3            8:3    0 221.8G  0 part 
  ├─centos-root 253:0    0   170G  0 lvm  /
  ├─centos-swap 253:1    0     4G  0 lvm  [SWAP]
  └─centos-home 253:2    0    47G  0 lvm  /home
sdb               8:16   0   8.9T  0 disk 
sdc               8:32   0   8.9T  0 disk 

 

这篇关于将centos-home的空间给centos-root扩容的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!