今日も雨で大変です。
でも、朝はすんなり起きたんです。えらい。
今日は音楽の授業があって、学校で習った歌を聴かせてくれました。
でも、朝はすんなり起きたんです。えらい。
今日は音楽の授業があって、学校で習った歌を聴かせてくれました。
2008年4月の日記
eeepc# dd if=/dev/zero of=/dev/rsd1d count=1 1+0 records in 1+0 records out 512 bytes transferred in 0.001 secs (512000 bytes/sec)
eeepc# disklabel -r sd1 disklabel: could not read existing label
eeepc# disklabel sd1 # /dev/rsd1d: 中略 4 partitions: # size offset fstype [fsize bsize cpg/sgs] a: 31388609 63 4.2BSD 0 0 0 # (Cyl. 0*- 15326*) c: 31388609 63 unused 0 0 # (Cyl. 0*- 15326*) d: 31388672 0 unused 0 0 # (Cyl. 0 - 15326*) eeepc#on-diskはラベルがなく、in-coreは古いラベルを表示しています。
sd1 at scsibus1 target 0 lun 0: <Generic, USB SD Reader, 1.00> disk removableとなっていますのでscsictlに与えるdeviceはscsibus1, targetは0, lunは0だとわかります。
eeepc# scsictl /dev/scsibus1 detach 0 0 sd1 detachedsd1が切り離されました。それではdisklabel sd1はどうでしょうか?
eeepc# disklabel sd1 disklabel: /dev/rsd1d: Device not configured当然、デバイスがないので失敗します。
eeepc# scsictl /dev/scsibus1 scan 0 0 sd1 at scsibus1 target 0 lun 0: <Generic, USB SD Reader, 1.00> disk removable sd1: fabricating a geometry sd1: 15326 MB, 15326 cyl, 64 head, 32 sec, 512 bytes/sect x 31388672 sectors sd1: fabricating a geometrysd1がattachされたようなのでdisklabelを見ます。
eeepc# disklabel sd1 # /dev/rsd1d: 中略 4 partitions: # size offset fstype [fsize bsize cpg/sgs] a: 31388672 0 4.2BSD 0 0 0 # (Cyl. 0 - 15326*) d: 31388672 0 unused 0 0 # (Cyl. 0 - 15326*) disklabel: boot block size 0 disklabel: super block size 0ddでつぶされてon-diskなラベルがないため、fictitiousなin-coreラベルが作られました。
mainbus0 (root) pci0 at mainbus0 bus 0: configuration mode 1 ehci0 at pci0 dev 29 function 7: Intel 82801FB/FR USB EHCI Controller (rev. 0x04) usb4 at ehci0: USB revision 2.0 uhub4 at usb4 umass1 at uhub4 port 3 configuration 1 interface 0 scsibus1 at umass1: 2 targets, 3 luns per target sd1 at scsibus1 target 0 lun 0: <Generic, USB SD Reader, 1.00> disk removable
label: fictitiousというコメントをいただいたので試してみました。
っていう行が(これは良きにはからったものだよ)という意味になっているかどうか、つまり本当に、「良きにはからった時」だけに表示されるかが気になるのですが、自分では実はまだ確めたことがないのです。
eeepc# fdisk sd1 fdisk: primary partition table invalid, no magic in sector 0 fdisk: Cannot determine the number of heads Disk: /dev/rsd1d NetBSD disklabel disk geometry: cylinders: 31, heads: 64, sectors/track: 32 (2048 sectors/cylinder) total sectors: 64000 BIOS disk geometry: cylinders: 31, heads: 64, sectors/track: 32 (2048 sectors/cylinder) total sectors: 64000 Partition table: 0: <UNUSED> 1: <UNUSED> 2: <UNUSED> 3: <UNUSED> Bootselector disabled. No active partition. eeepc#
eeepc# disklabel -r sd1 disklabel: could not read existing label eeepc#たしかにon-diskなラベルはありませんね。では、in-coreラベルを作ってもらい、それを表示してもらいましょう。
eeepc# disklabel sd1 # /dev/rsd1d: type: SCSI disk: ClipDrive label: fictitious flags: removable bytes/sector: 512 sectors/track: 32 tracks/cylinder: 64 sectors/cylinder: 2048 cylinders: 31 total sectors: 64000 rpm: 3600 interleave: 1 trackskew: 0 cylinderskew: 0 headswitch: 0 # microseconds track-to-track seek: 0 # microseconds drivedata: 0 4 partitions: # size offset fstype [fsize bsize cpg/sgs] a: 64000 0 4.2BSD 0 0 0 # (Cyl. 0 - 31*) d: 64000 0 unused 0 0 # (Cyl. 0 - 31*) disklabel: boot block size 0 disklabel: super block size 0 eeepc#おぉ、labelにfictitiousが表示されてます。
eeepc# disklabel -i -I sd1 partition> P 4 partitions: # size offset fstype [fsize bsize cpg/sgs] a: 64000 0 4.2BSD 0 0 0 # (Cyl. 0 - 31*) d: 64000 0 unused 0 0 # (Cyl. 0 - 31*) partition> W Label disk [n]? y Label written partition> Q eeepc#
eeepc# disklabel -r sd1 # /dev/rsd1d: type: SCSI disk: ClipDrive label: fictitious flags: removable bytes/sector: 512 sectors/track: 32 tracks/cylinder: 64 sectors/cylinder: 2048 cylinders: 31 total sectors: 64000 rpm: 3600 interleave: 1 trackskew: 0 cylinderskew: 0 headswitch: 0 # microseconds track-to-track seek: 0 # microseconds drivedata: 0 4 partitions: # size offset fstype [fsize bsize cpg/sgs] a: 64000 0 4.2BSD 0 0 0 # (Cyl. 0 - 31*) d: 64000 0 unused 0 0 # (Cyl. 0 - 31*) eeepc#あれ? on-diskラベルでもfictitiousって表示されます。
1: makoto fujiwara 『その文字をそのままにしておくと、書いてしまう、なんて思っても見ませんでした。良く分りましたね。すごい。というか書くときに fic...』 (2008/04/09 16:25)
Disk: /dev/rsd1d NetBSD disklabel disk geometry: cylinders: 15326, heads: 64, sectors/track: 32 (2048 sectors/cylinder) total sectors: 31388672 BIOS disk geometry: cylinders: 1023, heads: 255, sectors/track: 63 (16065 sectors/cylinder) total sectors: 31388672 Partition table: 0: Primary DOS with 32 bit FAT - LBA (sysid 12) start 8192, size 31380480 (15323 MB, Cyls 0/130/3-1953/217/56) 1: <UNUSED> 2: <UNUSED> 3: <UNUSED> No active partition.で、disklabel sd1の結果はこんな感じ。
# /dev/rsd1d: type: SCSI disk: USB SD Reader label: fictitious flags: removable bytes/sector: 512 sectors/track: 32 tracks/cylinder: 64 sectors/cylinder: 2048 cylinders: 15326 total sectors: 31388672 rpm: 3600 interleave: 1 trackskew: 0 cylinderskew: 0 headswitch: 0 # microseconds track-to-track seek: 0 # microseconds drivedata: 0 5 partitions: # size offset fstype [fsize bsize cpg/sgs] d: 31388672 0 unused 0 0 # (Cyl. 0 - 15326*) e: 31380480 8192 MSDOS # (Cyl. 4 - 15326*)つまり、fdiskでMS-DOSのパーティションが切ってあって、disklabelでそれが反映された格好になっているわけですね。
# dd if=/dev/zero of=/dev/rsd1d bs=512k count=100てな感じで、マスターブートレコード (MBR) はもちろん、NetBSDパーティションの先頭もつぶしたつもりになっていました。なにしろ50MBほどゼロでつぶしたので、間違いないだろうと。
On systems that expect to have disks with MBR partitions (see fdisk(8)) disklabel will find, and update if requested, labels in the first 8k of type 169 (NetBSD) MBR labels and within the first 8k of the physical disk. On other systems disklabel will only look at the start of the disk. The offset at which the labels are written is also system dependent.これは、i386のようなMBRがあるようなシステムでは、disklabelはNetBSDパーティションの先頭8kか物理ディスクの先頭8kを探しますってことで、つまりディスクの先頭かパーティションの先頭にラベルが書かれるわけですよね。
# /dev/rsd1d: type: SCSI 中略 4 partitions: # size offset fstype [fsize bsize cpg/sgs] a: 31388672 0 4.2BSD 0 0 0 # (Cyl. 0 - 15326*) d: 31388672 0 unused 0 0 # (Cyl. 0 - 15326*) disklabel: boot block size 0 disklabel: super block size 0という感じであってますかね?