Home PC Games Linux Windows Database Network Programming Server Mobile  
           
  Home \ Linux \ Linux disk partition batch format mount script     - MySQL root password reset under CentOS (Database)

- CentOS 6.6 installation certification system based on the ftp service (Server)

- Linux System Getting Started Learning: On Linux how to convert text files to PDF (Linux)

- Oracle Execute to Parse perform analytical Ratio Analysis (Database)

- Android float ball and boot from the start (Programming)

- To remove those IP is prohibited Fail2ban on CentOS 6/7 (Server)

- Setting Lns firewall against ARP attacks (Linux)

- Log4Net (Linux)

- Enable Intel Rapid Start in GNU / Linux (Linux)

- Ubuntu 14.04 to install file editor KKEdit 0.1.5 version (Linux)

- CentOS6.3 build a Python 3.3 environment to access Oracle 11gR2 (Database)

- CentOS 6.4 compiler installed MySQL 5.6.14 (Database)

- Oracle RMAN repair logical bad blocks (Database)

- Samhain: Powerful intrusion detection system under Linux (Linux)

- Shared directory settings between Linux and Linux (Linux)

- How to choose the correct HTTP status code (Server)

- How to find the available network adapter on Ubuntu (Linux)

- Android developers learning Adapter (data adapter) (Programming)

- Linux process or thread is bound to a CPU (Programming)

- Upgrading from Fedora 20 to 21 (Linux)

 
         
  Linux disk partition batch format mount script
     
  Add Date : 2018-11-21      
         
         
         
  Yesterday received a task, ten machines, and the need to mount the partition, each machine has six letters, if one of a manual operation, efficiency is not high, I get that done in one, trying to write a script, to achieve mass deployment! The following is a script to use

[Root @ Hadoop6 ~] # vim parted.sh

#! / Bin / bash
#
#
yum install -y parted
sleep 1s
yum install -y vim
sleep 1s
################################################## ###################
touch / root / test1
i = 0
b = 1
for disk in `fdisk -l | grep" / dev / vd * "| awk '{if ($ 2 ~ / vd / && $ 2 =" / dev / vda: "&& $ 2 =" / dev / vdb: "!!) print substr ($ 2,0,8)} ' `
do
        parted $ disk << EXIT
        mklabel gpt
        mkpart primary 0 -1
        ignore
        quit
EXIT
      mkfs.ext4 $ disk $ b
echo "/ n / n **************** $ disk_was Fdisked! Waithing For 10 second **** / n / n"
sleep 1s
        uuid = `blkid $ disk $ b | awk '{print $ 2}' | awk -F" \ "" '{print $ 2}' `
        mkdir / data $ {i}
        cat << EXIT > / root / test1
UUID = $ uuid / data $ {i} ext4 defaults 1 2
EXIT
        cat / root / test1 >> / etc / fstab
i = $ (($ i + 1))
done
  
################################################## ####################
mount -a

--------------------------------------Dividing line---------- ----------------------------

[Root @ hadoop6 ~] # df
Filesystem 1K-blocks Used Available Use% Mounted on
/ Dev / mapper / vg0-lv_root 12179756 2680964 8880092 24% /
tmpfs 16439788 0 16439788 0% / dev / shm
/ Dev / vda1 198337 28603 159494 16% / boot
/ Dev / vdc1 4227572676 198680 4012625684 1% / data0
/ Dev / vdd1 4227572676 198680 4012625684 1% / data1
/ Dev / vde1 4227572676 198680 4012625684 1% / data2
/ Dev / vdf1 4227572676 198680 4012625684 1% / data3
/ Dev / vdg1 4227572676 198680 4012625684 1% / data4
/ Dev / vdh1 4227572676 198680 4012625684 1% / data5

--------------------------------------Dividing line---------- ----------------------------

[Root @ hadoop6 ~] # vim / etc / fstab
 
#
# / Etc / fstab
# Created by anaconda on Wed Mar 5 14:32:01 2014
#
# Accessible filesystems, by reference, are maintained under '/ dev / disk'
# See man pages fstab (5), findfs (8), mount (8) and / or blkid (8) for more info
#
/ Dev / mapper / vg0-lv_root / ext4 defaults 1 1
UUID = 0a17f48d-f99b-4498-82a5-a0874f25f1e7 / boot ext4 defaults 1 2
/ Dev / vdb1 swap swap defaults 0 0
tmpfs / dev / shm tmpfs defaults 0 0
devpts / dev / pts devpts gid = 5, mode = 620 0 0
sysfs / sys sysfs defaults 0 0
proc / proc proc defaults 0 0
UUID = 9ff86747-384f-4a37-adab-1ac5abd98dff / data0 ext4 defaults 1 2
UUID = bd6103cf-9774-4e31-87bb-33df4fbea47e / data1 ext4 defaults 1 2
UUID = 81a1b153-279f-454c-b23c-07744203b65a / data2 ext4 defaults 1 2
UUID = ae66663e-0879-4622-bb68-94bb045f9719 / data3 ext4 defaults 1 2
UUID = aab4c3f0-344a-4309-8ec0-c87017b5179d / data4 ext4 defaults 1 2
UUID = 0d4a6b2f-99dd-4a87-9d48-6090c3863ba3 / data5 ext4 defaults 1 2
~
     
         
         
         
  More:      
 
- Transplant spider to MySQL 5.6 (Database)
- RedHat Performance Tuning (Server)
- How to statistical data of various size Redis (Database)
- Inxi: Get Linux system and hardware information (Linux)
- grep search from files and display the file name (Linux)
- OpenStack package problems and solutions under CentOS6 (Linux)
- On Android running ClojureScript (Linux)
- Mass data storage application of MongoDB database (Database)
- GitLab Guide installation under Ubuntu 14.04 (Server)
- The Java ThreadLocal (Programming)
- Is Linux the most secure operating system (Linux)
- Setting Derby as Linux / Windows running as a service from the start (Server)
- Try debugfs restore the deleted files ext3 file system (Linux)
- Firewall types and instructions (Linux)
- Security enhancements in Ubuntu ssh service (Linux)
- Install Kali Linux via PXE network (Linux)
- OpenSSL for secure transmission and use of skills of files between Windows and Linux (Linux)
- Oracle 11g R2 RAC RMAN backup script example (Database)
- Ora-00020: maximum number of processes (500) exceeded (Database)
- Introduction to Linux Shell (Programming)
     
           
     
  CopyRight 2002-2022 newfreesoft.com, All Rights Reserved.