sunlabel.c is the source. It should build Just Fine on any NetBSD machine; with -DDISTRIB, probably on many non-NetBSD machines - though it may require a little tweaking on some. It should work on both big-endian and little-endian machines; though I have not personally tried it on anything but SPARC and sun3, I have heard one report that it worked on NetBSD/i386, which is little-endian. Usage: pass a single argument, which is the disk device or file you wish to read/write the label to/from. sunlabel reads/writes only the first 512 bytes of its argument. There are also some flags supported: -d takes an argument specifying the disk device (in case you want to give something beginning with a -) -m says to ignore an incorrect magic number in the disk label -s says to ignore checksum errors when reading the label -n says to synthesize a new label rather than reading what's there -q quiet mode - don't print unnecessary babble (currently this suppresses the "sunlabel>" prompt). Note that -fixmagic is dangerous, especially when combined with -fixsum, since it will then happily believe whatever garbage it may find in the label. If you use these, you should check all values carefully, both the values printed by L and the partition table printed by P. sunlabel prints a prompt "sunlabel>" and expects commands. You can type ? for help; as of this writing, the help is ? - print this help L - print label, except for partition table P - print partition table [abcdefghijklmnop] - change partition V - change a non-partition label value W - write (possibly modified) label out S - set label in the kernel (orthogonal to W) Q - quit program (error if no write since last change) Q! - quit program (unconditionally) [EOF also quits] (If built without special precautions, the S line is present only when built on NetBSD.) The a through p commands will accept, for the parameter, the nnn/nnn/nnn syntax used by SunOS 4.x format(8). (For those not familiar with this syntax, a/b/c means a cylinders + b tracks + c sectors. For example, if the disk has 16 tracks of 32 sectors, 3/4/5 means (3*16*32)+(4*32)+5=1669. This calculation always uses the nsect and ntrack values as printed by the L command; in particular, if they are zero (which they will initially be if -new is used), this syntax is not very useful. Some additional strings are accepted. For the parameter, "end-X" (where X is a partition letter) indicates that the partition should start with the first free cylinder after partition X; "start-X" indicates that the partition should start at the same place as partition X. For the parameter, "end-X" indicates that the partition should end at the same place as partition X (even if partition X ends partway through a cylinder); "start-X" indicates that the partition should end with the last cylinder before partition X; and "size-X" means that the partition's size should exactly match partition X's size. Note that sunlabel supports 16 partitions. SunOS supports only 8. Labels written by sunlabel, when partitions i through p are all set offset=0 size=0, are identical to Sun labels. If any of the "extended" partitions are nontrivial, information about them is tucked into some otherwise unused (as far as I can tell) space in the Sun label format. I don't know whether SunOS cares what's in that space; as far as I know only NetBSD actually uses the extended information, and even that only with my patches to do so. The V command changes fields printed by the L command. For example, if the L command prints ascii: ST15230N cyl 5657 alt 2 hd 19 sec 78 rpm: 0 pcyl: 0 apc: 0 obs1: 0 obs2: 0 intrlv: 1 ncyl: 5657 acyl: 0 nhead: 19 nsect: 78 obs3: 0 obs4: 0 then you could type "V ncyl 6204" to set the ncyl value to 6204, or "V ascii Seagate ST15230N cyl 5657 hd 19 sec varying" to set the ascii-label string to that string. sunlabel performs very few consistency checks on the values you supply, and the ones it does perform never generate errors, only warnings; it's a YAFIYGI program. I will be glad to correspond with anyone about this program. I'm... der Mouse mouse@rodents.montreal.qc.ca 7D C8 61 52 5D E7 2D 39 4E F1 31 3E E8 B3 27 4B