I am specifically using this to partition and mount EBS volumes on Amazon EC2 instances, but really this should be generally applicable to initializing any new drive.
As the question says I want to script the creation of a single primary partition which uses all available space on the given device. I won't know ahead of time how big the device is and it could be very large (i.e. several TB).
In researching this it seems
parted is the best command to use for scripting. I think something along the lines of
parted /dev/sdf mkpart primary 0 END is what I want, but I'm having a hard time figuring out an elegant way to determine what END should be. Does anyone know an easy way to do this?