bug-parted
[Top][All Lists]
Advanced

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

Re: resizing containerpartition and keeping startpoint intact


From: Szakacsits Szabolcs
Subject: Re: resizing containerpartition and keeping startpoint intact
Date: Mon, 22 Nov 2004 18:42:41 +0100 (MET)

On Mon, 22 Nov 2004, B.Hakvoort wrote:

> I've implemented resizing of filesystems in gparted using CLI-tools and
> it works quite well. 

Great news.

> In general it's just a matter of resizing the partition (with
> libparted) and then call the specific application to resize to
> filesystem to fit the new partition.

In general, it is not. Check out the either resize2fs, 
resize_reiserfs or ntfsresize man page. The fs and partition 
resizing order is important.
 
> However, the code to resize the partition also changes the startpoint to
> match the cylinderboundary. When a partition is created by a decent
> partitionmanager this isn't a problem, but when it's created by a
> program that doesn't care about cylinders etc.. it's very dangerous.
> For instance, i just killed a partition/filsystem which was created by
> Partition Magic 5.0 . The startsector had moved a bit and none of the
> e2fstools could ever find the ext2 filesystem back.
> ( np here, it's just a testdisk =) )
> 
> So, here's my question, how do i resize (shrink/grow) a partition while
> keeping the startpoint _extact_ as it was?
> Here's a code snippet of my current resizer:
> --------------------------------------------------------
> constraint = ped_constraint_any( device );
> ped_disk_set_partition_geom ( disk, c_partition, constraint, start,
> end ) ;
> ----------------------------------------------------------------
> 
> I guess i need to create another contraint, but looking at the API i
> can't figure out how to get a fixed startpoint. Maybe i should use
> constraint_exact ?

Well, I've never looked the API but I guess you should use
ped_constraint_exact instead of ped_constraint_any and not 
additionally.

You should also make sure that the partition end is not 
rounded down to a cylinder boundary in the middle of the 
filesystem. This is also one of the a common problems of 
partitioners.

        Szaka





reply via email to

[Prev in Thread] Current Thread [Next in Thread]