Re: Questions : disk partition re-reading

From: Andries Brouwer
Date: Tue Apr 20 2004 - 02:49:01 EST


On Sun, Apr 18, 2004 at 03:24:46PM +0200, Remi Colinet wrote:

> I have 2 questions about disk partitioning under linux 2.6.x :
>
> 1/ Is it possible to alter a disk partition of a used disk and beeing
> able to use the modified partition without having to reboot the box?

Yes. Look at partx.

> 2/ Is it possible to delete a disk partition without having the
> partition numbers changed?

Yes. Look at partx.

> Do I need to upgrade fdisk or use an other utility? Or do I need to
> apply a kernel patch?

You must distinguish the on-disk partition table and the kernel
partition table. You can change the on-disk partition table just by
writing to it, but that does not change the kernel's ideas.
You can change the kernel partition table using the right ioctls
but that does not change the bits on disk.

Usually one does
blockdev --rereadpt /dev/something
after changing media, or after writing to the partition table,
but that will fail if the disk is busy.
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/