Subject: disklabel and installboot
To: None <port-i386@NetBSD.ORG>
From: Hiroyuki Ito <hiroy@netcom.com>
List: port-i386
Date: 06/30/1997 15:42:01
Peace.
% uname -srm
NetBSD 1.2G i386
% alias hd hexdump -e \''"%06_ax " 16/1 " %02x"'\'\
-e \''" " "%_p"'\' -e \''"\n"'\'
% alias hd
hexdump -e '"%06_ax " 16/1 " %02x"' -e '" " "%_p"' -e '"\n"'
% hd -s 32 /usr/mdec/biosboot.sym | head -2
000020 66 ea 08 00 00 00 c0 07 8c c8 8e d8 66 b8 00 01 f...........f...
000030 00 00 8e d0 66 bc fc ff 00 00 8e c0 80 fa 80 66 ....f..........f
% whoami
root
% disklabel -r sd0 > protofile
% egrep '^#|^ [ac]:' protofile
# /dev/rsd0d:
# size offset fstype [fsize bsize cpg]
a: 65536 491520 4.2BSD 1024 8192 16 # (Cyl. 240 - 271)
c: 3686400 491520 unused 0 0 # (Cyl. 240 - 2039)
% dd if=/dev/rsd0a of=xxx count=16
16+0 records in
16+0 records out
8192 bytes transferred in 1 secs (8192 bytes/sec)
% hd xxx | head -2
000000 66 ea 08 00 00 00 c0 07 8c c8 8e d8 66 b8 00 01 f...........f...
000010 00 00 8e d0 66 bc fc ff 00 00 8e c0 80 fa 80 66 ....f..........f
%
% man disklabel | col -b | sed -n 75,80p
With the -R flag, disklabel is capable of restoring a disk label that was
formatted in a prior operation and saved in an ascii file. The prototype
file used to create the label should be in the same format as that pro-
duced when reading or editing a label. Comments are delimited by # and
newline. As with -w, any existing bootstrap code will be clobbered if -r
is specified and will be unaffected otherwise.
% disklabel -Rr sd0 ./protofile
% dd if=/dev/rsd0a of=xxx count=16
16+0 records in
16+0 records out
8192 bytes transferred in 1 secs (8192 bytes/sec)
% hd xxx
000000 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
*
000200 57 45 56 82 04 00 00 00 6d 79 73 64 00 00 00 00 WEV.....mysd....
000210 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
000220 00 00 00 00 00 00 00 00 00 02 00 00 20 00 00 00 ............ ...
000230 40 00 00 00 f8 07 00 00 00 08 00 00 00 c0 3f 00 @.............?.
000240 00 00 00 00 00 00 00 00 10 0e 01 00 00 00 00 00 ................
000250 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
*
000280 00 00 00 00 57 45 56 82 a8 52 08 00 00 20 00 00 ....WEV..R... ..
000290 00 20 00 00 00 00 01 00 00 80 07 00 00 04 00 00 . ..............
0002a0 07 08 10 00 00 80 01 00 00 80 08 00 00 00 00 00 ................
0002b0 01 00 00 00 00 40 38 00 00 80 07 00 00 00 00 00 .....@8.........
0002c0 00 00 00 00 00 c0 3f 00 00 00 00 00 00 00 00 00 ......?.........
0002d0 00 00 00 00 00 00 26 00 00 00 0a 00 00 04 00 00 ......&.........
0002e0 07 08 10 00 00 c0 08 00 00 00 32 00 00 04 00 00 ..........2.....
0002f0 07 08 10 00 e0 bf 03 00 20 00 00 00 00 00 00 00 ........ .......
000300 08 00 00 00 e0 bf 03 00 20 c0 03 00 00 00 00 00 ........ .......
000310 08 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
000320 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 ................
*
%
Not peace.
% /usr/mdec/installboot /usr/mdec/biosboot.sym /dev/rsd0a
% dd if=/dev/rsd0a of=xxx count=16
16+0 records in
16+0 records out
8192 bytes transferred in 1 secs (8192 bytes/sec)
% hd xxx | head -2
000000 66 ea 08 00 00 00 c0 07 8c c8 8e d8 66 b8 00 01 f...........f...
000010 00 00 8e d0 66 bc fc ff 00 00 8e c0 80 fa 80 66 ....f..........f
%
Peace.
Hiroyuki Ito