当前位置:网站首页>[shell script exercise] batch add the newly added disks to the specified VG
[shell script exercise] batch add the newly added disks to the specified VG
2022-04-23 06:58:00 【Sebastien23】
【Shell Script exercises 】 Add the newly added disks to the specified disk in batch VG in
Requirements describe
Hundreds of existing servers have added a new piece 10GB Size of virtual disk , These disks need to be added to the specified VG In the middle . The device file name of the disk may be /dev/vdb
、/dev/vdc
、/dev/vdd
etc. (/dev/vda
Is the disk on which the system partition is located ).
scripting
#!/bin/bash
echo "Summary of fdisk -l:"
fdisk -l | grep vd
fdisk -l | grep vd > ./checkDisk_fdisk_tmpfile
echo "Summary of pvscan:"
pvscan
pvscan > ./checkDisk_pvs_tmpfile
for x in /dev/vd[^a]*
do
echo "Checking ${x} ..."
if grep ${x} ./checkDisk_pvs_tmpfile
then
continue
else
echo "${x} is not used for PV."
if grep ${x} ./checkDisk_fdisk_tmpfile | grep '10.7 GB'
then
echo "${x} is 10GB. Now creating PV with ${x} ..."
pvcreate ${x}
vgextend rootvg ${x}
fi
fi
done
echo "All vdisk are checked. Summary of pvscan:"
pvscan
版权声明
本文为[Sebastien23]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/04/202204230557416153.html
边栏推荐
猜你喜欢
随机推荐
Typescript (top)
ovs与ovs+dpdk架构分析
A website that directly downloads PNG icons without logging in
rdma 介绍
页面缓存问题解决方法(慎用)
【不积跬步无以至千里】Oracle应用导数Ora-01455报错处理
不用登录直接下载PNG图标的一个网站
【MySQL基础篇】数据导出导入权限与local_infile参数
tc ebpf 实践
redis 常见问题
[ES6 quick start]
Leetcode刷题之实现strStr()
虚拟环境中使用jupyter notebook
New formdata() when importing files
Redis 详解(基础+数据类型+事务+持久化+发布订阅+主从复制+哨兵+缓存穿透、击穿、雪崩)
PHP background parsing after JQ serialization
浏览器工作原理与实践
TypeScript(上)
openvswitch vlan网络实践
rdam 原理解析