Subject: Experiment on disklabel
To: None <port-i386@NetBSD.ORG>
From: Hiroyuki Ito <hiroy@netcom.com>
List: port-i386
Date: 10/17/1996 08:37:12
Summary:

 "disklabel -r sd0 > proto && disklabel -Rr sd0 proto" is harmful.

Detail:

% uname -srm
NetBSD 1.2 i386
% whoami
root
% disklabel -r sd0 | egrep '^  [cd]:|^#  '
#        size   offset    fstype   [fsize bsize   cpg]
  c:  3686400   491520    unused        0     0       	# (Cyl.  240 - 2039)
  d:  4177920        0    unused        0     0       	# (Cyl.    0 - 2039)
% dd if=/dev/sd0d of=save_1 skip=1 count=16
16+0 records in
16+0 records out
8192 bytes transferred in 1 secs (8192 bytes/sec)
% dd if=/dev/sd0d of=save_2 skip=491520 count=16
16+0 records in
16+0 records out
8192 bytes transferred in 1 secs (8192 bytes/sec)
% jot -r -c -s "" -n `expr 512 \* 16` 0 256 > block.1_16
% dd if=block.1_16 of=/dev/sd0d seek=1
16+0 records in
16+0 records out
8192 bytes transferred in 1 secs (8192 bytes/sec)
% disklabel -r sd0 > proto && disklabel -Rr sd0 proto
% dd if=/dev/sd0d of=xxx skip=491520 count=16
16+0 records in
16+0 records out
8192 bytes transferred in 1 secs (8192 bytes/sec)
% dd if=xxx of=block.1_16 skip=1 seek=1 count=1
1+0 records in
1+0 records out
512 bytes transferred in 1 secs (512 bytes/sec)
% cmp block.1_16 xxx
% dd if=save_1 of=/dev/sd0d seek=1
16+0 records in
16+0 records out
8192 bytes transferred in 1 secs (8192 bytes/sec)
% dd if=save_2 of=/dev/sd0d seek=491520
16+0 records in
16+0 records out
8192 bytes transferred in 1 secs (8192 bytes/sec)
% 

Hiroyuki Ito