• 【脚本】新增未扩展磁盘容量


    当前物理存储容量


    1. df -h /data | grep data | awk '{print$(NF-4)}'


    新增未扩展磁盘容量

    新增了物理磁盘,但是还未扩展到/data下的磁盘容量

    1. #!/bin/bash
    2. #################################################
    3. # Create by ssslinppp
    4. # 2016912 17:37:57
    5. ##################################################
    6. log_getUnExtendDisk="/data/logs/log_getUnExtendDisk.log"
    7. echo "====================================================" > $log_getUnExtendDisk
    8. echo "Begin to get UnExtendDisk storage at `date "+%Y-%m-%d %H:%M:%S"`" >> $log_getUnExtendDisk
    9. diskSizeCount="0"
    10. fdisk_tmp="/data/fdisk_tmp"
    11. pvs_tmp="/data/pvs_tmp"
    12. diffSet_tmp="/data/diffSet_tmp"
    13. getUnLvmDisk()
    14. {
    15. fdisk -l | grep /dev/[sh]d.: | awk -F ' ' '{print $2}' | awk -F ':' '{print $1}' > $fdisk_tmp
    16. # pvs | grep /dev/[sh]d. | awk -F ' ' '{print $1}' > $pvs_tmp
    17. pvscan | grep /dev/[sh]d. | awk -F ' ' '{print $2}' > $pvs_tmp
    18. #get Difference set
    19. # sort $fdisk_tmp $pvs_tmp $pvs_tmp | uniq -u > $diffSet_tmp
    20. grep -F -v -f $pvs_tmp $fdisk_tmp > $diffSet_tmp
    21. echo "-----------------------------" >> $log_getUnExtendDisk
    22. echo "fdisk_info is :" >> $log_getUnExtendDisk
    23. cat $fdisk_tmp >> $log_getUnExtendDisk
    24. echo "pvs_info is :" >> $log_getUnExtendDisk
    25. cat $pvs_tmp >> $log_getUnExtendDisk
    26. echo "diffSet is:" >> $log_getUnExtendDisk
    27. cat $diffSet_tmp >> $log_getUnExtendDisk
    28. echo "----------------------------" >> $log_getUnExtendDisk
    29. rm -rf $fdisk_tmp
    30. rm -rf $pvs_tmp
    31. }
    32. getUnLvmDisk
    33. content=`cat $diffSet_tmp`
    34. for dev_disk in $content then;
    35. do
    36. if [ $dev_disk != "/dev/sda" ] && [ $dev_disk != "/dev/hda" ] && [ `echo $dev_disk | wc -L` == 8 ];then
    37. # echo "+++++++++++++++++ [$dev_disk]"
    38. diskSize=`fdisk -l $dev_disk | grep /dev/[sh]d.: | awk '{print $3}' | awk -F '.' '{print $1}'`
    39. sizeUnit=`fdisk -l $dev_disk | grep /dev/[sh]d.: | awk '{print $4}' | awk -F '.' '{print $1}'`
    40. echo " [$dev_disk] size is: $diskSize$sizeUnit" >> $log_getUnExtendDisk
    41. if [ $sizeUnit = "MB," ];then
    42. diskSize=$[ diskSize / 1024 ]
    43. fi
    44. diskSizeCount=$[ diskSizeCount + diskSize ]
    45. echo "curr diskSizeCount is: [$diskSizeCount]G" >> $log_getUnExtendDisk
    46. fi
    47. done
    48. echo -e "---------------------------- diskSizeCount : $diskSizeCount" >> $log_getUnExtendDisk
    49. echo $diskSizeCount















    附件列表

    • 相关阅读:
      ubuntu16.04系统安装
      SQL注入之Sqli-labs系列第二十六关(过滤空格、注释符、逻辑运算符注入)和第二十六A
      提权心法(2)提权基本流程
      布尔盲注
      提权心法(1)信息搜集很重要
      POST注入-双注入
      POST型注入-报错注入
      字符型注入
      Web中间件常见安全漏洞总结
      SSRF 从入门到批量找漏洞
    • 原文地址:https://www.cnblogs.com/ssslinppp/p/5889754.html
    Copyright © 2020-2023  润新知