[問題] mtdblock 到 file system的大小變化

看板LinuxDev作者 (Minimi)時間10年前 (2014/10/21 10:33), 10年前編輯推噓1(106)
留言7則, 2人參與, 最新討論串1/2 (看更多)
我用的是openwrt,硬體是TP-WDR3500。 http://wiki.openwrt.org/doc/techref/flash.layout 根據openwrt提供的flash layout,/rom size = mtd2 size - mtd3 size 而從我的/proc/partitions來看 major minor #blocks name 31 0 128 mtdblock0 31 1 1083 mtdblock1 31 2 6916 mtdblock2 31 3 5056 mtdblock3 31 4 64 mtdblock4 31 5 8000 mtdblock5 /rom size 應該是 6916 - 5056 = 1860 但是實際df的結果 Filesystem 1K-blocks Used Available Use% Mounted on rootfs 5056 276 4780 5% / /dev/root 2048 2048 0 100% /rom tmpfs 63160 68 63092 0% /tmp /dev/mtdblock3 5056 276 4780 5% /overlay overlayfs:/overlay 5056 276 4780 5% / tmpfs 512 0 512 0% /dev /rom size 卻是 2048 是什麼樣的原因導致這樣的差別呢? 謝謝。 -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 61.219.255.69 ※ 文章網址: http://www.ptt.cc/bbs/LinuxDev/M.1413858803.A.B75.html

10/22 07:33, , 1F
flash的size是以block為單位啊..
10/22 07:33, 1F
從df得到的rootfs的大小來看block size應該也是1K 從dmesg來換算也是如此 [ 0.710000] Creating 5 MTD partitions on "spi0.0": [ 0.720000] 0x000000000000-0x000000020000 : "u-boot" [ 0.720000] 0x000000020000-0x00000012ed38 : "kernel" [ 0.730000] mtd: partition "kernel" must either start or end on erase block boundary or be smaller than an erase block -- forcing read-only [ 0.740000] 0x00000012ed38-0x0000007f0000 : "rootfs" [ 0.750000] mtd: partition "rootfs" must either start or end on erase block boundary or be smaller than an erase block -- forcing read-only [ 0.760000] mtd: device 2 (rootfs) set to be root filesystem [ 0.770000] 1 squashfs-split partitions found on MTD device rootfs [ 0.770000] 0x000000300000-0x0000007f0000 : "rootfs_data" [ 0.780000] 0x0000007f0000-0x000000800000 : "art" [ 0.790000] 0x000000020000-0x0000007f0000 : "firmware" ※ 編輯: hl4 (61.219.255.69), 10/22/2014 09:44:46

10/22 11:21, , 2F
我的想法是1860要吃掉2個block,所以看到就是2048
10/22 11:21, 2F

10/22 11:22, , 3F
如果有什麼地方沒考慮到的,在麻煩你指點..:)
10/22 11:22, 3F
千萬別這麼說,我在embedded linux完全是新手,能得到意見或是討論我就很高興了:D 不太懂1860被吃掉兩個block之後,為什麼會變多為2048 真的這樣變的話,不就占用到其他的分割區了嗎? 另外,有沒有什麼方法能讓我驗證這個想法呢,謝謝

10/22 13:38, , 4F
請問erase block大小?1024K?
10/22 13:38, 4F
root@OpenWrt:~# cat /proc/mtd dev: size erasesize name mtd0: 00020000 00010000 "u-boot" mtd1: 0010ed38 00010000 "kernel" mtd2: 006c12c8 00010000 "rootfs" mtd3: 004f0000 00010000 "rootfs_data" mtd4: 00010000 00010000 "art" mtd5: 007d0000 00010000 "firmware" erasesize 應該是 64K ※ 編輯: hl4 (61.219.255.69), 10/22/2014 16:35:08

10/22 21:15, , 5F
我發現我誤會了,原來你上面那些都是block為單位了.
10/22 21:15, 5F

10/22 21:15, , 6F
你的file system是哪種格式的啊
10/22 21:15, 6F

10/22 22:49, , 7F
有沒有可能是你的rootfs image超過partition size了
10/22 22:49, 7F
rootfs是 overlayfs,其下包含/rom (SquashFS) 和rootfs_data (JFFS2) 我不知道你說的有沒有可能發生,不過也不知道怎麼確認是不是這麼回事 ※ 編輯: hl4 (61.219.255.69), 10/23/2014 09:27:53
文章代碼(AID): #1KHSNpjr (LinuxDev)
文章代碼(AID): #1KHSNpjr (LinuxDev)