しもむブログ

技術メモ。といっても高度なことは書けないので…初心者がハマったところや、ググってもすぐには出てこないようなものを書くつもり。

OpenBlocks IoT EX1にSDカードを挿す時はマウントポイントに気をつける

  • ログを大量かつ長期間とっておきたいので念のためディスク容量を増やしておきたい
  • 開発者向けガイドを読むとMMCスロットがあり、まさにうってつけである

MMCはシステム運用に十分な信頼性を確保できない為、ファイル交換やログ保存用等にご利用ください。

  • たまたま余っていたSDカードをもらったので挿してみる
  • ここに挿す

f:id:mshimomu:20190814102719j:plain

  • mmcblk1というデバイス名で認識された
root@obsiot:/dev# dmesg

[    1.900001] mmc1: new high speed SDXC card at address aaaa
[    1.907137] mmcblk1: mmc1:aaaa SB128 119 GiB
[    1.909690]  mmcblk1: p1
  • パーテーションを切り直す
root@obsiot:/dev# fdisk /dev/mmcblk1

Welcome to fdisk (util-linux 2.25.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.


Command (m for help): p
Disk /dev/mmcblk1: 119.1 GiB, 127865454592 bytes, 249737216 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x00000000

Device         Boot Start       End   Sectors   Size Id Type
/dev/mmcblk1p1      32768 249737215 249704448 119.1G  7 HPFS/NTFS/exFAT


Command (m for help): d
Selected partition 1
Partition 1 has been deleted.

Command (m for help): p
Disk /dev/mmcblk1: 119.1 GiB, 127865454592 bytes, 249737216 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x00000000



Command (m for help): n
Partition type
   p   primary (0 primary, 0 extended, 4 free)
   e   extended (container for logical partitions)
Select (default p): p
Partition number (1-4, default 1): 1
First sector (2048-249737215, default 2048): 
Last sector, +sectors or +size{K,M,G,T,P} (2048-249737215, default 249737215): 

Created a new partition 1 of type 'Linux' and of size 119.1 GiB.

Command (m for help): p
Disk /dev/mmcblk1: 119.1 GiB, 127865454592 bytes, 249737216 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x00000000

Device         Boot Start       End   Sectors   Size Id Type
/dev/mmcblk1p1       2048 249737215 249735168 119.1G 83 Linux


Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.
  • 今回はNTFSでフォーマットしてみる
root@obsiot:/dev# mkfs -t ntfs /dev/mmcblk1p1
Cluster size has been automatically set to 4096 bytes.
Initializing device with zeroes:   0%

100% - Done.               : 2時間余りかかった
Creating NTFS volume structures.
mkntfs completed successfully. Have a nice day.

他で /var/tmp/storage を使っているのを見たので、そこにマウントしようとしたらハマる

  • mountしてファイルの読み書きができることを確認
  • /etc/fstabを修正して再起動
root@obsiot:# vi /etc/fstab

/dev/mmcblk1p1 /var/tmp/storage ntfs    defaults        0 0   :末尾に追記
  • しかし、STATUSのLEDが緑点滅になっている

SIM が無い状態での正常稼働または電波受信待機状態への移行待ち状態。

  • Wi-FiはAPモードにしていたのだが、SSIDも検出できなくなっている
  • SDカードはマウントはされていそうだが…正常時と比べてなんか少ない
root@obsiot:~# df
Filesystem      1K-blocks    Used Available Use% Mounted on
/dev/root          247919  174862     60257  75% /
devtmpfs           456416       0    456416   0% /dev
tmpfs               98484     492     97992   1% /run
tmpfs                5120       0      5120   0% /run/lock
tmpfs              196960       0    196960   0% /run/shm
/dev/mmcblk0p10   3155700 1180072   1795612  40% /.rw
aufs              3155700 1180072   1795612  40% /etc
aufs              3155700 1180072   1795612  40% /bin
aufs              3155700 1180072   1795612  40% /home
aufs              3155700 1180072   1795612  40% /lib
aufs              3155700 1180072   1795612  40% /sbin
aufs              3155700 1180072   1795612  40% /usr
aufs              3155700 1180072   1795612  40% /root
aufs              3155700 1180072   1795612  40% /opt
aufs              3155700 1180072   1795612  40% /srv
aufs              3155700 1180072   1795612  40% /media
/dev/mmcblk0p5       1003      19       913   3% /factory
/dev/mmcblk1p1  124867580   69844 124797736   1% /var/tmp/storage
  • シリアルコンソールで確認するとエラーが出ている
    • fstabの書き方をいじっても改善せず
[....] Starting the Winbind daemon: winbindmkdir failed on directory /var/log/samba/cores: No such file or directory
Failed to create /var/log/samba/cores for user 0 with mode 0700
Unable to setup corepath for winbindd: No such file or directory
mkdir failed on directory /var/log/samba/cores: No such file or directory
Failed to create /var/log/samba/cores for user 0 with mode 0700
Unable to setup corepath for winbindd: No such file or directory
[2019/08/09 21:30:10,  0] ../lib/util/debug.c:603(reopen_logs_internal)
  Unable to open new log file '/var/log/samba/log.winbindd': No such file or directory
[2019/08/09 21:30:10,  0] ../lib/util/debug.c:603(reopen_logs_internal)
  Unable to open new log file '/var/log/samba/log.winbindd': No such file or directory
[2019/08/09 21:30:10,  0] ../source3/winbindd/winbindd.c:1549(main)
  winbindd version 4.2.14-Debian started.
  Copyright Andrew Tridgell and the Samba Team 1992-2014
[2019/08/09 21:30:10,  0] ../lib/util/util.c:220(directory_create_or_exist)
  mkdir failed on directory /var/log/samba/cores: No such file or directory
[2019/08/09 21:30:10,  0] ../source3/lib/dumpcore.c:59(get_default_corepath)
  Failed to create /var/log/samba/cores for user 0 with mode 0700
[2019/08/09 21:30:10,  0] ../source3/lib/dumpcore.c:250(dump_core_setup)
  Unable to setup corepath for winbindd: No such file or directory
[2019/08/09 21:30:10,  0] ../lib/util/util.c:220(directory_create_or_exist)
  mkdir failed on directory /var/cache/samba/lck: No such file or directory
[2019/08/09 21:30:10,  0] ../source3/lib/util.c:788(smb_panic_s3)
  PANIC (pid 1443): Could not init winbindd's messaging context.

[2019/08/09 21:30:10,  0] ../source3/lib/util.c:899(log_stack_trace)
  BACKTRACE: 7 stack frames:
   #0 /usr/lib/i386-linux-gnu/libsmbconf.so.0(log_stack_trace+0x21) [0xb6a4c571]
   #1 /usr/lib/i386-linux-gnu/libsmbconf.so.0(smb_panic_s3+0x25) [0xb6a4c665]
   #2 /usr/lib/i386-linux-gnu/libsamba-util.so.0(smb_panic+0x3b) [0xb748571b]
   #3 /usr/sbin/winbindd(+0x29c5c) [0xb76fcc5c]
   #4 /usr/sbin/winbindd(main+0x428) [0xb76eccf8]
   #5 /lib/i386-linux-gnu/libc.so.6(__libc_start_main+0xf3) [0xb6700723]
   #6 /usr/sbin/winbindd(+0x1ac24) [0xb76edc24]
[2019/08/09 21:30:10,  0] ../source3/lib/util.c:800(smb_panic_s3)
  smb_panic(): calling panic action [/usr/share/samba/panic-action 1443]
[2019/08/09 21:30:10,  0] ../source3/lib/util.c:808(smb_panic_s3)
  smb_panic(): action returned status 0
[2019/08/09 21:30:10,  0] ../source3/lib/dumpcore.c:304(dump_core)
  Can not dump core: corepath not set up
 failed!
  • 関係あるのかわからんが、/var/配下でエラーになっているようなので、マウントポイントを/media/storageに変えてみる
root@obsiot:# vi /etc/fstab

/dev/mmcblk1p1 /media/storage ntfs    defaults        0 0   :マウントポイントを変更
  • STATUSのLEDは白点滅(モバイル回線電波:強)、SSIDも検出された
  • マウントもちゃんとされた
root@obsiot:~# df
Filesystem      1K-blocks    Used Available Use% Mounted on
/dev/root          247919  174644     60475  75% /
devtmpfs           456416       0    456416   0% /dev
tmpfs               98484     524     97960   1% /run
tmpfs                5120       0      5120   0% /run/lock
tmpfs              196960       0    196960   0% /run/shm
/dev/mmcblk0p10   3155700 1178720   1796964  40% /.rw
aufs              3155700 1178720   1796964  40% /etc
aufs              3155700 1178720   1796964  40% /bin
aufs              3155700 1178720   1796964  40% /home
aufs              3155700 1178720   1796964  40% /lib
aufs              3155700 1178720   1796964  40% /sbin
aufs              3155700 1178720   1796964  40% /usr
aufs              3155700 1178720   1796964  40% /var
aufs              3155700 1178720   1796964  40% /root
aufs              3155700 1178720   1796964  40% /opt
aufs              3155700 1178720   1796964  40% /srv
/dev/mmcblk0p5       1003      19       913   3% /factory
/dev/mmcblk1p1  124867580   69844 124797736   1% /media/storage
nginx_dir           16384      60     16324   1% /var/log/nginx
sensor_data          5120       0      5120   0% /var/webui/sensor_data
handler_tmp         11264       0     11264   0% /var/webui/pd_handler_tmp
emitter_buf         35840       0     35840   0% /var/webui/pd-emitter-data
log_dir            131072       0    131072   0% /var/webui/logs
tmplog               5120       0      5120   0% /var/webui/tmplog
  • 後で/var/配下で他のパスもいくつか試したがやっぱり同じエラーになった