Question about ubiformat
Let's say that I've prepared an image using mkfs.ubifs and ubinize. Is there any advantage, disadvantage or difference to doing ubiformat twice - once without specifying an image file, then running it a second time with an image file? In other words, is there a difference between these two sequences:
ubiformat /dev/mtd4
ubiformat /dev/mtd4 -f /mnt/source/ubi.img
and
ubiformat /dev/mtd4 -f /mnt/source/ubi.img
Thanks!
-Daniel
Hi Daniel,
Quoted 6 lines · Daniel Bowen
Let's say that I've prepared an image using mkfs.ubifs and ubinize. Is there any advantage, disadvantage or difference to doing ubiformat twice - once without specifying an image file, then running it a second time with an image file? In other words, is there a difference between these two sequences:
Quoted 6 lines
ubiformat
/dev/mtd4
ubiformat/dev/mtd4-f/mnt/source/ubi.imgand
ubiformat
/dev/mtd4-f/mnt/source/ubi.img
ubiformat always saves erase counters, so running it twice should not be extra-destructive. The primary effect is that you will put the whole device through an extra erase cycle unnecessarily (slightly reducing the flash's lifetime), because ubiformat.c's format() function loops through all eraseblocks and erases them.
But I think either sequence should have the same functional result.
Brian
Great, thanks for the response! So, if the mtd partition were say 500 erase blocks large, and the image was 300 erase blocks large, would "ubiformat /dev/mtd4 -f /mnt/source/ubi.img"
1. only touch the first 300 blocks of the partition, and leave the other 200 unmodified? Or
2. would it write the image into the first 300 blocks, and erase the remaining 200 blocks?
Thanks!
-Daniel
-----Original Message-----
From: Brian Norris [mailto:[email protected]]
Sent: Friday, August 08, 2014 12:20 AM
To: Daniel Bowen
Cc: [email protected]
Subject: Re: Question about ubiformat
Hi Daniel,
Quoted 3 lines · Daniel Bowen
Let's say that I've prepared an image using mkfs.ubifs and ubinize. Is there any advantage, disadvantage or difference to doing ubiformat twice - once without specifying an image file, then running it a second time with
an
Quoted 9 lines
image file? In other words, is there a difference between these two sequences:
ubiformat
/dev/mtd4
ubiformat/dev/mtd4-f/mnt/source/ubi.imgand
ubiformat
/dev/mtd4-f/mnt/source/ubi.img
ubiformat always saves erase counters, so running it twice should not be extra-destructive. The primary effect is that you will put the whole device through an extra erase cycle unnecessarily (slightly reducing the flash's lifetime), because ubiformat.c's format() function loops through all eraseblocks and erases them.
But I think either sequence should have the same functional result.
Brian
Quoted 7 lines · Daniel Bowen
Great, thanks for the response! So, if the mtd partition were say 500 erase blocks large, and the image was 300 erase blocks large, would "ubiformat
/dev/mtd4-f/mnt/source/ubi.img"
1. only touch the first 300 blocks of the partition, and leave the other 200 unmodified? Or
2. would it write the image into the first 300 blocks, and erase the remaining 200 blocks?
It erases every block, writes the image to the first 300, and programs EC headers to the last 200.
The source for ubiformat is actually pretty simple and easy to read. Check it out yourself!
http://git.infradead.org/mtd-utils.git
Brian
Quoted 2 lines · Brian Norris
It erases every block, writes the image to the first 300, and programs EC headers to the last 200.
Yes, confirmed.
Signature · 2 lines
Best Regards, Artem Bityutskiy
Quoted 4 lines
Quoted 2 lines
It erases every block, writes the image to the first 300, and programs EC headers to the last 200.
Yes, confirmed.
Perfect - thanks so much to both of you!
-Daniel