[dm-devel] Partition size set to 0 when resizing extended and adding logical partition with BLKPG

Phillip Susi phill at thesusis.net
Tue Apr 9 17:33:53 UTC 2019


On 4/9/2019 12:41 PM, Kai Lüke wrote:
> $ sudo ./sim loop0
> new size in /sys/block/loop0/loop0p1/size: 0
> issuing BLKRRPART
> new size in /sys/block/loop0/loop0p1/size: 2

> int resizepart(char *path, int start, int fd) {
>   struct blkpg_partition part;
>   struct blkpg_ioctl_arg ioctl_arg;
>   memset(&part, 0, sizeof(part));
>   part.start = start;
>   part.length = 1;

I would suggest changing length to 2.  This is what parted and partx do
and it seems to work there.  Linux has always exposed 2 sectors through
the extended partition so you can have lilo install itself there.  It
may be that the kernel thinks that is the minimum allowed size.




More information about the dm-devel mailing list