デバイスの認識

USBメモリをUSBポートに刺すと、勝手にSCSIデバイス (sda1) として認識されます

grape:~ # dmesg
・・・
usb 5-3: new high speed USB device using ehci_hcd and address 3
SCSI subsystem initialized
Initializing USB Mass Storage driver...
scsi0 : SCSI emulation for USB Mass Storage devices
usb-storage: device found at 3
usb-storage: waiting for device to settle before scanning
usbcore: registered new driver usb-storage
USB Mass Storage support registered.
  Vendor: I-O DATA  Model: USB Flash Disk    Rev: 5.00
  Type:   Direct-Access                      ANSI SCSI revision: 00
usb-storage: device scan complete
SCSI device sda: 2015232 512-byte hdwr sectors (1032 MB)
sda: Write Protect is off
sda: Mode Sense: 23 00 00 00
sda: assuming drive cache: write through
SCSI device sda: 2015232 512-byte hdwr sectors (1032 MB)
sda: Write Protect is off
sda: Mode Sense: 23 00 00 00
sda: assuming drive cache: write through
 sda: sda1
Attached scsi removable disk sda at scsi0, channel 0, id 0, lun 0
Attached scsi generic sg0 at scsi0, channel 0, id 0, lun 0,  type 0
subfs 0.9

ファイルシステムへのマウント

grape:~ # mkdir /mnt/usbfm
grape:~ # mount -t vfat -o codepage=932,iocharset=utf8 /dev/sda1 /mnt/usbfm/
grape:~ # ls /mnt/usbfm
.  ..  新規テキスト ドキュメント.txt
grape:~ # umount /mnt/usbfm/

Format

grape:~ $ sudo mkfs.vfat -v -c -F 32 /dev/sda1

"-F" は FAT16、"-F 32" は FAT32

自動マウント(autofs)

  1. autofs を使って、ファイルシステムを参照するごとにマウントします
  2. まずは、/etc/auto.master の編集
    # cat /etc/auto.master
    
    #
    # $Id: auto.master,v 1.4 2005/01/04 14:36:54 raven Exp $
    #
    # Sample auto.master file
    # This is an automounter map and it has the following format
    # key [ -mount-options-separated-by-comma ] location
    # For details of the format look at autofs(5).
    /misc   /etc/auto.misc --timeout 60
    #/smb   /etc/auto.smb
    #/misc  /etc/auto.misc
    #/net   /etc/auto.net
    • このファイルは、名前の通りマスターの役割をします。
    • どのデバイスをどこにマウントするかは、配下のファイルに記述します。
    • ここでは、/etc/auto.misc に記述したデバイスを /misc にマウントします。
    • 60秒間アクセスがなかったらアンマウントします。
    • Suse 10 のテンプレートにある timeout=60 は間違え
  3. /etc/auto.misc の編集
    # cat /etc/auto.misc
    
    #
    # $Id: auto.misc,v 1.2 2003/09/29 08:22:35 raven Exp $
    #
    # This is an automounter map and it has the following format
    # key [ -mount-options-separated-by-comma ] location
    # Details may be found in the autofs(5) manpage
    
    cd              -fstype=iso9660,ro,nosuid,nodev :/dev/cdrom
    
    # the following entries are samples to pique your imagination
    #linux          -ro,soft,intr           ftp.example.org:/pub/linux
    #boot           -fstype=ext2            :/dev/hda1
    #floppy         -fstype=auto            :/dev/fd0
    #floppy         -fstype=ext2            :/dev/fd0
    #e2floppy       -fstype=ext2            :/dev/fd0
    #jaz            -fstype=ext2            :/dev/sdc1
    #removable      -fstype=ext2            :/dev/hdd
    
    usbfm           -fstype=vfat,codepage=932,iocharset=utf8 :/dev/sda1
  4. autofs を自動起動するようにする
    # chkconfig --level 35 autofs on
    # chkconfig --list | grep autofs
    autofs                    0:off  1:off  2:off  3:on   4:off  5:on   6:off
  5. 取りあえず立ち上げてみる
    # /etc/rc.d/autofs restart
    Shutting down service automount                                       done
    Starting service automounter                                          done
    # ls /misc/usbfm/
    .  ..  新規テキスト ドキュメント.txt 
  6. mount(autofs) は実行ユーザ権限でデバイスをマウントする。つまりは、このままでは、root権限がないと書き込めない。
    • 一般ユーザもUSBメモリに書き込めるようにするには、/etc/auto.misc のマウントオプションに gid=xxx,uid=xxx を足せばよい。

Suse 10 Server


トップ   編集 凍結 差分 バックアップ 添付 複製 名前変更 リロード   新規 一覧 単語検索 最終更新   ヘルプ   最終更新のRSS   sitemap
Last-modified: 2007-02-21 (水) 23:18:24 (6272d)
Short-URL: https://at-sushi.com:443/pukiwiki/index.php?cmd=s&k=bfbc258128
ISBN10
ISBN13
9784061426061