Difference between revisions of "Partitions"

From Vita Development Wiki
Jump to navigation Jump to search
(20 intermediate revisions by 5 users not shown)
Line 2: Line 2:
  
 
== Master Block ==
 
== Master Block ==
 +
 
The first block (512 bytes) provides a partition table as well as auxiliary information to the block management drivers.
 
The first block (512 bytes) provides a partition table as well as auxiliary information to the block management drivers.
 +
 
{| class="wikitable"
 
{| class="wikitable"
|-
 
 
! Offset
 
! Offset
 
! Size
 
! Size
Line 11: Line 12:
 
| 0x0
 
| 0x0
 
| 0x20
 
| 0x20
| Magic string "<code>Sony Computer Entertainment Inc.</code>"
+
| magic. Magic string "<code>Sony Computer Entertainment Inc.</code>"
 
|-
 
|-
 
| 0x20
 
| 0x20
 
| 0x4
 
| 0x4
| Version ? (0x3)
+
| version. Usually 3.
 
|-
 
|-
 
| 0x24
 
| 0x24
 
| 0x4
 
| 0x4
| Size of device in blocks
+
| n_sectors. Size of device in blocks (ex: 0x70A000, 0x71A000: bigger ur0:)
 
|-
 
|-
 
| 0x28
 
| 0x28
| 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 sloader offset in blocks (ex: 0x4000, 0x6000)
 +
|-
 +
| 0x3C
 +
| 0x4
 +
| bl_bank0_lba. ?sloader size in blocks? (ex: 0x4000)
 +
|-
 +
| 0x40
 +
| 0x4
 +
| bl_bank1_lba. Inactive sloader offset in blocks (ex: 0x4000, 0x6000)
 +
|-
 +
| 0x44
 +
| 0x4
 +
| current_os_lba. Active os0 offset in blocks (ex: 0x8000, 0x10000)
 +
|-
 +
| 0x48
 +
| 0x8
 +
| unused.
 
|-
 
|-
 
| 0x50
 
| 0x50
| 0x11 - 0x110
+
| 0x110 (0x11 per partition * 0x10 partitions)
| [[Partitions#Partition Entries|Partition entries]] (there are 0x10 partitions at most (derived from code and data structure of SdStor driver))
+
| partition_table. [[Partitions#Partition Entries|Partition entries]] (there are 0x10 partitions at most (derived from code and data structure of SdStor driver))
 
|-
 
|-
 
| 0x160
 
| 0x160
 
| 0x9E
 
| 0x9E
| unknown (zeros)
+
| unused.
 
|-
 
|-
 
| 0x1FE
 
| 0x1FE
 
| 0x2
 
| 0x2
| 0xAA55 signature
+
| signature. MBR signature: 0xAA55
 
|}
 
|}
  
 
== Partition Entries ==
 
== Partition Entries ==
Each partition entry is 17 bytes long. Offset 0x0 means end of table.
+
 
 +
Each partition entry is 17 bytes long.
 +
 
 
{| class="wikitable"
 
{| class="wikitable"
|-
 
 
! Offset
 
! Offset
 
! Size
 
! Size
Line 48: Line 78:
 
| 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 Code|Partition code]]
+
| part_id. [[Partitions#Partition ID|Partition ID]]
 
|-
 
|-
 
| 0x9
 
| 0x9
 
| 0x1
 
| 0x1
| [[Partitions#Partition Type|Partition type]]
+
| part_type. [[Partitions#Partition Type|Partition Type]]
 
|-
 
|-
 
| 0xA
 
| 0xA
 
| 0x1
 
| 0x1
| [[Partitions#Partition Active|Partition active]]
+
| part_flag. [[Partitions#Partition Flag|Partition Flag]] (boolean)
 
|-
 
|-
 
| 0xB
 
| 0xB
| 0x1
+
| 0x4
| Flags ? seen: <code>0x1F</code>, <code>0x0F</code>, <code>0xFF</code>, <code>0x55</code>
+
| acl. Seen: <code>0x00000555</code>, <code>0x00000F0F</code> (sloader, os, vsh) -> r--, <code>0x00000F1F</code> (idstor) -> ---, <code>0x00000F4F</code>, <code>0x00000FFF</code> (sysdata, vtrm, vshdata, updater, pidata, user) -> rwx
 
|-
 
|-
| 0xC
+
| 0xF
| 0x5
+
| 0x2
| ?
+
| unused
 
|}
 
|}
=== Partition Code ===
+
 
The partition code uniquely identifies the partition to its function. It is related to [[SceKernelModulemgr#Partition Code]] but the meaning of the code is still unknown.
+
=== Partition ID ===
 +
 
 +
The Partition ID uniquely identifies the partition to its function. It is related to [[SceKernelModulemgr#Partition ID]].
 +
 
 
{| class="wikitable"
 
{| class="wikitable"
|-
 
 
! Code
 
! Code
 +
! Block Device
 
! Name
 
! Name
 
! Location Seen
 
! Location Seen
 
! Description
 
! Description
 +
|-
 +
| 0x0
 +
|
 +
|
 +
|
 +
| empty partition
 
|-
 
|-
 
| 0x1
 
| 0x1
 +
| "idstor"
 
|  
 
|  
 
| Internal
 
| Internal
| first eMMC partition, some data, [[IdStorage]]?
+
| [[IdStorage]]
 
|-
 
|-
 
| 0x2
 
| 0x2
 +
| "sloader"
 
|  
 
|  
 
| Internal
 
| Internal
| [[SLB2]] [[Boot Sequence|Boot loaders]]
+
| [[SLB2]] [[Boot Sequence#Boot_Partition|Boot loaders]]
 
|-
 
|-
 
| 0x3
 
| 0x3
 +
| "os"
 
| os0
 
| os0
 
| Internal
 
| Internal
| Main OS partition, contains kernel [[Libraries#Kernel|libraries]]
+
| Main OS partition, contains kernel [[Modules|modules]]
 
|-
 
|-
 
| 0x4
 
| 0x4
 +
| "vsh"
 
| vs0
 
| vs0
 
| Internal
 
| Internal
| Contains [[Libraries#System Applications|system applications]] & libraries
+
| [[Modules|System applications & libraries]]
 
|-
 
|-
 
| 0x5
 
| 0x5
 +
| "vshdata"
 
| vd0
 
| vd0
 
| Internal
 
| Internal
Line 109: Line 153:
 
|-
 
|-
 
| 0x6
 
| 0x6
 +
| "vtrm"
 
| tm0
 
| tm0
 
| Internal
 
| Internal
| Unknown, has an empty folder <code>nphome</code>
+
| NpDrm, Marlin and DevKit/TestKit activations files
 
|-
 
|-
 
| 0x7
 
| 0x7
 +
| "user"
 
| ur0
 
| ur0
 
| Internal
 
| Internal
Line 119: Line 165:
 
|-
 
|-
 
| 0x8
 
| 0x8
 +
| "userext"
 
| ux0
 
| ux0
| Memory Card
+
| Internal / Memory Card
 
| [[Memory Card]]
 
| [[Memory Card]]
 
|-
 
|-
 
| 0x9
 
| 0x9
 +
| "gamero"
 
| gro0
 
| gro0
 
| Game Card
 
| Game Card
| [[Game Card]]
+
| [[Game Card]] read-only area
 
|-
 
|-
| ?
+
| 0xA
 +
| "gamerw"
 
| grw0
 
| grw0
 
| Game Card
 
| Game Card
Line 134: Line 183:
 
|-
 
|-
 
| 0xB
 
| 0xB
 +
| "updater"
 
| ud0
 
| ud0
 
| Internal
 
| Internal
| [[Updater]] copied here before reboot
+
| [[Updater]] application and PUP copied here before reboot
 
|-
 
|-
 
| 0xC
 
| 0xC
 +
| "sysdata"
 
| sa0
 
| sa0
 
| Internal
 
| Internal
Line 144: Line 195:
 
|-
 
|-
 
| 0xD
 
| 0xD
 +
| "mediaid"
 
|  
 
|  
 
| External
 
| External
Line 149: Line 201:
 
|-
 
|-
 
| 0xE
 
| 0xE
 +
| "pidata"
 
| pd0
 
| pd0
 
| Internal
 
| Internal
| [[Welcome Park]] and welcome video
+
| [[Welcome Park]] and welcome video (Partition not present in Prototype units)
 +
|-
 +
| 0xF
 +
| "unused"
 +
|
 +
| External
 +
| Unknown
 
|}
 
|}
  
 
=== Partition Type ===
 
=== Partition Type ===
 +
 
The partition type code indicates the file system used or if there is no file system (for example, in the case of a [[SLB2]] archive).
 
The partition type code indicates the file system used or if there is no file system (for example, in the case of a [[SLB2]] archive).
 +
 
{| class="wikitable"
 
{| class="wikitable"
|-
 
 
! Code
 
! Code
 
! Description
 
! Description
Line 171: Line 231:
 
|}
 
|}
  
=== Partition Active ===
+
=== 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 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.
 +
  
 
[[Category:System]]
 
[[Category:System]]

Revision as of 18:20, 9 August 2020

All devices on the 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. Because of block level encryption, the master block is also encrypted along with everything else and cannot be seen if the device is dumped from an external dumper.

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 sloader offset in blocks (ex: 0x4000, 0x6000)
0x3C 0x4 bl_bank0_lba. ?sloader size in blocks? (ex: 0x4000)
0x40 0x4 bl_bank1_lba. Inactive sloader offset in blocks (ex: 0x4000, 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 0x4 acl. Seen: 0x00000555, 0x00000F0F (sloader, os, vsh) -> r--, 0x00000F1F (idstor) -> ---, 0x00000F4F, 0x00000FFF (sysdata, vtrm, vshdata, updater, pidata, user) -> rwx
0xF 0x2 unused

Partition ID

The Partition ID uniquely identifies the partition to its function. It is related to SceKernelModulemgr#Partition ID.

Code Block Device Name Location Seen Description
0x0 empty partition
0x1 "idstor" Internal IdStorage
0x2 "sloader" Internal SLB2 Boot loaders
0x3 "os" os0 Internal Main OS partition, contains kernel modules
0x4 "vsh" vs0 Internal System applications & libraries
0x5 "vshdata" vd0 Internal Registry and error history
0x6 "vtrm" tm0 Internal NpDrm, Marlin and DevKit/TestKit activations files
0x7 "user" ur0 Internal User resources, LiveArea cache, database, & other stuff
0x8 "userext" ux0 Internal / 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 Updater application and PUP copied here before reboot
0xC "sysdata" sa0 Internal Dictionary and font data
0xD "mediaid" External Some data on Memory Card & Game Card
0xE "pidata" pd0 Internal Welcome Park and welcome video (Partition not present in Prototype units)
0xF "unused" External Unknown

Partition Type

The partition type code indicates the file system used or if there is no file system (for example, in the case of a SLB2 archive).

Code Description
0x6 FAT16
0x7 exFAT
0xDA Raw data

Partition Flag

Some partitions (specifically os0 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.