Linux disk automatic mounting script

#!/bin/bash

#List all mounted and pending disks
fdisk -l

echo "Please enter the target address of the disk:(/dev/xvda)"

read -p "address:" all

echo "Please enter the address:"

read -p "address:" ll

mkdir $ll

echo "n

p

1

 

 

w

"|fdisk -u $all

kk="${all}1"

mkfs.ext4 $kk

mount $kk $ll
echo `blkid $kk | awk '{print $2}' | sed 's/\"//g'` $ll ext4 defaults 0 0 >> /etc/fstab

df -h

echo "Complete permanent mounting!!!"

Original author:https://www.cnblogs.com/mhl1003/p/12966445.html

Comments

发表评论

您的电子邮箱地址不会被公开。 必填项已用*标注