最近开发过程中遇见了一个问题,ubuntu 16.04 自动挂载SD卡报错,mounted filesystem with ordered data mode. Opts: (null)
以此记录一下
-
查看分区
root@ubuntu16:~# fdisk -l 中间省略无关东西;主要是为了挂载 /dev/mmcblk0p1 Disk /dev/mmcblk0: 29.7 GiB, 31914983424 bytes, 62333952 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/mmcblk0p1 2048 62333951 62331904 29.7G 83 Linux root@ubuntu16:~#
sd卡文件格式的原先是fat32位,由于内核是裁剪版,没有fsck.vfat 修复(如果有,可以直接修复),直接将其格式化成ext4
记得备份里面内容
-
手动挂载SD卡( 成功 )
mount /dev/mmcblk0p1 /mnt/sd/
df -h
查看挂载成功root@ubuntu16:~# df -h Filesystem Size Used Avail Use% Mounted on ubi0:rootfs 437M 384M 54M 88% / devtmpfs 121M 0 121M 0% /dev tmpfs 122M 0 122M 0% /dev/shm tmpfs 122M 1.7M 120M 2% /run tmpfs 5.0M 4.0K 5.0M 1% /run/lock tmpfs 122M 0 122M 0% /sys/fs/cgroup /dev/mmcblk0p1 30G 153M 28G 1% /mnt/sd
手动挂载SD卡可以成功,但是自动挂载却失败了
以下自动挂载过程
-
修改
/etc/fstab
文件( 失败 )root@ubuntu16:~# vim /etc/fstab # <file system> <dir> <type> <options> <dump> <pass> /dev/mmcblk0p2 / ext4 defaults,noatime,errors=remount-ro 0 1 /dev/mmcblk0p1 /mnt/sd ext4 defaults 0 0 ~
查看dmesg日志信息,报错如下(裁剪版,连syslog也没有)
[24987.953468] EXT4-fs (mmcblk0p1): mounted filesystem with ordered data mode. Opts: (null) [25051.864722] EXT4-fs (mmcblk0p1): mounted filesystem with ordered data mode. Opts: (null) [25327.264935] EXT4-fs (mmcblk0p1): mounted filesystem with ordered data mode. Opts: (null) [25392.234106] EXT4-fs (mmcblk0p1): mounted filesystem with ordered data mode. Opts: (null) [171378.249554] EXT4-fs (mmcblk0p1): mounted filesystem with ordered data mode. Opts: (null)
-
修改
/etc/rc.local
文件( 失败 )
加入以下内容mount /dev/mmcblk0p1 /mnt/sd
重启之后依然报上述错误
-
手动指定挂在文件类型( 成功 )
mount -t ext4 /dev/mmcblk0p1 /mnt/sd
重启机器之后,
df -h
查看挂载成功
注意
- 文件系统有问题,可以使用
fsck.XX
参数去修复 - 期间也尝试了在
/etc/fstab
使用UUID 来指定,依然报错 - 手动指定挂在文件类型
mount -t ext4 /dev/mmcblk0p1 /mnt/sd