validate_sb: bad superblock, error 8 (Minimum UBI volume size for UBIFS image)

Andrew Murray amurray at mpcdata.com
Tue Jan 11 04:47:52 EST 2011


Hello,

Is there a way to determine the minimum UBI volume size which will
support a given UBIFS filesystem image?

I've read the infradead.org FAQ's and browsed the source - however can
not find a suitable answer. My current conclusion is that the minimum
UBI volume is somehow dependant on the filesystem size, the log and
the journal. I'm working on an upgrade mechanism which uses UBI/UBIFS
and only creates UBI volumes of the minimum size to support a UBIFS
filesystem and thus struggling to determine the safest minimum size.

This is what I've attempted. In these examples UBIFS is claiming that
the journal size is 71 LEB's - however the filesystem will only mount
if my UBI volume is 77 LEB's - how do I account for this difference?

# ubinfo -a
UBI version:                    1
Count of UBI devices:           1
UBI control device major/minor: 10:63
Present UBI devices:            ubi0
ubi0
Volumes count:                           1
Logical eraseblock size:                 129024 bytes, 126.0 KiB
Total amount of logical eraseblocks:     911 (117540864 bytes, 112.1 MiB)
Amount of available logical eraseblocks: 401 (51738624 bytes, 49.3 MiB)
Maximum count of volumes                 128
Count of bad physical eraseblocks:       1
Count of reserved physical eraseblocks:  9
Current maximum erase counter value:     350
Minimum input/output unit size:          2048 bytes
Character device major/minor:            251:0
Present volumes:                         0
Volume ID:   0 (on ubi0)
Type:        dynamic
Alignment:   1
Size:        497 LEBs (64124928 bytes, 61.2 MiB)
State:       OK
Name:        rootfs
Character device major/minor: 251:1

# ls -l rootfs.ubifs
-rw-r--r--    1 default  default   6838272 Jan 10  2011 rootfs.ubifs
# ubimkvol /dev/ubi0 -N test -s 6838272
Volume ID 1, size 53 LEBs (6838272 bytes, 6.5 MiB), LEB size 129024
bytes (126.0 KiB), dynamic, name "test", alignment 1
# ubiupdatevol /dev/ubi0_1 rootfs.ubifs
# mount -t ubifs ubi0:test /tmp/a/
c->max_bud_bytes: 8388608 > c->leb_size * c->main_lebs: 5419008
UBIFS error (pid 1109): validate_sb: bad superblock, error 8
mount: mounting ubi0:test on /tmp/a/ failed: Invalid argument

# ubirmvol  /dev/ubi0 -N test
# ubimkvol /dev/ubi0 -N test --lebs=77
Volume ID 1, size 77 LEBs (9934848 bytes, 9.5 MiB), LEB size 129024
bytes (126.0 KiB), dynamic, name "test", alignment 1
# ubiupdatevol /dev/ubi0_1 rootfs.ubifs
# mount -t ubifs ubi0:test /tmp/a/
c->max_bud_bytes: 8388608 < c->leb_size * c->main_lebs: 8515584
UBIFS: mounted UBI device 0, volume 1, name "test"
UBIFS: file system size:   8515584 bytes (8316 KiB, 8 MiB, 66 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)
# umount /tmp/a
UBIFS: un-mount UBI device 0, volume 1

# ubimkvol /dev/ubi0 -N test --lebs=71
Volume ID 1, size 71 LEBs (9160704 bytes, 8.7 MiB), LEB size 129024
bytes (126.0 KiB), dynamic, name "test", alignment 1
# ubiupdatevol /dev/ubi0_1 rootfs.ubifs
# mount -t ubifs ubi0:test /tmp/a/
c->max_bud_bytes: 8388608 > c->leb_size * c->main_lebs: 7741440
UBIFS error (pid 1136): validate_sb: bad superblock, error 8
mount: mounting ubi0:test on /tmp/a/ failed: Invalid argument

# ubirmvol /dev/ubi0 -N test
# ubimkvol /dev/ubi0 -N test --lebs=72
Volume ID 1, size 72 LEBs (9289728 bytes, 8.9 MiB), LEB size 129024
bytes (126.0 KiB), dynamic, name "test", alignment 1
# ubiupdatevol /dev/ubi0_1 rootfs.ubifs
# mount -t ubifs ubi0:test /tmp/a/
c->max_bud_bytes: 8388608 > c->leb_size * c->main_lebs: 7870464
UBIFS error (pid 1144): validate_sb: bad superblock, error 8
mount: mounting ubi0:test on /tmp/a/ failed: Invalid argument

# ubirmvol /dev/ubi0 -N test
# ubimkvol /dev/ubi0 -N test --lebs=76
Volume ID 1, size 76 LEBs (9805824 bytes, 9.4 MiB), LEB size 129024
bytes (126.0 KiB), dynamic, name "test", alignment 1
# ubiupdatevol /dev/ubi0_1 rootfs.ubifs
# mount -t ubifs ubi0:test /tmp/a/
c->max_bud_bytes: 8388608 > c->leb_size * c->main_lebs: 8386560
UBIFS error (pid 1152): validate_sb: bad superblock, error 8
mount: mounting ubi0:test on /tmp/a/ failed: Invalid argument

# ubirmvol /dev/ubi0 -N test
# ubimkvol /dev/ubi0 -N test --lebs=77
Volume ID 1, size 77 LEBs (9934848 bytes, 9.5 MiB), LEB size 129024
bytes (126.0 KiB), dynamic, name "test", alignment 1
# ubiupdatevol /dev/ubi0_1 rootfs.ubifs
# mount -t ubifs ubi0:test /tmp/a/
c->max_bud_bytes: 8388608 < c->leb_size * c->main_lebs: 8515584
UBIFS: mounted UBI device 0, volume 1, name "test"
UBIFS: file system size:   8515584 bytes (8316 KiB, 8 MiB, 66 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)

Many Thanks,

Andrew Murray



More information about the linux-mtd mailing list