以VMware为例,假设挂载了一块10g硬盘在/dev/sdb,硬盘还没分区,啥操作也没有,想要/opt有一个10g的新空间存储东西。
cd /root
pwd
cat /root/2.sh
i
df -h
fdisk -l
fdisk /dev/sdb
yes | command or script
n
yes | command or script
p
yes | command or script
1
yes | command or script
yes | command or script
w
yes | command or script
mkfs -t ext4 -c /dev/sdb1
mount /dev/sdb1 /opt
esc
:wq
yes | command or script
chmod +x 2.sh
./2.sh