usbメモリのマウント先固定
**文書の過去の版を表示しています。**
USBメモリのマウント先固定
バックアップに使用しているUSBメモリのマウント先を、物理ポートに対応させたマウントポイントに設定する。
物理ポートの確認
lsusbコマンドでUSBメモリの使用している物理ポートを確認する。 下記の場合はPort 4: Dev 4とわかる。
pi@raspberrypi:~ $ lsusb -t /: Bus 01.Port 1: Dev 1, Class=root_hub, Driver=dwc_otg/1p, 480M |__ Port 1: Dev 2, If 0, Class=Hub, Driver=hub/5p, 480M |__ Port 1: Dev 3, If 0, Class=Vendor Specific Class, Driver=smsc95xx, 480M |__ Port 4: Dev 4, If 0, Class=Mass Storage, Driver=usb-storage, 480M
by-pathの確認
マウントポイントからby-pathの情報を確認する。 /media/usb1のデバイスは/dev/sda1でありby-pathはplatform-3f980000.usb-usb-0:1.4:1.0-scsi-0:0:0:0-part1であるとわかる。
pi@raspberrypi:~ $ df -h ファイルシス サイズ 使用 残り 使用% マウント位置 /dev/root 29G 8.6G 20G 31% / devtmpfs 430M 0 430M 0% /dev tmpfs 462M 0 462M 0% /dev/shm tmpfs 462M 49M 414M 11% /run tmpfs 5.0M 4.0K 5.0M 1% /run/lock tmpfs 462M 0 462M 0% /sys/fs/cgroup /dev/mmcblk0p1 253M 49M 204M 20% /boot tmpfs 93M 4.0K 93M 1% /run/user/1000 /dev/sda1 29G 74M 29G 1% /media/usb1 pi@raspberrypi:~ $ ls -al /dev/disk/by-path 合計 0 drwxr-xr-x 2 root root 140 4月 28 06:53 . drwxr-xr-x 7 root root 140 4月 28 06:53 .. lrwxrwxrwx 1 root root 13 4月 28 06:53 platform-3f202000.mmc -> ../../mmcblk0 lrwxrwxrwx 1 root root 15 4月 28 06:53 platform-3f202000.mmc-part1 -> ../../mmcblk0p1 lrwxrwxrwx 1 root root 15 4月 28 06:53 platform-3f202000.mmc-part2 -> ../../mmcblk0p2 lrwxrwxrwx 1 root root 9 4月 28 06:53 platform-3f980000.usb-usb-0:1.4:1.0-scsi-0:0:0:0 -> ../../sda lrwxrwxrwx 1 root root 10 4月 28 06:53 platform-3f980000.usb-usb-0:1.4:1.0-scsi-0:0:0:0-part1 -> ../../sda1
マウントポイントの設定
by-pathをfstabに設定する。
- /etc/fstab
/dev/disk/by-path/platform-3f980000.usb-usb-0:1.4:1.0-scsi-0:0:0:0-part1 /media/usb1 vfat defaults,umask=000 0 0
- USBメモリはVFATフォーマットで市販されていることが多く、VFATファイルシステムではパーミッション設定はできないため、umaskオプションで、マウント時のパーミッションを設定する。
usbメモリのマウント先固定.1688351562.txt.gz · 最終更新: by Minoru Kijima