disklabelの不思議 (3) scsictl
ddなどでディスクをつぶしてon-diskなラベルとin-coreなラベルに齟齬が発生した場合に、USB経由のディスクならば一度抜いて再度挿せばon-diskとin-coreの整合性がとれるという話の続きです。
抜き差しなんてしなくてもscsictlで同じことができるよ、というのをIRCで教えてもらいました。
具体的にはscsictlのdetach, scanを使います。
まずは、on-disk, in-coreで齟齬が発生した状況を作ります。
dmesgでみると
再度sd1を使えるようにscsictlのscanを実行します。
なるほど、抜き差し不要でラベルの同期ができるscsictlコマンドは覚えておいて損はないですね。
なお、sd1は次のようなデバイス階層で接続されていました。
抜き差しなんてしなくてもscsictlで同じことができるよ、というのをIRCで教えてもらいました。
具体的にはscsictlのdetach, scanを使います。
まずは、on-disk, in-coreで齟齬が発生した状況を作ります。
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は古いラベルを表示しています。
dmesgでみると
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当然、デバイスがないので失敗します。
再度sd1を使えるようにscsictlのscanを実行します。
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ラベルが作られました。
なるほど、抜き差し不要でラベルの同期ができるscsictlコマンドは覚えておいて損はないですね。
なお、sd1は次のようなデバイス階層で接続されていました。
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
コメント(0件)
- TB-URL http://www.tokuda.net/diary/0573/tb/