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