FAQ Search Today's Posts Mark Forums Read
» Video Reviews

» Linux Archive

Linux-archive is a website aiming to archive linux email lists and to make them easily accessible for linux users/developers.


» Sponsor

» Partners

» Sponsor

Go Back   Linux Archive > Redhat > Device-mapper Development

 
 
LinkBack Thread Tools
 
Old 02-13-2012, 06:30 PM
Vivek Goyal
 
Default block: online resize of disk partitions

Hi,

Following patch adds support for online resizing of a partition. This patch
is based on previously posted patches by Phillip Susi.

There are two patches. Out of which one is kernel patch and other one is
util-linux patch to add support of a user space utility "resizepart" to
allow resizing the partition.

This ioctl only resizes the partition size in kenrel and does not change
the size on disk. A user needs to make sure that corresponding changes
are made to disk data structures also using fdisk(or partx), if changes
are to be retained across reboot.

I made some changes according to the feedback received last time. Following
are changes since the version Phillip posted.

- RESIZE ioctl ignores the partition "start" and does not expect user to
specify one. Caller needs to just specify "device", "partition number" and
"size" of new partition.

- Got rid of part_nr_sects_write_begin/part_nr_sects_write_end functions
and replaced these with single part_nr_sects_write().

- Some sequence counter related changes are simply lifted from i_size_write().

- Initialized part->nr_sects_seq using seqcount_init().

Phillip, do let me know if I should put your signed-off-by also in the
patch.

Any feedback is welcome.

I did following test.

- Create a partition of 10MB on a disk using fdisk.
- Add this partition to a volume group
- Use fdisk to increase the partition size to 20MB. (First delete the
partition and then create a new one of 20MB size).
- Use resizepart to extend partition size in kernel.
resizepart /dev/sdc 1 40960
- Do pvresize on partition so that physical volume can be incrased in
size online.
pvresize /dev/sda1

pvresize does recognize the new size. Also lsblk and /proc/partitions
report the new size of partition.

Thanks
Vivek

[PATCH 1/2] block: add partition resize function to blkpg ioctl
[PATCH 2/2] resizepart: Utility to resize a partition

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel
 
Old 02-13-2012, 08:34 PM
Phillip Susi
 
Default block: online resize of disk partitions

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 2/13/2012 2:30 PM, Vivek Goyal wrote:
> Hi,
>
> Following patch adds support for online resizing of a partition.
> This patch is based on previously posted patches by Phillip Susi.
>
> There are two patches. Out of which one is kernel patch and other
> one is util-linux patch to add support of a user space utility
> "resizepart" to allow resizing the partition.
>
> This ioctl only resizes the partition size in kenrel and does not
> change the size on disk. A user needs to make sure that
> corresponding changes are made to disk data structures also using
> fdisk(or partx), if changes are to be retained across reboot.
>
> I made some changes according to the feedback received last time.
> Following are changes since the version Phillip posted.
>
> - RESIZE ioctl ignores the partition "start" and does not expect
> user to specify one. Caller needs to just specify "device",
> "partition number" and "size" of new partition.

I would prefer that the start argument not be left undefined. I
checked it to make sure it was unchanged as a simple sanity check to
guard against user space being goofy, as well as to allow for the
possibility of extending the interface in the future to allow changing
the start as well as the length.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.17 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJPOYH+AAoJEJrBOlT6nu75rvwIALjEMrUZPE vwYzH9MI9wHmGg
lZzeBTSalqEOWL/hM0Ge6o1Of1adjeEyB7riXi7Fbb4Z8U55oBkAyKcRD/fdm0EA
8SyfMnGnMqZjh6VthIZMw43HbNwHojXeu2ri4ygeUORMIrX8tm ZLAePw6iuOWcX6
qxOZsJOz3CdoGy2yc362AuIQACKH6IfFimP81NH5uUA01DIawW pes3EuN+KcxOQP
hlIeixVPzlNrXuDY/m35xlXNaXcTUqTYFJ30vvVn0/MHylAbfCXKx6P19jvPHTt9
j0OyBNVnsb/BCKsbSW89lfHoVPMeYC6Kz2u8d1AX5byCxcYcznqclA6S93/UUms=
=ZABC
-----END PGP SIGNATURE-----

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel
 
Old 02-13-2012, 08:50 PM
Vivek Goyal
 
Default block: online resize of disk partitions

On Mon, Feb 13, 2012 at 04:34:54PM -0500, Phillip Susi wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On 2/13/2012 2:30 PM, Vivek Goyal wrote:
> > Hi,
> >
> > Following patch adds support for online resizing of a partition.
> > This patch is based on previously posted patches by Phillip Susi.
> >
> > There are two patches. Out of which one is kernel patch and other
> > one is util-linux patch to add support of a user space utility
> > "resizepart" to allow resizing the partition.
> >
> > This ioctl only resizes the partition size in kenrel and does not
> > change the size on disk. A user needs to make sure that
> > corresponding changes are made to disk data structures also using
> > fdisk(or partx), if changes are to be retained across reboot.
> >
> > I made some changes according to the feedback received last time.
> > Following are changes since the version Phillip posted.
> >
> > - RESIZE ioctl ignores the partition "start" and does not expect
> > user to specify one. Caller needs to just specify "device",
> > "partition number" and "size" of new partition.
>
> I would prefer that the start argument not be left undefined. I
> checked it to make sure it was unchanged as a simple sanity check to
> guard against user space being goofy,

I am not sure that it is really helping. I looked at pvresize, lvresize
and resize2fs user interfaces and a user has to just specify the new
size of physical volume, logical volume, filesystem respectively. So
it makes sense to keep partition resize interface inline with above
tools.

So if a user anyway does not specify the start of sector, then tools
shall have to first read it and then call the ioctl. If anyway tools
are specifying, there is no much scope of screwing up the things?

Also in delete partition ioctl, we just ask the user the partition
number being deleted. We don't ask for start and size of partition
in an effort to verify that you are deleting the right partition.

> as well as to allow for the
> possibility of extending the interface in the future to allow changing
> the start as well as the length.

Even if we allow changing start at some point of time, then IOCTL can
remain the same and just the implementation will change in a backward
compatible manner. Old tools still will continue to work as they have
always been, and new ones can start passing "start" too.

So I really did not find passing and checking "start" of partition
very appealing.

Thanks
Vivek

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel
 
Old 02-13-2012, 08:56 PM
Vivek Goyal
 
Default block: online resize of disk partitions

On Mon, Feb 13, 2012 at 04:50:39PM -0500, Vivek Goyal wrote:

[..]
> > as well as to allow for the
> > possibility of extending the interface in the future to allow changing
> > the start as well as the length.
>
> Even if we allow changing start at some point of time, then IOCTL can
> remain the same and just the implementation will change in a backward
> compatible manner. Old tools still will continue to work as they have
> always been, and new ones can start passing "start" too.

Let me thake that back. Changes will not be backward compatible as
if old tools run on new kernel specifying start as 0, then change
will fail on newer kernels which might allow changing start too.

Do you really expect that changing start will really be useful? If yes,
then it does make a case for not leaving "start" undefined.

Thanks
Vivek

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel
 
Old 02-13-2012, 09:18 PM
Phillip Susi
 
Default block: online resize of disk partitions

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 2/13/2012 4:50 PM, Vivek Goyal wrote:
> So if a user anyway does not specify the start of sector, then
> tools shall have to first read it and then call the ioctl. If
> anyway tools are specifying, there is no much scope of screwing up
> the things?

Tools certainly should know where the partition starts. I already
have patched parted and partx to pass the current size, which they
had trivially available. Making sure of that is a good sanity check
to guard against, for instance, resizing the wrong partition.

> Even if we allow changing start at some point of time, then IOCTL
> can remain the same and just the implementation will change in a
> backward compatible manner. Old tools still will continue to work
> as they have always been, and new ones can start passing "start"
> too.
>
> So I really did not find passing and checking "start" of partition
> very appealing.

That is exactly why passing and checking start is required. If it is
entirely ignored, then the interface can not start using it in the
future in a backward compatible way, because user mode tools will have
grown used to passing in any kind of garbage, so if the kernel starts
using it to alter the start position of the partition, older tools
would randomly and accidentally be shifting the the start of
partitions they just mean to change the length of.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2.0.17 (MingW32)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJPOYw5AAoJEJrBOlT6nu75CV4H/2vyZwujRqb+mqTAfQ+/XJE7
E850b+MOFZEQEoKQy+XAeu15pmm/TIa8NTk83kBeoQb30P2sU814+rJjbMKpZ9x/
xc8DZVC+DdnLLJ8a9aQw5feV0nmy102QrL0CWS+Wi6vS3DLlLC QQ+nv7AZ1jPV0Z
NPzqtmI/zBopf/F2IrL+5DLD9TAi7mf+Yv5IBb7w2JQSiU9LoBo9TTMJhPAhaqtC
ihqSJ0Q/t0DG3WacK+8fwh6Jyta1Bx+YsoUzYijtsaH6GQ1zbe+3c44T1J MI+Zvq
30M8V7y1BsLhp+lfZSUlC5YvPpu7gCJ1lg2fpMz56q2DENURj3 L1HkdFwPwfLcw=
=TTAk
-----END PGP SIGNATURE-----

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel
 
Old 02-13-2012, 09:24 PM
Vivek Goyal
 
Default block: online resize of disk partitions

On Mon, Feb 13, 2012 at 05:18:33PM -0500, Phillip Susi wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> On 2/13/2012 4:50 PM, Vivek Goyal wrote:
> > So if a user anyway does not specify the start of sector, then
> > tools shall have to first read it and then call the ioctl. If
> > anyway tools are specifying, there is no much scope of screwing up
> > the things?
>
> Tools certainly should know where the partition starts. I already
> have patched parted and partx to pass the current size, which they
> had trivially available. Making sure of that is a good sanity check
> to guard against, for instance, resizing the wrong partition.

Ok, so user still specifies just the new size of partition and tool
passes in both the "start" and new "size" to the ioctl?

>
> > Even if we allow changing start at some point of time, then IOCTL
> > can remain the same and just the implementation will change in a
> > backward compatible manner. Old tools still will continue to work
> > as they have always been, and new ones can start passing "start"
> > too.
> >
> > So I really did not find passing and checking "start" of partition
> > very appealing.
>
> That is exactly why passing and checking start is required. If it is
> entirely ignored, then the interface can not start using it in the
> future in a backward compatible way, because user mode tools will have
> grown used to passing in any kind of garbage, so if the kernel starts
> using it to alter the start position of the partition, older tools
> would randomly and accidentally be shifting the the start of
> partitions they just mean to change the length of.

Ok, I think keeping the ioctl backward compatible in light of any
future changes makes sense. I will change the patches to not ignore
the partition "start" and repost.

Thanks for the comments.

Vivek

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel
 
Old 02-14-2012, 12:24 AM
Phillip Susi
 
Default block: online resize of disk partitions

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 02/13/2012 05:24 PM, Vivek Goyal wrote:
> Ok, so user still specifies just the new size of partition and tool
> passes in both the "start" and new "size" to the ioctl?

Bingo. Eventually I'm kicking around the idea of having the ioctl allow
changing the start and modifying gparted to be able to use that on a
mounted partition if the fs supports it ( I think btrfs could be made
to without too much difficulty ). In the mean time, libparted enforces
the start remaining unchanged and parted, gparted, and kpartx automatically
use the existing start position.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJPObfXAAoJEJrBOlT6nu75IKwH/jKcbW6L/j/v7hF0rXHql7Tg
/E17+L37YvtwNA3aiZvDmj6FWablT2Dmvi/zcPITJ0FOWtZ+HKQ6+1odqPWRkOl/
4gQrcUyYn/OK/RqyqCM9O6AwpiKZCvAn9LmDc0BCKDptbKshXe+L2GmgOQbiFSd k
2rcbncXI9Sz1pt8nCP8M3gNdYIl6Ln2u0PxwohMoIVGFDhxETd zm8YfX9MfH4Ay6
FU+5chGJUEiXQgjDw5k+vgX85Xc4pC7IRR6vqAZ5I69RxWB4DB teiR0znBNBZG1Z
Mg8cAJTku2n4fZojCAXv35i3gRa3bgwyHv0suaSc2BGKYEeAu4 1ncAC3q77Arp4=
=Qxgd
-----END PGP SIGNATURE-----

--
dm-devel mailing list
dm-devel@redhat.com
https://www.redhat.com/mailman/listinfo/dm-devel
 

Thread Tools




All times are GMT. The time now is 07:24 AM.

VBulletin, Copyright ©2000 - 2014, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright 2007 - 2008, www.linux-archive.org