Partitions: Difference between revisions
CelesteBlue (talk | contribs) |
(→Types) |
||
(14 intermediate revisions by 3 users not shown) | |||
Line 1: | Line 1: | ||
All devices on the Vita are partitioned the same way. Logical block size is 512 bytes and the first logical block is the [[Partitions#Master Block|master block]] which defines the partition table along with other information. | All devices on the PS Vita are partitioned the same way. Logical block size is 512 bytes and the first logical block is the [[Partitions#Master Block|master block]] which defines the partition table along with other information. | ||
== Types == | |||
<source lang="C"> | |||
typedef struct SceMbrPartEntry { // size is 0x11-bytes | |||
unsigned int start_lba; | |||
unsigned int n_sectors; | |||
unsigned char id; | |||
unsigned char type; | |||
unsigned char flag; | |||
unsigned short acl; | |||
unsigned int unused; | |||
} __attribute__((packed)) SceMbrPartEntry; | |||
typedef struct SceMbrParts { // size is 0x110-bytes | |||
SceMbrPartEntry entries[0x10]; | |||
} __attribute__((packed)) SceMbrParts; | |||
typedef struct SceMbr { // size is 0x200-bytes | |||
char magic[0x20]; | |||
unsigned int version; | |||
unsigned int n_sectors; | |||
char unused[8]; | |||
unsigned int loader_start; | |||
unsigned int loader_count; | |||
unsigned int current_bl_lba; | |||
unsigned int bl_bank0_lba; | |||
unsigned int bl_bank1_lba; | |||
unsigned int current_os_lba; | |||
char unused2[8]; | |||
SceMbrParts parts; | |||
char unused3[0x6E]; | |||
char unused4[0x30]; | |||
unsigned short signature; | |||
} __attribute__((packed)) SceMbr; | |||
</source> | |||
== Master Block == | == Master Block == | ||
Line 16: | Line 54: | ||
| 0x20 | | 0x20 | ||
| 0x4 | | 0x4 | ||
| version. | | version. Usually 3. | ||
|- | |- | ||
| 0x24 | | 0x24 | ||
Line 36: | Line 74: | ||
| 0x38 | | 0x38 | ||
| 0x4 | | 0x4 | ||
| current_bl_lba. Active | | current_bl_lba. Active SLB2 offset in blocks (must be either bank0 or bank1) | ||
|- | |- | ||
| 0x3C | | 0x3C | ||
| 0x4 | | 0x4 | ||
| bl_bank0_lba. | | bl_bank0_lba. SLB2 bank0 offset in blocks (default: 0x4000) | ||
|- | |- | ||
| 0x40 | | 0x40 | ||
| 0x4 | | 0x4 | ||
| bl_bank1_lba. | | bl_bank1_lba. SLB2 bank1 offset in blocks (default: 0x6000) | ||
|- | |- | ||
| 0x44 | | 0x44 | ||
Line 69: | Line 107: | ||
== Partition Entries == | == Partition Entries == | ||
Each partition entry is 17 bytes long | Each partition entry is 17 bytes long. | ||
{| class="wikitable" | {| class="wikitable" | ||
Line 78: | Line 116: | ||
| 0x0 | | 0x0 | ||
| 0x4 | | 0x4 | ||
| Partition offset (blocks) | | start_lba. Partition offset (blocks) | ||
|- | |- | ||
| 0x4 | | 0x4 | ||
| 0x4 | | 0x4 | ||
| Partition size (blocks) | | n_sectors. Partition size (blocks) | ||
|- | |- | ||
| 0x8 | | 0x8 | ||
| 0x1 | | 0x1 | ||
| [[Partitions#Partition | | part_id. [[Partitions#Partition ID|Partition ID]] | ||
|- | |- | ||
| 0x9 | | 0x9 | ||
| 0x1 | | 0x1 | ||
| [[Partitions#Partition Type|Partition | | part_type. [[Partitions#Partition Type|Partition Type]] | ||
|- | |- | ||
| 0xA | | 0xA | ||
| 0x1 | | 0x1 | ||
| [[Partitions#Partition | | part_flag. [[Partitions#Partition Flag|Partition Flag]] (boolean) | ||
|- | |- | ||
| 0xB | | 0xB | ||
| | | 0x2 | ||
| | | acl. Access control lists. Seen: <code>0x0555</code>, <code>0x0F0F</code> (sloader, os, vsh) -> r--, <code>0x0F1F</code> (idstor) -> ---, <code>0x0F4F</code>, <code>0x0FFF</code> (sysdata, vtrm, vshdata, updater, pidata, user) -> rwx | ||
|- | |- | ||
| 0xF | | 0xF | ||
| | | 0x4 | ||
| | | unused | ||
|} | |} | ||
=== Partition | === Partition ID === | ||
The | The Partition ID uniquely identifies the partition to its function. It is related to [[SceKernelModulemgr#Partition ID]]. | ||
{| class="wikitable" | {| class="wikitable" | ||
! | ! Partition ID | ||
! Block Device | ! Block Device | ||
! | ! Mountpoint | ||
! | ! Physical Storage Holder | ||
! Description | ! Description | ||
|- | |- | ||
Line 125: | Line 163: | ||
| "idstor" | | "idstor" | ||
| | | | ||
| Internal | | Internal Flash | ||
| [[IdStorage]] | | [[IdStorage]] | ||
|- | |- | ||
Line 131: | Line 169: | ||
| "sloader" | | "sloader" | ||
| | | | ||
| Internal | | Internal Flash | ||
| [[SLB2]] [[Boot Sequence#Boot_Partition|Boot loaders]] | | [[SLB2]] [[Boot Sequence#Boot_Partition|Boot loaders]] | ||
|- | |- | ||
Line 137: | Line 175: | ||
| "os" | | "os" | ||
| os0 | | os0 | ||
| Internal | | Internal Flash | ||
| Main OS partition, contains kernel [[Modules|modules]] | | Main OS partition, contains kernel [[Modules|modules]] | ||
|- | |- | ||
Line 143: | Line 181: | ||
| "vsh" | | "vsh" | ||
| vs0 | | vs0 | ||
| Internal | | Internal Flash | ||
| [[Modules|System applications & libraries]] | | [[Modules|System applications & libraries]] | ||
|- | |- | ||
Line 149: | Line 187: | ||
| "vshdata" | | "vshdata" | ||
| vd0 | | vd0 | ||
| Internal | | Internal Flash | ||
| [[Registry]] and error history | | [[Registry]] and error history | ||
|- | |- | ||
Line 155: | Line 193: | ||
| "vtrm" | | "vtrm" | ||
| tm0 | | tm0 | ||
| Internal | | Internal Flash | ||
| NpDrm, Marlin and DevKit/TestKit activations files | | NpDrm, Marlin and DevKit/TestKit activations files | ||
|- | |- | ||
Line 161: | Line 199: | ||
| "user" | | "user" | ||
| ur0 | | ur0 | ||
| Internal | | Internal Flash | ||
| User resources, [[LiveArea]] cache, database, & other stuff | | User resources, [[LiveArea]] cache, database, & other stuff | ||
|- | |- | ||
Line 167: | Line 205: | ||
| "userext" | | "userext" | ||
| ux0 | | ux0 | ||
| Internal / Memory Card | | Internal Flash / Memory Card | ||
| [[Memory Card]] | | [[Memory Card]] | ||
|- | |- | ||
Line 185: | Line 223: | ||
| "updater" | | "updater" | ||
| ud0 | | ud0 | ||
| Internal | | Internal Flash | ||
| [[Updater]] application and PUP copied here before reboot | | [[Updater]] application and PUP copied here before reboot | ||
|- | |- | ||
Line 191: | Line 229: | ||
| "sysdata" | | "sysdata" | ||
| sa0 | | sa0 | ||
| Internal | | Internal Flash | ||
| Dictionary and font data | | Dictionary and font data | ||
|- | |- | ||
Line 197: | Line 235: | ||
| "mediaid" | | "mediaid" | ||
| | | | ||
| | | Memory Card / Game Card | ||
| Some data on [[Memory Card]] & [[Game Card]] | | Some data on [[Memory Card]] & [[Game Card]] | ||
|- | |- | ||
Line 203: | Line 241: | ||
| "pidata" | | "pidata" | ||
| pd0 | | pd0 | ||
| Internal | | Internal Flash | ||
| [[Welcome Park]] and welcome video (Partition not present in Prototype units) | | [[Welcome Park]] and welcome video (Partition not present in Prototype units) | ||
|- | |- | ||
Line 209: | Line 247: | ||
| "unused" | | "unused" | ||
| | | | ||
| | | | ||
| Unknown | | Unknown | ||
|} | |} | ||
Line 215: | Line 253: | ||
=== Partition Type === | === Partition Type === | ||
The partition type | The partition type indicates the file system or if there is no file system (for example, in the case of a [[SLB2]] archive). | ||
{| class="wikitable" | {| class="wikitable" | ||
! | ! Partition Type | ||
! | ! Name | ||
|- | |- | ||
| 0x6 | | 0x6 | ||
Line 231: | Line 269: | ||
|} | |} | ||
=== Partition | === Partition Flag === | ||
Some partitions (specifically <code>os0</code> and the boot loaders) have a shadow redundant copy. On update, only the inactive partition is written to and finally the active partition is swapped. For partitions that do not use this feature, this value is ignored. | Some partitions (specifically <code>os0</code> and the boot loaders) have a shadow redundant copy. On System Software update, only the inactive partition is written to and finally the active partition is swapped. For partitions that do not use this activation feature, this value is ignored. | ||
[[Category:System]] | [[Category:System]] |
Latest revision as of 11:49, 1 August 2023
All devices on the PS Vita are partitioned the same way. Logical block size is 512 bytes and the first logical block is the master block which defines the partition table along with other information.
Types
typedef struct SceMbrPartEntry { // size is 0x11-bytes unsigned int start_lba; unsigned int n_sectors; unsigned char id; unsigned char type; unsigned char flag; unsigned short acl; unsigned int unused; } __attribute__((packed)) SceMbrPartEntry; typedef struct SceMbrParts { // size is 0x110-bytes SceMbrPartEntry entries[0x10]; } __attribute__((packed)) SceMbrParts; typedef struct SceMbr { // size is 0x200-bytes char magic[0x20]; unsigned int version; unsigned int n_sectors; char unused[8]; unsigned int loader_start; unsigned int loader_count; unsigned int current_bl_lba; unsigned int bl_bank0_lba; unsigned int bl_bank1_lba; unsigned int current_os_lba; char unused2[8]; SceMbrParts parts; char unused3[0x6E]; char unused4[0x30]; unsigned short signature; } __attribute__((packed)) SceMbr;
Master Block
The first block (512 bytes) provides a partition table as well as auxiliary information to the block management drivers.
Offset | Size | Information |
---|---|---|
0x0 | 0x20 | magic. Magic string "Sony Computer Entertainment Inc. "
|
0x20 | 0x4 | version. Usually 3. |
0x24 | 0x4 | n_sectors. Size of device in blocks (ex: 0x70A000, 0x71A000: bigger ur0:) |
0x28 | 0x8 | unused. |
0x30 | 0x4 | loader_start. Second Loader (second_loader.enp) offset in blocks |
0x34 | 0x4 | loader_count. Second Loader (second_loader.enp) size in blocks |
0x38 | 0x4 | current_bl_lba. Active SLB2 offset in blocks (must be either bank0 or bank1) |
0x3C | 0x4 | bl_bank0_lba. SLB2 bank0 offset in blocks (default: 0x4000) |
0x40 | 0x4 | bl_bank1_lba. SLB2 bank1 offset in blocks (default: 0x6000) |
0x44 | 0x4 | current_os_lba. Active os0 offset in blocks (ex: 0x8000, 0x10000) |
0x48 | 0x8 | unused. |
0x50 | 0x110 (0x11 per partition * 0x10 partitions) | partition_table. Partition entries (there are 0x10 partitions at most (derived from code and data structure of SdStor driver)) |
0x160 | 0x9E | unused. |
0x1FE | 0x2 | signature. MBR signature: 0xAA55 |
Partition Entries
Each partition entry is 17 bytes long.
Offset | Size | Information |
---|---|---|
0x0 | 0x4 | start_lba. Partition offset (blocks) |
0x4 | 0x4 | n_sectors. Partition size (blocks) |
0x8 | 0x1 | part_id. Partition ID |
0x9 | 0x1 | part_type. Partition Type |
0xA | 0x1 | part_flag. Partition Flag (boolean) |
0xB | 0x2 | acl. Access control lists. Seen: 0x0555 , 0x0F0F (sloader, os, vsh) -> r--, 0x0F1F (idstor) -> ---, 0x0F4F , 0x0FFF (sysdata, vtrm, vshdata, updater, pidata, user) -> rwx
|
0xF | 0x4 | unused |
Partition ID
The Partition ID uniquely identifies the partition to its function. It is related to SceKernelModulemgr#Partition ID.
Partition ID | Block Device | Mountpoint | Physical Storage Holder | Description |
---|---|---|---|---|
0x0 | empty partition | |||
0x1 | "idstor" | Internal Flash | IdStorage | |
0x2 | "sloader" | Internal Flash | SLB2 Boot loaders | |
0x3 | "os" | os0 | Internal Flash | Main OS partition, contains kernel modules |
0x4 | "vsh" | vs0 | Internal Flash | System applications & libraries |
0x5 | "vshdata" | vd0 | Internal Flash | Registry and error history |
0x6 | "vtrm" | tm0 | Internal Flash | NpDrm, Marlin and DevKit/TestKit activations files |
0x7 | "user" | ur0 | Internal Flash | User resources, LiveArea cache, database, & other stuff |
0x8 | "userext" | ux0 | Internal Flash / Memory Card | Memory Card |
0x9 | "gamero" | gro0 | Game Card | Game Card read-only area |
0xA | "gamerw" | grw0 | Game Card | Game Card writable area |
0xB | "updater" | ud0 | Internal Flash | Updater application and PUP copied here before reboot |
0xC | "sysdata" | sa0 | Internal Flash | Dictionary and font data |
0xD | "mediaid" | Memory Card / Game Card | Some data on Memory Card & Game Card | |
0xE | "pidata" | pd0 | Internal Flash | Welcome Park and welcome video (Partition not present in Prototype units) |
0xF | "unused" | Unknown |
Partition Type
The partition type indicates the file system or if there is no file system (for example, in the case of a SLB2 archive).
Partition Type | Name |
---|---|
0x6 | FAT16 |
0x7 | exFAT |
0xDA | Raw data |
Partition Flag
Some partitions (specifically os0
and the boot loaders) have a shadow redundant copy. On System Software update, only the inactive partition is written to and finally the active partition is swapped. For partitions that do not use this activation feature, this value is ignored.