dynamic partitions

Jon Peatfield (J.S.Peatfield@damtp.cam.ac.uk)
17 May 1997 03:27:34 +0100


I have a crazy idea to implement a pair of ioctl()s to allow the
setting of the start and size of a device partition.

The reason for wanting this is on a bunch of machines which can't be
re-partitioned (management) but areas of the disk can be arranged to
be usable (various tricks). Of course one needs to be sure that the
"partition" isn't in use when making such changes.

Looking through the block drivers, it seems easy enough to add code
like (for ide.c):

case BLKSETSIZE: /* Set device size */
if (!suser()) return -EACCES;
drive->part[MINOR(inode->i_rdev)&PARTN_MASK].nr_sects = arg;
return 0 ;
case BLKSETSTART: /* Set device start */
if (!suser()) return -EACCES;
drive->part[MINOR(inode->i_rdev)&PARTN_MASK].start_sect = arg;
return 0 ;

(and appropriate definitions in fs.h for BLKSETSIZE/START).

It seems that such changes would need to be made to every block
driver. Is there a better place to add partition changing code?

Is there a better way to do what is wanted? I've also considered a new
block device which maps to part of an existing dev (sort of inverse md
driver), but that is far more complex and seems to provide no
additional functionality.

-- 
Jon Peatfield,  DAMTP,  Computer Officer,   University of Cambridge
Telephone: +44 1223  3 37852    Mail: J.S.Peatfield@damtp.cam.ac.uk