コンテンツ
自宅サーバやマシン用。さくらのVPSではさすがにUSBメモリは使えないので(^^;)gnomeなどのGUIだと刺すと自動的に認識→ウィンドウが開く→ドラッグ&ドロップでコピーできるので良いのですが、CUI ((Character User Interfaceの略。LinuxにSSHで繋いだときのインタフェース。文字中心の世界))の時はそうはいかないのでその時のやり方。
さしこむ
kudzu ((Linux上でハードウェアの自動認識を支援するサービス))サービスが動いていれば、たぶん自動的に認識してくれます。USBメモリを差し込んだ後、dmesgの最後の方に以下のようなログが残ると思います。
# dmesg (一部省略) usb 1-2: configuration #1 chosen from 1 choice Initializing USB Mass Storage driver... scsi2 : SCSI emulation for USB Mass Storage devices usb-storage: device found at 2 usb-storage: waiting for device to settle before scanning usbcore: registered new driver usb-storage USB Mass Storage support registered. Vendor: V3.1162 Model: MUSE Rev: 0.00 Type: Direct-Access ANSI SCSI revision: 02 SCSI device sdb: 7892040 512-byte hdwr sectors (4041 MB) sdb: Write Protect is off sdb: Mode Sense: 00 00 00 00 sdb: assuming drive cache: write through SCSI device sdb: 7892040 512-byte hdwr sectors (4041 MB) sdb: Write Protect is off sdb: Mode Sense: 00 00 00 00 sdb: assuming drive cache: write through sdb: unknown partition table sd 2:0:0:0: Attached scsi removable disk sdb sd 2:0:0:0: Attached scsi generic sg1 type 0 usb-storage: device scan complete
ここで何度も出ているsdbというのにUSBメモリが接続されています。だいたいのばあいはsda,sdbに接続されます。
マウント
上のログにあったsdb(ファイルシステム上は/dev/sdb)をマウントして、Linux上で使えるようにします。
# mkdir /mnt/usbmem # mount -t vfat /dev/sdb /mnt/usbmem
上のdmesgでsdaに認識されている場合は
# mount -t vfat /dev/sda /mnt/usbmem
となります。
ファイルをコピーする
# cp ~/test.txt /mnt/usbmem
取り外し
# umount /mnt/usbmem
という感じです。メモメモ