自动fdisk脚本

drbd分区

vim zpjdrbd.sh

#!/bin/bash
disk='/dev/sda'
echo -e "disk \\033[1;32m$disk\\033[0;39m begin"
fdisk $disk &>fdisk_sdb.log <<EOF
n
e
3


n
l

+20M

n
l


w
EOF
echo -e "\\033[1;34mDone\\033[0;39m end"

partprobe


mkfs -t ext3 /dev/sda6

 

 

http://www.oralife.cn/html/2008/394_fdisk-raw.html

http://www.docin.com/p-56529049.html

由于经常划FDISK划RAW分区,而且比较多费时费力,有了一下这个脚本就省事多了,只要修改大小,核对好就好了

#!/bin/bash
disk=’/dev/sda’
echo -e “fdisk \\033[1;32m$disk\\033[0;39m begin”

fdisk $disk &>fdisk_sdb.log <<EOF
n
p
1

+268M

n
p
2

+31466M

n
p
3

+1057M

n
e

n

+1057M

n

+1057M

n

+1057M

n

+1057M

n

+1057M

n

+1057M

n

+1057M

n

+1057M

n

+1057M

n

+1057M

n

+1057M

w
EOF
echo -e “\\033[1;34mDone\\033[0;39m end”

你可能感兴趣的:(自动fdisk脚本)