Centos7 挂载硬盘及扩容硬盘

说明:挂载新硬盘20G并扩容到app目录下

1.挂载硬盘
fdisk -l 
2.发现新硬盘未加载到,进入以下目录执行echo命令
cd /sys/class/scsi_host/
echo "- - -">host0/scan
echo "- - -">host1/scan
echo "- - -">host2/scan

3.执行完上面命令就可加载到新硬盘
fdisk -l
磁盘 /dev/sdd:17.2 GB, 17179869184 字节,33554432 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节

4.创建物理卷(pv)组

# pvcreate /dev/sdd1
Physical volume "/dev/sdd1" successfully created

6.将物理卷组PV扩展进centos逻辑卷(vg)组

# vgextend centos /dev/sdd1
Volume group "centos" successfully extended


7.将加入的sdd1卷组容量扩展到目标卷下
# lvextend -l +100%FREE /dev/mapper/centos-app 
Size of logical volume centos/app changed from 65.99 GiB (16893 extents) to 81.98 GiB (20988 extents).
Logical volume app successfully resized.

8.让扩展的容量生效

xfs_growfs /dev/mapper/centos-app
# df -h
文件系统 容量 已用 可用 已用% 挂载点
/dev/mapper/centos-root 5.7G 1.7G 4.0G 29% /
devtmpfs 1.9G 0 1.9G 0% /dev
tmpfs 1.9G 0 1.9G 0% /dev/shm
tmpfs 1.9G 8.6M 1.9G 1% /run
tmpfs 1.9G 0 1.9G 0% /sys/fs/cgroup
/dev/sda1 497M 171M 327M 35% /boot
/dev/mapper/centos-app 66G 543M 66G 1% /app
tmpfs 380M 0 380M 0% /run/user/1000

 

posted on 2020-10-15 10:39  franjia  阅读(849)  评论(0编辑  收藏  举报