2011-01-19 01:20

[Shell] 使用 sfdisk 分割硬碟

#!/bin/bash

PATH=/bin:/sbin:/usr/bin:/usr/sbin
export PATH

# disk path
DEVICE=/dev/sdb

# use sfdisk create device partition,size by Megabyte
sfdisk -uM $DEVICE <<EOF
,512
,512
EOF

# format to ext2
mke2fs $DEVICE"1"
mke2fs $DEVICE"2"

exit 0;

0 回應: