IdStorage

See also.

= Description =

Region of the PSVita eMMC where perconsole info is stored.

= Location =

Idstorage data is stored at first raw partition (code 0x1). Use to extract.

= Structure =

The IdStorage partition is divided in two parts: the mapping table and the leaves.

Mapping table
The mapping table is located at the start of the partition. It's an array of 16-bit leaf IDs that serves as a leaf ID->index mapping table. The mapping table must be at least one-sector wide but may be bigger.

There are two leaf IDs reserved for usage in the mapping table: all entries corresponding to the mapping table (i.e. the first  entries for an M sectors sized table) must hold the value , and all unallocated leaves hold the value.

To lookup a leaf index based on its ID, use the following algorithm:

Leaves
Leaves are used to store arbitrary data. On Vita, leaves are all 512-bytes sized (one sector).

To read a leaf's data, obtain the leaf index (this can be known directly, or obtained from a leaf ID using the previously mentioned algorithm) then read 512 bytes starting at offset  in the IdStorage partition.

Limits
The number of leaves that can be stored in an IdStorage partition is limited by three factors: the size of the partition, the size of the mapping table and the size of leaf IDs.


 * An  sectors wide mapping table can hold up to   leaves
 * This is because a single-sector mapping table can hold  leaves (  is needed because the table uses an entry for itself)
 * A  sectors wide partition can hold up to   leaves
 * This is because leaves are sector-sized, and the mapping table consumes  sectors
 * There are 65520 leaf IDs available
 * While an unsigned 16-bit variable can hold 65536 values, IDs superior or equal to 0xFFF0 are reserved and cannot be used

From this, we can conclude that an IdStorage partition of  sectors with an   sectors mapping table can hold up to   leaves. We can also deduce an IdStorage partition is optimally shaped (no space is non-allocatable) when.

On Vita, the IdStorage partition is 512KiB and 32 sectors are reserved for the indexing table (, a non-optimal choice), which means the console's partition can hold up to 992 IdStorage leaves.

= Content =