机器人 救救瓜
Toggle navigation
Home
SCM-tool
Linux
Jenkins
SVN
other
About Me
Archives
Tags
Linux (Centos/redhat) 调整磁盘分区大小
? 分区 ?
2019-01-15 18:12:59
621
0
0
gua_l
? 分区 ?
---------- ``` 使用ssm 将 /dev/mapper/centos-home 407G 33M 407G 1% /home 换到 /dev/mapper/centos-root 50G 19G 32G 37% / ``` ---------- ######安装ssm ``` yum install system-storage-manager -y ``` ---------- #####查看分区 ``` ssm list ``` ---------- ###### 查看mount那一列,要移动的容量的挂载点是/home, 卸载 /home ``` umount /home ``` ---------- ###### 查看Volume 那一列,要移动的容量的逻辑券是/dev/centos/home, 删除它,删除了之后空间就释放了 ``` ssm remove /dev/centos/home ``` ---------- ###### 查看释放出来的空间,并增加到/这个挂载点所在的逻辑卷/dev/centos/root ``` ssm list ssm resize -s +400GB /dev/centos/root ``` ---------- ###### 使用xfs_growfs扩容文件系统 ``` ssm list xfs_growfs /dev/centos/root ``` ---------- ###### fstab中挂载/home的一行删掉 ``` vi /etc/fstab ``` ---------- #####查看分区情况 ``` df -h ``` ---------- Log ``` [root@172-0-11-45 yum.repos.d]# yum install system-storage-manager ..... ..... Installed: system-storage-manager.noarch 0:0.4-8.el7 Complete! [root@172-0-11-45 yum.repos.d]# [root@172-0-11-45 yum.repos.d]# ssm list ------------------------------------------------------------- Device Free Used Total Pool Mount point ------------------------------------------------------------- /dev/sda 465.76 GB PARTITIONED /dev/sda1 1.00 GB /boot /dev/sda2 4.00 MB 464.75 GB 464.76 GB centos ------------------------------------------------------------- ---------------------------------------------------- Pool Type Devices Free Used Total ---------------------------------------------------- centos lvm 1 4.00 MB 464.75 GB 464.76 GB ---------------------------------------------------- -------------------------------------------------------------------------------------- Volume Pool Volume size FS FS size Free Type Mount point -------------------------------------------------------------------------------------- /dev/centos/root centos 50.00 GB xfs 49.98 GB 48.99 GB linear / /dev/centos/swap centos 7.81 GB linear /dev/centos/home centos 406.94 GB xfs 406.74 GB 406.71 GB linear /home /dev/sda1 1.00 GB xfs 1014.00 MB 867.07 MB part /boot -------------------------------------------------------------------------------------- [root@172-0-11-45 yum.repos.d]# umount /home [root@172-0-11-45 yum.repos.d]# ssm remove /dev/centos/home Do you really want to remove active logical volume centos/home? [y/n]: y Logical volume "home" successfully removed [root@172-0-11-45 yum.repos.d]# ssm list -------------------------------------------------------------- Device Free Used Total Pool Mount point -------------------------------------------------------------- /dev/sda 465.76 GB PARTITIONED /dev/sda1 1.00 GB /boot /dev/sda2 406.95 GB 57.81 GB 464.76 GB centos -------------------------------------------------------------- ----------------------------------------------------- Pool Type Devices Free Used Total ----------------------------------------------------- centos lvm 1 406.95 GB 57.81 GB 464.76 GB ----------------------------------------------------- -------------------------------------------------------------------------------------- Volume Pool Volume size FS FS size Free Type Mount point -------------------------------------------------------------------------------------- /dev/centos/root centos 50.00 GB xfs 49.98 GB 48.99 GB linear / /dev/centos/swap centos 7.81 GB linear /dev/sda1 1.00 GB xfs 1014.00 MB 867.07 MB part /boot -------------------------------------------------------------------------------------- [root@172-0-11-45 yum.repos.d]# ssm resize -s +400GB /dev/centos/root Size of logical volume centos/root changed from 50.00 GiB (12800 extents) to 450.00 GiB (115200 extents). Logical volume centos/root successfully resized. 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 117964800 [root@172-0-11-45 yum.repos.d]# ssm list ------------------------------------------------------------- Device Free Used Total Pool Mount point ------------------------------------------------------------- /dev/sda 465.76 GB PARTITIONED /dev/sda1 1.00 GB /boot /dev/sda2 6.95 GB 457.81 GB 464.76 GB centos ------------------------------------------------------------- ---------------------------------------------------- Pool Type Devices Free Used Total ---------------------------------------------------- centos lvm 1 6.95 GB 457.81 GB 464.76 GB ---------------------------------------------------- -------------------------------------------------------------------------------------- Volume Pool Volume size FS FS size Free Type Mount point -------------------------------------------------------------------------------------- /dev/centos/root centos 450.00 GB xfs 49.98 GB 48.99 GB linear / /dev/centos/swap centos 7.81 GB linear /dev/sda1 1.00 GB xfs 1014.00 MB 867.07 MB part /boot -------------------------------------------------------------------------------------- [root@172-0-11-45 yum.repos.d]# xfs_growfs /dev/centos/root meta-data=/dev/mapper/centos-root isize=512 agcount=36, agsize=3276800 blks = sectsz=4096 attr=2, projid32bit=1 = crc=1 finobt=0 spinodes=0 data = bsize=4096 blocks=117964800, 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 [root@172-0-11-45 yum.repos.d]# vi /etc/fstab /dev/mapper/centos-home /home xfs defaults 0 0 # # /etc/fstab # Created by anaconda on Fri Dec 14 01:17:03 2018 # # Accessible filesystems, by reference, are maintained under '/dev/disk' # See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info # /dev/mapper/centos-root / xfs defaults 0 0 UUID=7c616a1f-4d66-4e7f-8583-d192571dc0a2 /boot xfs defaults 0 0 /dev/mapper/centos-swap swap swap defaults 0 0 "/etc/fstab" 11L, 465C written [root@172-0-11-45 yum.repos.d]# df -h Filesystem Size Used Avail Use% Mounted on /dev/mapper/centos-root 450G 19G 432G 5% / devtmpfs 7.7G 0 7.7G 0% /dev tmpfs 7.8G 8.0K 7.8G 1% /dev/shm tmpfs 7.8G 787M 7.0G 10% /run tmpfs 7.8G 0 7.8G 0% /sys/fs/cgroup /dev/sda1 1014M 148M 867M 15% /boot tmpfs 1.6G 0 1.6G 0% /run/user/0 [root@172-0-11-45 yum.repos.d]# cd /home/ ``` ---------- ---------- ----------
Pre:
git 查看两个commit 之间的修改
Next:
shell 中 循环 空格 空行 字符串转数值
0
likes
621
Weibo
Wechat
Tencent Weibo
QQ Zone
RenRen
Submit
Sign in
to leave a comment.
No Leanote account?
Sign up now.
0
comments
More...
Table of content
No Leanote account? Sign up now.