差分
このページの2つのバージョン間の差分を表示します。
両方とも前のリビジョン 前のリビジョン 次のリビジョン | 前のリビジョン | ||
linux:openwrt:sd_mount [2022/08/21 15:48] – 削除 - 外部編集 (Unknown date) 非ログインユーザー | linux:openwrt:sd_mount [2025/02/09 15:20] (現在) – [ある日突然マウントできなくなったら❓] ともやん | ||
---|---|---|---|
行 1: | 行 1: | ||
+ | ====== SD カードのマウント ====== | ||
+ | |||
+ | ===== パッケージ インストール ===== | ||
+ | < | ||
+ | # opkg update && opkg install gdisk block-mount e2fsprogs kmod-fs-ext4 | ||
+ | # reboot | ||
+ | </ | ||
+ | |||
+ | ===== LuCI の Mount Points メニュー ===== | ||
+ | block-mount パッケージを追加すると LuCI から **[System] - [Mount Points]** メニューが利用できるようになる。\\ | ||
+ | {{hardware: | ||
+ | |||
+ | ===== パーティションの作成 ===== | ||
+ | <WRAP prewrap 100%> | ||
+ | < | ||
+ | # gdisk /dev/sda | ||
+ | </ | ||
+ | </ | ||
+ | <WRAP prewrap 100% # | ||
+ | < | ||
+ | GPT fdisk (gdisk) version 1.0.3 | ||
+ | |||
+ | Partition table scan: | ||
+ | MBR: protective | ||
+ | BSD: not present | ||
+ | APM: not present | ||
+ | GPT: present | ||
+ | |||
+ | Found valid GPT with protective MBR; using GPT. | ||
+ | |||
+ | Command (? for help): r | ||
+ | |||
+ | Recovery/ | ||
+ | |||
+ | Expert command (? for help): l | ||
+ | Enter the sector alignment value (1-65536, default = 2048): 34 | ||
+ | |||
+ | Expert command (? for help): m | ||
+ | |||
+ | Command (? for help): n | ||
+ | Partition number (1-128, default 1): | ||
+ | First sector (34-236462046, | ||
+ | Last sector (34-236462046, | ||
+ | Current type is 'Linux filesystem' | ||
+ | Hex code or GUID (L to show codes, Enter = 8300): | ||
+ | Changed type of partition to 'Linux filesystem' | ||
+ | |||
+ | Command (? for help): p | ||
+ | Disk /dev/sda: 236462080 sectors, 112.8 GiB | ||
+ | Model: STORAGE DEVICE | ||
+ | Sector size (logical/ | ||
+ | Disk identifier (GUID): 98E0A384-FC68-4BAB-BC50-25EFE6988D43 | ||
+ | Partition table holds up to 128 entries | ||
+ | Main partition table begins at sector 2 and ends at sector 33 | ||
+ | First usable sector is 34, last usable sector is 236462046 | ||
+ | Partitions will be aligned on 34-sector boundaries | ||
+ | Total free space is 0 sectors (0 bytes) | ||
+ | |||
+ | Number | ||
+ | | ||
+ | |||
+ | Command (? for help): w | ||
+ | |||
+ | Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING | ||
+ | PARTITIONS!! | ||
+ | |||
+ | Do you want to proceed? (Y/N): y | ||
+ | OK; writing new GUID partition table (GPT) to /dev/sda. | ||
+ | The operation has completed successfully. | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | ===== パーティションの初期化 ===== | ||
+ | <WRAP prewrap 100%> | ||
+ | < | ||
+ | # mkfs.ext4 /dev/sda1 | ||
+ | </ | ||
+ | </ | ||
+ | <WRAP prewrap 100% #result> | ||
+ | < | ||
+ | mke2fs 1.44.1 (24-Mar-2018) | ||
+ | /dev/sda1 contains a ext4 file system | ||
+ | created on Sun Jan 12 21:12:35 2020 | ||
+ | Proceed anyway? (y,N) y | ||
+ | Creating filesystem with 29557751 4k blocks and 7397376 inodes | ||
+ | Filesystem UUID: fa755a50-bee7-49e8-93f4-50712eb37d58 | ||
+ | Superblock backups stored on blocks: | ||
+ | 32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208, | ||
+ | 4096000, 7962624, 11239424, 20480000, 23887872 | ||
+ | |||
+ | Allocating group tables: done | ||
+ | Writing inode tables: done | ||
+ | Creating journal (131072 blocks): | ||
+ | done | ||
+ | Writing superblocks and filesystem accounting information: | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | <WRAP prewrap 100%> | ||
+ | < | ||
+ | # block detect > / | ||
+ | # vi / | ||
+ | </ | ||
+ | </ | ||
+ | <WRAP prewrap 100%> | ||
+ | <file / | ||
+ | config ' | ||
+ | option | ||
+ | option | ||
+ | option | ||
+ | option | ||
+ | option | ||
+ | option | ||
+ | |||
+ | config ' | ||
+ | option | ||
+ | option | ||
+ | option | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | <WRAP prewrap 100%> | ||
+ | < | ||
+ | # uci show fstab | ||
+ | </ | ||
+ | </ | ||
+ | <WRAP prewrap 100% #result> | ||
+ | < | ||
+ | fstab.@global[0]=global | ||
+ | fstab.@global[0].anon_swap=' | ||
+ | fstab.@global[0].anon_mount=' | ||
+ | fstab.@global[0].auto_swap=' | ||
+ | fstab.@global[0].auto_mount=' | ||
+ | fstab.@global[0].delay_root=' | ||
+ | fstab.@global[0].check_fs=' | ||
+ | fstab.@mount[0]=mount | ||
+ | fstab.@mount[0].target='/ | ||
+ | fstab.@mount[0].uuid=' | ||
+ | fstab.@mount[0].enabled=' | ||
+ | </ | ||
+ | </ | ||
+ | <WRAP prewrap 100%> | ||
+ | < | ||
+ | # reboot | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | <WRAP prewrap 100%> | ||
+ | < | ||
+ | # mount | ||
+ | </ | ||
+ | </ | ||
+ | <WRAP prewrap 100% #result> | ||
+ | < | ||
+ | /dev/root on /rom type squashfs (ro, | ||
+ | proc on /proc type proc (rw, | ||
+ | sysfs on /sys type sysfs (rw, | ||
+ | tmpfs on /tmp type tmpfs (rw, | ||
+ | /dev/ubi0_1 on /overlay type ubifs (rw, | ||
+ | overlayfs:/ | ||
+ | tmpfs on /dev type tmpfs (rw, | ||
+ | devpts on /dev/pts type devpts (rw, | ||
+ | debugfs on / | ||
+ | /dev/sda1 on / | ||
+ | </ | ||
+ | </ | ||
+ | <WRAP prewrap 100%> | ||
+ | < | ||
+ | # df | ||
+ | </ | ||
+ | </ | ||
+ | <WRAP prewrap 100% #result> | ||
+ | < | ||
+ | Filesystem | ||
+ | / | ||
+ | tmpfs 62168 | ||
+ | / | ||
+ | overlayfs:/ | ||
+ | tmpfs 512 | ||
+ | / | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | ===== fstab の再設定などでファイルシステムの UUID を確認したい場合 ===== | ||
+ | **blkid** コマンドでファイルシステムの **UUID** を確認できる。\\ | ||
+ | <WRAP prewrap 100%> | ||
+ | < | ||
+ | # blkid | ||
+ | </ | ||
+ | **/ | ||
+ | </ | ||
+ | <WRAP prewrap 100% #result> | ||
+ | < | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | / | ||
+ | /dev/sda1: UUID=" | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | ===== トラブルシューティング ===== | ||
+ | |||
+ | ==== ファームウェアの更新でマウントポイントが消える❓❓ ==== | ||
+ | いつの間にかマウントポイントが無くなっていて、設定も書かれているのにマウントされなくなった。\\ | ||
+ | <WRAP prewrap 100%> | ||
+ | < | ||
+ | # uci show fstab | ||
+ | </ | ||
+ | </ | ||
+ | <WRAP prewrap 100% #result> | ||
+ | < | ||
+ | fstab.@global[0]=global | ||
+ | fstab.@global[0].anon_swap=' | ||
+ | fstab.@global[0].anon_mount=' | ||
+ | fstab.@global[0].auto_swap=' | ||
+ | fstab.@global[0].auto_mount=' | ||
+ | fstab.@global[0].delay_root=' | ||
+ | fstab.@global[0].check_fs=' | ||
+ | fstab.@mount[0]=mount | ||
+ | fstab.@mount[0].uuid=' | ||
+ | fstab.@mount[0].enabled=' | ||
+ | fstab.@mount[0].target='/ | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | <WRAP prewrap 100%> | ||
+ | < | ||
+ | # gdisk -l /dev/sda | ||
+ | </ | ||
+ | </ | ||
+ | <WRAP prewrap 100% #result> | ||
+ | < | ||
+ | GPT fdisk (gdisk) version 1.0.4 | ||
+ | |||
+ | Partition table scan: | ||
+ | MBR: protective | ||
+ | BSD: not present | ||
+ | APM: not present | ||
+ | GPT: present | ||
+ | |||
+ | Found valid GPT with protective MBR; using GPT. | ||
+ | Disk /dev/sda: 236462080 sectors, 112.8 GiB | ||
+ | Model: STORAGE DEVICE | ||
+ | Sector size (logical/ | ||
+ | Disk identifier (GUID): 98E0A384-FC68-4BAB-BC50-25EFE6988D43 | ||
+ | Partition table holds up to 128 entries | ||
+ | Main partition table begins at sector 2 and ends at sector 33 | ||
+ | First usable sector is 34, last usable sector is 236462046 | ||
+ | Partitions will be aligned on 2-sector boundaries | ||
+ | Total free space is 0 sectors (0 bytes) | ||
+ | |||
+ | Number | ||
+ | 1 34 236462046 | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | おまけに、パーティション名が化けて mount されています😅💦\\ | ||
+ | <WRAP prewrap 100% # | ||
+ | < | ||
+ | L i n u x F i l e s y s t e m | ||
+ | 䰀椀渀甀砀 䘀椀氀攀猀礀猀琀攀洀 | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | <WRAP prewrap 100%> | ||
+ | < | ||
+ | # cd /mnt/ | ||
+ | # ll | ||
+ | </ | ||
+ | </ | ||
+ | <WRAP prewrap 100% #result> | ||
+ | < | ||
+ | drwxr-xr-x | ||
+ | drwxr-xr-x | ||
+ | drwxrwxrwx | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | <WRAP prewrap 100%> | ||
+ | < | ||
+ | # mount | ||
+ | </ | ||
+ | </ | ||
+ | <WRAP prewrap 100% #result> | ||
+ | < | ||
+ | /dev/root on /rom type squashfs (ro, | ||
+ | proc on /proc type proc (rw, | ||
+ | sysfs on /sys type sysfs (rw, | ||
+ | cgroup on / | ||
+ | tmpfs on /tmp type tmpfs (rw, | ||
+ | /dev/ubi0_1 on /overlay type ubifs (rw, | ||
+ | overlayfs:/ | ||
+ | tmpfs on /dev type tmpfs (rw, | ||
+ | devpts on /dev/pts type devpts (rw, | ||
+ | debugfs on / | ||
+ | /dev/sda1 on / | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | マウントポイントを再作成して再マウントします。\\ | ||
+ | <WRAP prewrap 100%> | ||
+ | < | ||
+ | # mkdir / | ||
+ | # mount -t ext4 /dev/sda1 / | ||
+ | # mount | ||
+ | </ | ||
+ | </ | ||
+ | <WRAP prewrap 100% #result> | ||
+ | < | ||
+ | /dev/root on /rom type squashfs (ro, | ||
+ | proc on /proc type proc (rw, | ||
+ | sysfs on /sys type sysfs (rw, | ||
+ | cgroup on / | ||
+ | tmpfs on /tmp type tmpfs (rw, | ||
+ | /dev/ubi0_1 on /overlay type ubifs (rw, | ||
+ | overlayfs:/ | ||
+ | tmpfs on /dev type tmpfs (rw, | ||
+ | devpts on /dev/pts type devpts (rw, | ||
+ | debugfs on / | ||
+ | /dev/sda1 on / | ||
+ | /dev/sda1 on / | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | 様々な設定を有効にするために再起動しておく。\\ | ||
+ | <WRAP prewrap 100%> | ||
+ | < | ||
+ | # reboot | ||
+ | </ | ||
+ | </ | ||
+ | |||
+ | ==== ある日突然マウントできなくなったら❓😱 ==== | ||
+ | fsck して再マウントする...🤔\\ | ||
+ | <WRAP prewrap 100%> | ||
+ | < | ||
+ | # mkdir / | ||
+ | # fsck.ext4 /dev/sda1 | ||
+ | # mount -t ext4 /dev/sda1 / | ||
+ | # mount | ||
+ | </ | ||
+ | </ | ||
+ | <WRAP prewrap 100% #result> | ||
+ | < | ||
+ | /dev/root on /rom type squashfs (ro, | ||
+ | proc on /proc type proc (rw, | ||
+ | sysfs on /sys type sysfs (rw, | ||
+ | cgroup on / | ||
+ | tmpfs on /tmp type tmpfs (rw, | ||
+ | /dev/ubi0_1 on /overlay type ubifs (rw, | ||
+ | overlayfs:/ | ||
+ | tmpfs on /dev type tmpfs (rw, | ||
+ | devpts on /dev/pts type devpts (rw, | ||
+ | debugfs on / | ||
+ | /dev/sda1 on / | ||
+ | /dev/sda1 on / | ||
+ | </ | ||
+ | </ | ||