From: Artem Bityutskiy <dedekind1@gmail.com>
To: Andrew Murray <amurray@mpcdata.com>
Cc: linux-mtd@lists.infradead.org
Subject: Re: validate_sb: bad superblock, error 8 (Minimum UBI volume size for UBIFS image)
Date: Tue, 18 Jan 2011 11:16:40 +0200 [thread overview]
Message-ID: <1295342200.2470.97.camel@koala> (raw)
In-Reply-To: <AANLkTikGddyMhxph92Dz7vpRNRKa2haQne7yxKBTKw3N@mail.gmail.com>
On Tue, 2011-01-11 at 09:47 +0000, Andrew Murray wrote:
> 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?
There are 5 (AFAIR) areas in UBIFS:
1. Superblock - always 1 LEB.
2. Log - depends on maximum flash size (-c mkfs.ubifs option) and LEB
size
3. Lprops - depends on maximum flash size and LEB size.
3. Orphans - I think 1 LEB is enough
4. Main area - used for various purposes:
1. the FS index needs at least 3 LEBs for the FS index
2. 1 LEB for GC
3. 1 for deletions (because deleting stuff, e.g., file, needs
writing deletion entries to flash, which also needs space,
so we need to reserve it to make sure that if your FS is full,
you still can delete your files).
4. buds which are part of the journal - need at least 3
Note, Log + buds = the journal.
As you have already found out the journal size is configurable, so you
can make it to be of minimum size.
Also you have already found that there are some functions which try to
calculate default sizes.
In fs/ubifs/ubifs-media.h you can find constants and comments about
minimum required LEBs [1]
Anyway, the only way for the user to affect the minimum FS size is the
--jrn-size option of mkfs.ubifs. How to calculate what will be the
minimum? Not sure, probably UBIFS_MIN_JNL_LEBS = 5 LEBs or something
close to this.
I agree that this is a bit complex, feel free to contribute some piece
of documentation to the mtd web site - you'll find the web site source
here: http://git.infradead.org/mtd-www.git
Just clone it and send a patch.
>
> # 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
If you did not use mkfs.ubifs, then UBIFS is doing "auto-formatting" and
just picks some "reasonable" default journal size, which is not the
minimum possible. You can make it smaller with "mkfs.ubifs --jrn-size".
--
Best Regards,
Artem Bityutskiy (Битюцкий Артём)
next prev parent reply other threads:[~2011-01-18 9:17 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-01-11 9:47 validate_sb: bad superblock, error 8 (Minimum UBI volume size for UBIFS image) Andrew Murray
2011-01-15 10:48 ` Andrew Murray
2011-01-15 22:09 ` Andrew Murray
2011-01-15 22:22 ` Artem Bityutskiy
2011-01-18 9:41 ` Artem Bityutskiy
2011-01-18 9:18 ` Artem Bityutskiy
2011-01-18 9:16 ` Artem Bityutskiy [this message]
2011-01-18 9:30 ` Artem Bityutskiy
2011-01-18 9:50 ` Artem Bityutskiy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1295342200.2470.97.camel@koala \
--to=dedekind1@gmail.com \
--cc=amurray@mpcdata.com \
--cc=linux-mtd@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).