ubuntu 自动挂载SD卡

最近开发过程中遇见了一个问题,ubuntu 16.04 自动挂载SD卡报错,mounted filesystem with ordered data mode. Opts: (null)以此记录一下

  1. 查看分区

     
    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 记得备份里面内容

  2. 手动挂载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卡可以成功,但是自动挂载却失败了

以下自动挂载过程

  1. 修改/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)
    
    
  2. 修改/etc/rc.local文件( 失败 )
    加入以下内容

    mount /dev/mmcblk0p1 /mnt/sd
    

    重启之后依然报上述错误

  3. 手动指定挂在文件类型( 成功 )

    mount -t ext4 /dev/mmcblk0p1 /mnt/sd
    

    重启机器之后,df -h查看挂载成功

注意

  1. 文件系统有问题,可以使用fsck.XX参数去修复
  2. 期间也尝试了在/etc/fstab使用UUID 来指定,依然报错
  3. 手动指定挂在文件类型mount -t ext4 /dev/mmcblk0p1 /mnt/sd
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值