RE: Command line partition manipulation

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



On Fri, 2008-08-08 at 15:10 +0100, Plant, Dean wrote:
> 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?

Yes.

> > 
> > 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.

Sfdisk is your friend.

> 
> <snip>

> start or end point but im not interested in that, I just want to use the
> free space.
> 
> Hope this is clearer.

Having made my living for some months doing this, I offer the general
below guidelines.

1. Study sfdisk man page closely.
2. Look especially for the parts where it can output disk and partition
information in the form that can be re-read by sfdisk.
3. Use that information in a script (with your preferred combo of bash,
perl, (g)awk, bc, dc, ...) to locate total size, amount used, start/end
points, etc.
4. Calculate desired changes.
5. Apply to the saved information.
6. Run sfdisk reading the modified output from sfdisk.
7. sfdisk -R (IIRC) to re-read the partition information.

Alternately, steps 6/7 could be replaced with gparted if you structure
the results properly.

> 
> Thanks
> 
> Dean.
> <snip sig stuff>

HTH
-- 
Bill

_______________________________________________
CentOS mailing list
CentOS@xxxxxxxxxx
http://lists.centos.org/mailman/listinfo/centos

[Index of Archives]     [CentOS]     [CentOS Announce]     [CentOS Development]     [CentOS ARM Devel]     [CentOS Docs]     [CentOS Virtualization]     [Carrier Grade Linux]     [Linux Media]     [Asterisk]     [DCCP]     [Netdev]     [Xorg]     [Linux USB]
  Powered by Linux