Home Linux Utils
Delete partition:

parted /dev/sdx rm PARTITION# > /dev/null 2>&1


Create new partion (START and END are in Mbytes, -0 represents the end):

parted /dev/sdx mkpart primary ext2  START END   


Script to automate partitioning:

swapoff -a  > /dev/null 2>&1
parted /dev/sda rm 10 > /dev/null 2>&1
parted /dev/sda rm 9 > /dev/null 2>&1
parted /dev/sda rm 8 > /dev/null 2>&1
parted /dev/sda rm 7 > /dev/null 2>&1
parted /dev/sda rm 6 > /dev/null 2>&1
parted /dev/sda rm 5 > /dev/null 2>&1
parted /dev/sda rm 4 > /dev/null 2>&1
parted /dev/sda rm 3 > /dev/null 2>&1
parted /dev/sda rm 2 > /dev/null 2>&1
parted /dev/sda rm 1 > /dev/null 2>&1

parted /dev/sda mkpart primary linux-swap 0 2048
parted /dev/sda mkpart primary ext2 2049 22529
parted /dev/sda mkpart primary ext2 22530 -- -0

sleep 2

mkswap /dev/sda1
mkfs.ext3 /dev/sda2
mkfs.ext3 /dev/sda3