V2EX = way to explore
V2EX 是一个关于分享和探索的地方
现在注册
已注册用户请  登录
V2EX 提问指南
jones
V2EX  ›  问与答

wr703n 刷 openwrt 后使用 U 盘扩展 rootfs 问题请教,感谢各位

  •  
  •   jones · 2014-04-03 00:57:03 +08:00 · 4665 次点击
    这是一个创建于 3702 天前的主题,其中的信息可能已经有所发展或是发生改变。
    玩openwrt的童鞋们,我现在在openwrt中已经按照官方wiki步骤使用U盘对rootfs进行了扩容,直接把U盘做成rootfs,然后在/etc/config/fstab文件中设定挂载点为/,功能已经正常,并且rootfs成功扩容到4G,但有一个让人头疼的问题,每次路由断电,我直接拔掉USB供电线,然后再插上后,路由启动后总是原来1M的rootfs,并且/dev/下检测不到我的U盘,插拔无数次也不行,我必须手动执行reboot重启一下,/dev/下才能自动检测到我的/dev/sda1设备,才能正确把4GB的rootfs挂载上,我想请问的是,大家的openwrt使用了外接U盘都是这种状态吗?都是断电启动后必须再reboot一下才能检测到USB设备吗?请指教,万分感谢,
    10 条回复    1970-01-01 08:00:00 +08:00
    LazyZhu
        1
    LazyZhu  
       2014-04-03 01:37:15 +08:00
    你用的哪种方式,Pivot Overlay 还是 Pivot Root?
    LazyZhu
        2
    LazyZhu  
       2014-04-03 01:39:51 +08:00
    还有如下:
    On Barrier Breaker, block-mount will create a file /etc/.extroot-uuid on extroot filled with uuid of mtd partition rootfs. At boot time when trying to do extroot, block-mount would try to check the actual uuid with the content of .extroot-uuid. If they did not match, extroot would fail. So if you want to continue use extroot after flashing a new firmwre, /etc/.extroot-uuid needs to be deleted first.
    allenforrest
        3
    allenforrest  
       2014-04-03 07:12:31 +08:00 via iPhone
    贴一下断电重启后挂不上u盘时的kernel日志,dmesg
    jones
        4
    jones  
    OP
       2014-04-03 11:04:28 +08:00
    @allenforrest 我对比了断电重启挂不上U盘的dmesg日志和reboot后的dmesg日志,日志太长我不全贴了,区别如下:
    一、断电重启不能挂载时候,关键日志行为:
    [ 8.320000] usb 1-1: new full-speed USB device number 2 using ehci-platform
    [ 8.480000] hub 1-0:1.0: unable to enumerate USB device on port 1
    二、reboot后自动加载U盘,关键日志为:
    [ 8.350000] usb 1-1: new high-speed USB device number 2 using ehci-platform
    [ 8.500000] scsi0 : usb-storage 1-1:1.0
    [ 9.500000] scsi 0:0:0:0: Direct-Access Mass Storage Device 1.00 PQ: 0 ANSI: 0 CCS
    [ 9.720000] sd 0:0:0:0: [sda] 7882752 512-byte logical blocks: (4.03 GB/3.75 GiB)
    [ 9.730000] sd 0:0:0:0: [sda] Write Protect is off
    [ 9.730000] sd 0:0:0:0: [sda] Mode Sense: 03 00 00 00
    [ 9.730000] sd 0:0:0:0: [sda] No Caching mode page present
    [ 9.740000] sd 0:0:0:0: [sda] Assuming drive cache: write through
    [ 9.750000] sd 0:0:0:0: [sda] No Caching mode page present
    [ 9.750000] sd 0:0:0:0: [sda] Assuming drive cache: write through
    [ 9.760000] sda: sda1
    [ 9.760000] sd 0:0:0:0: [sda] No Caching mode page present
    [ 9.770000] sd 0:0:0:0: [sda] Assuming drive cache: write through
    [ 9.770000] sd 0:0:0:0: [sda] Attached SCSI removable disk
    [ 31.420000] EXT4-fs (sda1): recovery complete
    [ 31.430000] EXT4-fs (sda1): mounted filesystem with ordered data mode. Opts: (null)

    可以看出reboot后,系统检测到了U盘,但是为什么显示为scsi0,是scsi设备,这个就不清楚了,请帮忙看下,谢谢,
    allenforrest
        5
    allenforrest  
       2014-04-03 12:07:33 +08:00 via iPhone
    u盘枚举失败了,没有usb分析仪看不到具体交互,感觉像是u盘自身容错问题,有没有换过u盘尝试、或者把这个u盘插在其他linux机器上断电复位看看是否问题类似?
    jones
        6
    jones  
    OP
       2014-04-03 12:44:53 +08:00 via Android
    @allenforrest 感谢,换了三个U盘,两个2.0的都不能用,剩下一个威刚3.0的盘,十分完美,随便插拔都能识别,google了一下,很多人说驱动程序中内核模块ehci_hcd导致的低速盘不识别问题,正在搜索解决方案,
    allenforrest
        7
    allenforrest  
       2014-04-03 14:40:37 +08:00
    @jones
    怀疑不是 ehci_hcd 的问题,如果是它的问题,所有 USB 2.0 的设备都会遇到这个问题,按照以前调试的经验,遇到枚举问题很多都是 U 盘 halt 了:
    1、可能是这几个 U 盘驱动的容错问题;
    2、可能是 openwrt 的 kernel 版本里 ehci_hcd 有未解决的 bug,因此我刚才想问问你有没有试过同样的2.0 U 盘在其他 Linux 设备上使用会不会出现类似问题,例如用一个支持 OTG 的 Android 手机,接上 U 盘,挂载成功后,拔电池,再开机。
    allenforrest
        8
    allenforrest  
       2014-04-03 14:43:08 +08:00
    @jones 又看了一下 log,枚举失败的时候是识别成 full-speed 设备了(USB 1.1),看来只能通过 USB monitor 看交互才知道是 hcd 的问题还是 device 问题了。
    jones
        9
    jones  
    OP
       2014-04-03 15:18:33 +08:00 via Android
    @allenforrest 嗯,不识别的关键就是一个full-speed,另一个是high-speed,奇怪的是为什么我reboot的时候就能得到正确的high-speed,难道boot和reboot过程openwrt引导装载过程有差异?还有一种可能就是这个u盘的主控芯片加电初始化过程比较慢,主控芯片还没来的急把u盘信息返回给驱动程序系统就跳过去了导致无法识别u盘,而reboot的时候u盘主控已经初始化好了,可以快速的把u盘信息返回给驱动程序,这样驱动程序就能识别这个盘的信息了,从而得出high-speed的结论,这个只是我个人猜测,不过看网上给2440开发板移植ehci的时候要加一个等待时间,然后再去读取寄存器的值,应该也是为了解决反应慢的u盘的识别问题吧
    allenforrest
        10
    allenforrest  
       2014-04-03 15:21:40 +08:00
    @jones 你说的有道理。
    关于   ·   帮助文档   ·   博客   ·   API   ·   FAQ   ·   实用小工具   ·   2291 人在线   最高记录 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 15:42 · PVG 23:42 · LAX 08:42 · JFK 11:42
    Developed with CodeLauncher
    ♥ Do have faith in what you're doing.