View Single Post

  #2 (permalink)  
Old 05-13-2008, 06:21 PM
nixcraft's Avatar
nixcraft nixcraft is offline
Never say die
User
 
Join Date: Jan 2005
Location: BIOS
My distro: Ubuntu
Posts: 1,035
Rep Power: 10
nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute nixcraft has a reputation beyond repute
Default

You need to use GNU parted utility - a partition manipulation program. It is perfect tool and works from a shell script. Here is a sample shell script. Make changes as per your setup and test script in a dummy environment.

Code:
#!/bin/sh
PART=$1
if [ $# -eq 0 ]
then
   echo "$0 partition-name
   echo "$0 /dev/sda1"
   exit 1
fi

echo "* Creating partition."
parted -s -- $PART  mkpart primary ext3 0 -1

echo "* Formatting the partition."
mke2fs -j -m 0 -O dir_index $PART
Read parted and mke2fs man pages.

HTH
__________________
Vivek | My personal blog
Linux Evangelist
Play hard stay cool
Reply With Quote