当前位置:网站首页>[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
边栏推荐
- leetcode刷题之二进制求和
- LeetCode刷题|两个链表的第一个公共节点
- Ansible基本命令、角色、内置变量与tests判断
- How to use DBA_ hist_ active_ sess_ History analysis database history performance problems
- Binary sum of leetcode questions
- Each traversal usage of tp6
- The getfield () method in TP5 changes, and TP5 gets the value of a single field
- TP6 的 each 遍历用法
- leetcode刷题之x的算术平方根
- postMan 传参总结
猜你喜欢
随机推荐
swiper组件封装
JS regular matching first assertion and last assertion
Typescript (lower)
tc ebpf 实践
tensorflow下载
MySQL索引【数据结构+索引创建原则】
rdma 介绍
ES6规范详解
Installing redis using a small leather panel in the window environment
【漏网之鱼】Ansible AWX调用playbook传参问题
【代码解析(4)】Communication-Efficient Learning of Deep Networks from Decentralized Data
SSM项目在阿里云部署
微信小程序
阅读笔记:FedGNN: Federated Graph Neural Network for Privacy-Preserving Recommendation
多线程
ebfp编程常用API介绍
postMan 传参总结
压力测试工具 Jmeter
SQL学习|基础查询与排列
JS手写兼容性事件绑定