Interactive Shell script for Linux physical volume Management

Source: Internet
Author: User



# Linux LVM Tool full version: http://xin23.blog.51cto.com/1827266/1198836 (update 2013.5.13)


# Scripts are only used for communication and learning!

# The current script version is 1. 0. creates, removes, changes (enables/disables allocation), scans, and views physical volumes. # In the future, the volume group and logical volume management will be completed and integrated into a Linux lvm tool. similar to the aix smit. although, it can only manage LVM. # The script has passed the test on Red Hat Enterprise Linux 5.4 64bit. it is applicable in principle to RHEL 5 and RHEL 6. # suggestions for improvement are welcome. # copy Punctuation Marks directly. you can also download files through the micro disk, to avoid the problem caused by Replication: http://vdisk.weibo.com/s/zKW6M! /Bin/bash # Version 1.0 # AUTHOR: Xin23 http://weibo.com/231988PV () {NextLine () {echo ''} Split () {echo 'response'} EchoTitle () {echo "-------- $ Title -----------------------------------------"} ShowPVFirstMenu () {echo 'physical Volumn Main Menu Input Number To Choose! Create Physical Volumn ...... 1 Remove Physical Volumn ...... 2 Change Physical Volumn ...... 3 Show Physical Volumn ...... 4 Scan Physical Volumn ...... 5 Exit ...... 6 'nextline} GetChoice () {read-p' Input Your Choice: 'var NextLine} ConfirmOperate () {NextLine echo "Continue ...... y Return ...... n "NextLine GetChoice NextLine Run} Run () {if [$ Var = y] then $ Parameter $ Disk elif [$ Var = n] Then Split PV else ConfirmOperate fi} ChooseDisk () {read-p "Please Choose Disk: (Example:/dev/sdc)" Disk NextLine} PVChange () {echo 'which Operate You Want To do? 'Nextline echo 'ENABLE Allocatable ...... y DISABLE Allocatable ...... n' NextLine GetChoice} CheckPVChange () {if [$ Var = y] then Parameter = 'pvchange-x y' elif [$ Var = n] then Parameter = 'pvchange-x n' else pvchange fi} PVShow () {echo 'which Physical Volumn You Want To Show? 'Nextline echo 'All Physical Volumn ...... 1 Single Physical Volumn ...... 2 'nextline GetChoice} CheckPVShow () {if [$ Var-eq 1] then pvdisplay elif [$ Var-eq 2] then pvdisplay $ Disk fi} TestPVShow () {if [$ Var-eq 1] then Disk = All elif [$ Var-eq 2] then EchoTitle NextLine ChooseDisk fi} ShowPVFirstMenuGetChoicecase $ Var in "1 ") title = 'create Physical volumn' Parameter = pvcreate EchoTitle Nex TLine ChooseDisk echo "Disk $ Disk Will Be Convert To Physical Volumn" ConfirmOperate Status = 0; "2 ") title = 'remove Physical volumn' EchoTitle Parameter = pvremove NextLine ChooseDisk echo "Disk $ Disk Will Be removed From Physical Volumn" ConfirmOperate Status = 0; "3 ") title = 'change Physical volumn' EchoTitle NextLine PVChange CheckPVChange NextLine ChooseDisk echo "Physical Volumn $ Disk Will Be Change "ConfirmOperate Status = 0;" 4 ") title = 'show Physical volumn' EchoTitle NextLine PVShow NextLine TestPVShow echo "Physical Volumn $ Disk Will Be Show" NextLine CheckPVShow Status = 0; "5 ") title = 'Scan Physical volumn' EchoTitle NextLine pvscan Status = 0; "6") exit 0; *) echo 'input Error, Retype! 'Pv; esacNeedContinue () {if [$ Status-eq 0] then NextLine Split PV fi} NeedContinue} PV

This article from the "Xin23 flow account" blog, please be sure to keep this source http://xin23.blog.51cto.com/1827266/1192046

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.