Script automatically partition, format, mount

! # bin / bash
# function: automatic disk partition, format, mount
# Author: liusingbon
# vdb disk for the virtual machine partition formatted partition using the command << need to import to the program fdisk,
#n ( New partition), p (create a primary partition), e (create an extended partition), 1 (Division No. 1, and so on), w (save and exit)
# NOTE: 1,2,3,4 behind the blank line must be present. Create three primary partitions +1 extended partition.
the fdisk / dev / VDB the EOF <<
n-
P
1

+. 1G
n-
P
2

+ 2G
n-
P
. 3

+ 3G
n-
E
. 4

W
the EOF
partition created format # 1
the mkfs.xfs / dev / vdb1
# Create mount point directories
IF [-e / Data]; the then
   Exit
Fi
mkdir / Data
# 1 automatically mount the partition, and the boot is provided automatically mount
echo '/ dev / vdb1 / data xfs defaults 2 0 '>> / etc / fstab
Mount -a


End.


Guess you like

Origin www.cnblogs.com/liusingbon/p/11084889.html