[CentOS] Command line partition manipulation

Fri Aug 8 14:10:50 UTC 2008
Plant, Dean <dean.plant at roke.co.uk>

Karanbir Singh wrote:
> Plant, Dean wrote:
>> Is there a way to use a non-interactive command to create the new 2nd
>> partition in the free space?
> 
> parted works well for such situations, and if python is your thing,
> pyparted is already included in the distro.
> 
Sorry, I should have worded my first email better.

I know there are command line tools like fdisk, sfdisk and parted.

I am trying to script the creation of a partition in the free space of a
disk without knowing the exact structure of the disk. Parted seems to
want to know the exact layout you want to create

>From the man page 

mkpart part-type [fs-type] start end

But the script will not know the start or the end point.

Something similar to what I am trying to achieve is described here
http://ubuntuforums.org/showthread.php?p=5435429

They seem to be creating a single partition the size of the disk without
specifying the exact sizes.

# parted /dev/${i} --script -- mkpart primary 0 -1

Similar to this, I want to create a partition without knowing the exact
start or end point but im not interested in that, I just want to use the
free space.

Hope this is clearer.

Thanks

Dean.