当前位置:网站首页>【Shell脚本练习】将新加的磁盘批量添加到指定的VG中
【Shell脚本练习】将新加的磁盘批量添加到指定的VG中
2022-04-23 05:59:00 【Sebastien23】
需求描述
现有几百台服务器新加了一块10GB大小的虚拟磁盘,需要将这些磁盘都加到指定的VG中去。磁盘的设备文件名可能为 /dev/vdb
、/dev/vdc
、/dev/vdd
等(/dev/vda
是系统分区所在的磁盘)。
脚本编写
#!/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://blog.csdn.net/Sebastien23/article/details/124256104
边栏推荐
- Mailbox string judgment
- 压力测试工具 Jmeter
- Parse PSD files and map them into components
- el-date-picker限制选择范围,从当前时间到两个月前
- Kids and COVID: why young immune systems are still on top
- JS性能优化
- Installing redis using a small leather panel in the window environment
- Your brain expands and shrinks over time — these charts show how
- Promise(二)
- 百度地图基础案例
猜你喜欢
JS performance optimization
批量修改/批量更新数据库某一个字段的值
XDP类型的BPF程序
TP5 使用redis
Installing redis using a small leather panel in the window environment
TP5 error reporting variable type error: array solution
Leetcode刷题之实现strStr()
Imitation scallop essay reading page
surprise库中evaluate函数弃用解决方法
Number of stair climbing methods of leetcode
随机推荐
Leak detection and vacancy filling (IV)
Kids and COVID: why young immune systems are still on top
PHP 无限极分类和树形
tp5 报错variable type error: array解决方法
LeetCode刷题|13罗马数字转整数
el-cascader和el-select点击别处让下拉框消失
PHP background parsing after JQ serialization
ubuntu下搭建mysql环境 & 初识SQL
window环境下使用小皮面板安装redis
浏览器工作原理与实践
浏览器中堆栈内存的底层处理
useCenterHook
【代码解析(5)】Communication-Efficient Learning of Deep Networks from Decentralized Data
sql中的 IF 条件语句的用法
阅读笔记:Secure Federated Matrix Factorization
Leetcode integer plus one
TP6 的 each 遍历用法
EF CORE在ASP.NET CORE项目中基于数据库优先模式生成实体模型
LeetCode刷题|38外观数组
freeCodeCamp----shape_calculator练习