UBI/ubifs problem
Ricard Wanderlof
ricard.wanderlof at axis.com
Thu Feb 16 10:17:41 EST 2012
I posted this query yesterday, but the information I provided was rather
short, so here's another attempt with more info which hopefully will
trigger some response.
I have two ubifs images made with mkfs.ubifs:
-rw-rw-r-- 1 ricardw users 20256768 2012-02-16 11:12 rootfs.img
-rw-rw-r-- 1 ricardw users 2064384 2012-02-16 11:09 rwfs.img
On my target system I attach mtd5 to UBI and create two volumes:
ubiattach -m 5 /dev/ubi_ctrl
ubimkvol -N rootfs -n 4 -t static -s 25165824 /dev/ubi0
ubimkvol -N rwfs -n 5 -t dynamic -S 30 /dev/ubi0
30 LEBs in the flash I'm using is about 30 * 126 KiB = 3.7 MiB .
I then write the volumes with the image data
ubiupdatevol /dev/ubi0_4 ./rootfs.img
ubiupdatevol /dev/ubi0_5 ./rwfs.img
Now I mount ubi0:rootfs on /mnt/1:
mount -t ubifs ubi0:rootfs /mnt/1/
which results in
UBIFS: mounted UBI device 0, volume 4, name "rootfs"
UBIFS: mounted read-only
UBIFS: file system size: 23869440 bytes (23310 KiB, 22 MiB, 185 LEBs)
UBIFS: journal size: 9033728 bytes (8822 KiB, 8 MiB, 71 LEBs)
UBIFS: media format: w4/r0 (latest is w4/r0)
UBIFS: default compressor: lzo
UBIFS: reserved for root: 0 bytes (0 KiB)
All is well so far. Now I attempt to mount ubi0:rwfs on /mnt/2:
mount -t ubifs ubi0:rwfs /mnt/2
which results in
UBIFS error (pid 2965): validate_sb: bad superblock, error 8
mount: Mounting ubi0:rwfs on /mnt/2 failed: Invalid argument
If I now remove the rwfs volume using ubirmvol, and create a new one that
is 78 LEBs in size (smaller sizes yield the same error message), again
ubiupdatevol the same rwfs.img image, and attempt to mount it, I get:
UBIFS: reserved for root: 0 bytes (0 KiB)
UBIFS: mounted UBI device 0, volume 5, name "rwfs"
UBIFS: file system size: 8644608 bytes (8442 KiB, 8 MiB, 67 LEBs)
UBIFS: journal size: 9033728 bytes (8822 KiB, 8 MiB, 71 LEBs)
UBIFS: media format: w4/r0 (latest is w4/r0)
UBIFS: default compressor: lzo
UBIFS: reserved for root: 0 bytes (0 KiB)
The thing that really puzzles me here is that the 2 MiB ubifs image shows
up as an 8 MiB 'file system size' when mounted. It does explain why 78
LEBs are required though.
Furthermore, df says:
ubi0:rootfs 21212 17652 3560 83% /mnt/1
ubi0:rwfs 7228 432 6796 6% /mnt/2
which correlates with the statistics from ubifs above, but it seems odd
that I can't create a volume with more than 6% utilization. If I start to
fill the volume with files after mounting, I can get up to 100% use.
At any rate, the error message is odd, especially given that ubiupdatevol
didn't report any problems.
I've also tried using a static volume for rwfs, with the same results (and
of course I can't write to it so I can't put more files on it in that
case).
Even considering the overhead that the rootfs volume appears to need
(image size is 20256768 and ubifs reports a 'file system size' of
23869440), i.e. an overhead of 3612672 bytes), it doesn't add up; adding
3612672 to the rwfs.img image size of 2064384 would result in a total size
of 5677056, not 8644608.
Could there be compressed files in the rwfs.img image that somehow need to
be expanded in the flash?
It's not that we're pressed for space and need the size, but I'd like to
understand what is going on. I don't really think this is a bug, more
something that I don't understand. I can't find anything on the mtd
documentation pages that seem to relate to this though.
For the record, I'm using Linux 2.6.35 .
/Ricard
--
Ricard Wolf Wanderlöf ricardw(at)axis.com
Axis Communications AB, Lund, Sweden www.axis.com
Phone +46 46 272 2016 Fax +46 46 13 61 30
More information about the linux-mtd
mailing list