标签:free really 默认 group seq create bak read span
部署CentOS7的时候分配的动态扩充虚拟磁盘,共1T大小,在安装Centos时默认分区,系统仅给/分配50G,而大量空间都挂载到/home下,最近CentOS7使用中发现空间已不足够,所以就想如何将/home下的空间重新分配扩容到/下。
配置过程
df -h
或者lsblk
[root@localhost ~]# df -h 文件系统 容量 已用 可用 已用% 挂载点 /dev/mapper/centos-root 50G 49G 1.6G 97% / /dev/mapper/centos-home 965G 33M 965G 1% /home
卸载前记得备份cp -r /home /home-bak
[root@localhost ~]# umount /home [root@localhost ~]# df -h 文件系统 容量 已用 可用 已用% 挂载点 /dev/mapper/centos-root 50G 49G 1.6G 97% /
[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
这里我们增加500G空间 [root@localhost ~]# lvextend -L +500G /dev/mapper/centos-root Size of logical volume centos/root changed from 50.00 GiB (12800 extents) to 550.00 GiB (140800 extents). Logical volume centos/root successfully resized.
[root@localhost ~]# df -hT 文件系统 类型 容量 已用 可用 已用% 挂载点 /dev/mapper/centos-root xfs 50G 49G 1.6G 97% /
[root@localhost ~]# xfs_growfs /dev/mapper/centos-root meta-data=/dev/mapper/centos-root isize=512 agcount=4, agsize=3276800 blks = sectsz=4096 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=4096 sunit=1 blks, lazy-count=1 realtime =none extsz=4096 blocks=0, rtextents=0 data blocks changed from 13107200 to 144179200
[root@localhost ~]# df -h 文件系统 容量 已用 可用 已用% 挂载点 /dev/mapper/centos-root 550G 49G 502G 9% /
Free PE / Size
可分配空间[root@localhost ~]# vgdisplay --- Volume group --- VG Name centos System ID Format lvm2 Metadata Areas 1 Metadata Sequence No 7 VG Access read/write VG Status resizable MAX LV 0 Cur LV 3 Open LV 2 Max PV 0 Cur PV 1 Act PV 1 VG Size <1023.00 GiB PE Size 4.00 MiB Total PE 261887 Alloc PE / Size 168416 / <657.88 GiB Free PE / Size 93471 / 365.12 GiB VG UUID TDRsyJ-GZ2H-ZRWr-Gfje-LNe1-ggpz-0pJ7jx
[root@localhost ~]# lvcreate -L 100G -n home centos Logical volume "home" created.
[root@localhost ~]# mkfs.xfs /dev/centos/home meta-data=/dev/centos/home isize=512 agcount=4, agsize=6553600 blks = sectsz=4096 attr=2, projid32bit=1 = crc=1 finobt=0, sparse=0 data = bsize=4096 blocks=26214400, imaxpct=25 = sunit=0 swidth=0 blks naming =version 2 bsize=4096 ascii-ci=0 ftype=1 log =internal log bsize=4096 blocks=12800, version=2 = sectsz=4096 sunit=1 blks, lazy-count=1 realtime =none extsz=4096 blocks=0, rtextents=0
[root@localhost ~]# mount /dev/centos/home /home
[root@localhost ~]# df -h 文件系统 容量 已用 可用 已用% 挂载点 /dev/mapper/centos-root 550G 49G 502G 9% / /dev/mapper/centos-home 100G 33M 100G 1% /home
标签:free really 默认 group seq create bak read span
原文地址:https://www.cnblogs.com/fengyuanfei/p/14758304.html