On Wed, 21 Apr 2010 13:01:23 -0400 (EDT), Jim Meyering wrote: > Stephen Powell wrote: >> ... >> here's the problem. I get an error message about overlapping >> partitions for non-reserved CMS disks or LDL disks with a >> block size less than 4096. Here's some example output: >> ... > > Is there a formal specification somewhere for this format? > I'm wondering if the VTOC size varies depending on the block size. > I suspect that 24 is the smallest valid starting sector number > for a partition in an LDL-formatted table.
Strictly speaking, a VTOC (Volume Table Of Contents) exists only for a cdl-format (Compatibility Disk Layout) disk. For an LDL format disk or a CMS format disk, there is no VTOC, per se, but there is "metadata" which is not part of the partition. As a starting point for further research on your part, I suggest "Device Drivers, Features, and Commands" http://public.dhe.ibm.com/software/dw/linux390/docu/lk33dd05.pdf This is IBM's documentation for their kernel device drivers and s390-tools utilities for use with Linux for s390. In particular, check out "Chapter 3: DASD device driver", "What you should know about DASD", "The IBM label partitioning scheme", "Linux Disk Layout", and "CMS Disk Layout". >> Originally, the "start" variable was hard coded as 24; so ... > > When iterating over partitions, "start" is set to the > starting sector number of each. Thus, unless you're > guaranteed somehow that the first partition always starts > at the lowest possible sector, you don't really want to use > the partition starting sector number here. Yes, that is absolutely correct. An LDL- or CMS-format disk, by definition, has one and only one partition, and it is non-modifiable. By that I mean that the size and location of the partition can only be changed by reformatting the disk with a different block size, or for a CMS disk, by reserving the disk if it has just been formatted by CMS, has not been written to by Linux at all, and has not been reserved since formatting. Other than that, the partition is non-modifiable. The partition is writable. That is, you can create a file system or a swap space on it. But the size and location of the one-and- only-one partition cannot be changed. The end of the metadata (treated like a VTOC) is, by definition, the block which precedes the start of the first (and only) partition. The start of the metadata is the first block (block 0). The disk contains no free space, by definition. Formerly, start was set to 24 and vtoc_end was set to 23, hard coded. That is correct only for a block size of 4096, and for a CMS format disk, only if it is not reserved. > If you really do want to use the start sector of partition #1, > we can pursue that separately. It logically belongs with the first fix that changes the calculation of the starting block from 24 to (possibly) something else. If the calculation of the starting block of the first partition changes, then by definition the calculation of the ending block of the metadata must change with it. I apologize for sending you an incomplete fix. I didn't discover the problem with the metadata until after I sent the fix. > If there's not a specification, can you deduce what vtoc_end > must be for a 2048-byte block size by looking at what other tools do? Well, there's the kernel source code of course. The problem will be finding it. Ultimately, how the kernel determines where the partition starts (and therefore where the metadata ends) is the final authority. drivers/s390/block/dasd* would be a good place to start looking. -- .''`. Stephen Powell : :' : `. `'` `- _______________________________________________ bug-parted mailing list bug-parted@gnu.org http://lists.gnu.org/mailman/listinfo/bug-parted