当前位置:网站首页>[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
边栏推荐
- How to use DBA_ hist_ active_ sess_ History analysis database history performance problems
- sql中的 IF 条件语句的用法
- 【漏网之鱼】Ansible AWX调用playbook传参问题
- 【代码解析(5)】Communication-Efficient Learning of Deep Networks from Decentralized Data
- 柯里化实现函数连续调用计算累加和
- Centos8 builds php8 0.3 operating environment
- Leak detection and vacancy filling (III)
- 【MySQL基础篇】启动选项、系统变量、状态变量
- JS handwriting compatibility event binding
- 压力测试工具 Jmeter
猜你喜欢
随机推荐
postMan 传参总结
CentOS8搭建PHP8.0.3运行环境
Get DOM element location information by offset and client
使用sed命令来高效处理文本
openvswitch vlan网络实践
JS实现网页轮播图
EF CORE在ASP.NET CORE项目中基于数据库优先模式生成实体模型
【Shell脚本练习】将新加的磁盘批量添加到指定的VG中
swiper组件封装
The getfield () method in TP5 changes, and TP5 gets the value of a single field
mysql密码过期的方法
Leetcode刷题之实现strStr()
offset和client獲取dom元素比特置信息
ansible模块之include_tasks:为什么加了tags后导入的任务没有执行?
LeetCode刷题|两个链表的第一个公共节点
Offset et client pour obtenir des informations sur l'emplacement des éléments Dom
ES6规范详解
A website that directly downloads PNG icons without logging in
Decentralized Collaborative Learning Framework for Next POI Recommendation
Set and map









