Linux

Linux disk automatic mounting script

2021年5月7日
#!/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

You Might Also Like

No Comments

Leave a Reply

%d 博主赞过: