ユーザ用ツール

サイト用ツール


サイドバー

Top

検索タグ

変更履歴

メニュー


hardware:gl-ar750s-ext:sd_mount

SD カードのマウント

パッケージ インストール

# opkg update && opkg install gdisk block-mount e2fsprogs kmod-fs-ext4
# reboot

LuCI の Mount Points メニュー

block-mount パッケージを追加すると LuCI から [System] - [Mount Points] メニューが利用できるようになる。
Mount Points

パーティションの作成

# gdisk /dev/sda
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/transformation command (? for help): x

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, default = 34) or {+-}size{KMGTP}: 34
Last sector (34-236462046, default = 236462046) or {+-}size{KMGTP}:
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/physical): 512/512 bytes
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  Start (sector)    End (sector)  Size       Code  Name
   1              34       236462046   112.8 GiB   8300  Linux filesystem

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.

パーティションの初期化

# mkfs.ext4 /dev/sda1
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: done
# block detect > /etc/config/fstab
# vi /etc/config/fstab
config 'global'
        option  anon_swap       '0'
        option  anon_mount      '0'
        option  auto_swap       '1'
        option  auto_mount      '1'
        option  delay_root      '5'
        option  check_fs        '0'
 
config 'mount'
        option  target  '/mnt/sd128gb'
        option  uuid    'fa755a50-bee7-49e8-93f4-50712eb37d58'
        option  enabled '1'
# uci show fstab
fstab.@global[0]=global
fstab.@global[0].anon_swap='0'
fstab.@global[0].anon_mount='0'
fstab.@global[0].auto_swap='1'
fstab.@global[0].auto_mount='1'
fstab.@global[0].delay_root='5'
fstab.@global[0].check_fs='0'
fstab.@mount[0]=mount
fstab.@mount[0].target='/mnt/sd128gb'
fstab.@mount[0].uuid='fa755a50-bee7-49e8-93f4-50712eb37d58'
fstab.@mount[0].enabled='1'
# reboot
# mount
/dev/root on /rom type squashfs (ro,relatime)
proc on /proc type proc (rw,nosuid,nodev,noexec,noatime)
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,noatime)
tmpfs on /tmp type tmpfs (rw,nosuid,nodev,noatime)
/dev/ubi0_1 on /overlay type ubifs (rw,noatime)
overlayfs:/overlay on / type overlay (rw,noatime,lowerdir=/,upperdir=/overlay/upper,workdir=/overlay/work)
tmpfs on /dev type tmpfs (rw,nosuid,relatime,size=512k,mode=755)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,mode=600,ptmxmode=000)
debugfs on /sys/kernel/debug type debugfs (rw,noatime)
/dev/sda1 on /mnt/sd128gb type ext4 (rw,relatime,data=ordered)
# df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/root                11776     11776         0 100% /rom
tmpfs                    62168       376     61792   1% /tmp
/dev/ubi0_1             101840      2824     94180   3% /overlay
overlayfs:/overlay      101840      2824     94180   3% /
tmpfs                      512         0       512   0% /dev
/dev/sda1            115849188     61496 109859760   0% /mnt/sd128gb

fstab の再設定などでファイルシステムの UUID を確認したい場合

blkid コマンドでファイルシステムの UUID を確認できる。

# blkid

/dev/sda1UUID“fa755a50-bee7-49e8-93f4-50712eb37d58” である。

/dev/ubi0_1: UUID="0a2be279-197d-4762-b02d-89a9710ff1fb" TYPE="ubifs"
/dev/ubi0_0: TYPE="squashfs"
/dev/mtdblock5: UUID="455825797" TYPE="ubi"
/dev/ubiblock0_0: TYPE="squashfs"
/dev/sda1: UUID="fa755a50-bee7-49e8-93f4-50712eb37d58" TYPE="ext4" PARTUUID="8c7c1ef5-2340-4497-b12d-684a60107cd7"

トラブルシューティング

ファームウェアの更新でマウントポイントが消える❓❓

いつの間にかマウントポイントが無くなっていて、設定も書かれているのにマウントされなくなった。

# uci show fstab
fstab.@global[0]=global
fstab.@global[0].anon_swap='0'
fstab.@global[0].anon_mount='0'
fstab.@global[0].auto_swap='1'
fstab.@global[0].auto_mount='1'
fstab.@global[0].delay_root='5'
fstab.@global[0].check_fs='0'
fstab.@mount[0]=mount
fstab.@mount[0].uuid='fa755a50-bee7-49e8-93f4-50712eb37d58'
fstab.@mount[0].enabled='1'
fstab.@mount[0].target='/mnt/sd128gb'
# gdisk -l /dev/sda
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/physical): 512/512 bytes
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  Start (sector)    End (sector)  Size       Code  Name
1  34  236462046   112.8 GiB   8300  Linux Filesystem

おまけに、パーティション名が化けて mount されています😅💦

L i n u x  F i l e s y s t e m
䰀椀渀甀砀  䘀椀氀攀猀礀猀琀攀洀
# cd /mnt/
# ll
drwxr-xr-x    1 root     root           272 May 27 23:23 ./
drwxr-xr-x    1 root     root           608 May 27 23:23 ../
drwxrwxrwx    8 root     root          4096 Jun 30  2020 䰀椀渀甀砀 䘀椀氀攀猀礀猀琀攀洀/
# mount
/dev/root on /rom type squashfs (ro,relatime)
proc on /proc type proc (rw,nosuid,nodev,noexec,noatime)
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,noatime)
cgroup on /sys/fs/cgroup type cgroup (rw,nosuid,nodev,noexec,relatime,blkio,devices,freezer,net_cls,pids)
tmpfs on /tmp type tmpfs (rw,nosuid,nodev,noatime)
/dev/ubi0_1 on /overlay type ubifs (rw,noatime,ubi=0,vol=1)
overlayfs:/overlay on / type overlay (rw,noatime,lowerdir=/,upperdir=/overlay/upper,workdir=/overlay/work)
tmpfs on /dev type tmpfs (rw,nosuid,relatime,size=512k,mode=755)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,mode=600,ptmxmode=000)
debugfs on /sys/kernel/debug type debugfs (rw,noatime)
/dev/sda1 on /mnt/䰀椀渀甀砀 䘀椀氀攀猀礀猀琀攀洀 type ext4 (rw,sync,relatime,data=ordered)

マウントポイントを再作成して再マウントします。

# mkdir /mnt/sd128gb
# mount -t ext4 /dev/sda1 /mnt/sd128gb
# mount
/dev/root on /rom type squashfs (ro,relatime)
proc on /proc type proc (rw,nosuid,nodev,noexec,noatime)
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,noatime)
cgroup on /sys/fs/cgroup type cgroup (rw,nosuid,nodev,noexec,relatime,blkio,devices,freezer,net_cls,pids)
tmpfs on /tmp type tmpfs (rw,nosuid,nodev,noatime)
/dev/ubi0_1 on /overlay type ubifs (rw,noatime,ubi=0,vol=1)
overlayfs:/overlay on / type overlay (rw,noatime,lowerdir=/,upperdir=/overlay/upper,workdir=/overlay/work)
tmpfs on /dev type tmpfs (rw,nosuid,relatime,size=512k,mode=755)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,mode=600,ptmxmode=000)
debugfs on /sys/kernel/debug type debugfs (rw,noatime)
/dev/sda1 on /mnt/䰀椀渀甀砀 䘀椀氀攀猀礀猀琀攀洀 type ext4 (rw,sync,relatime,data=ordered)
/dev/sda1 on /mnt/sd128gb type ext4 (rw,sync,relatime,data=ordered)

様々な設定を有効にするために再起動しておく。

# reboot
hardware/gl-ar750s-ext/sd_mount.txt · 最終更新: 2021/06/03 12:30 by ともやん