Difference between revisions of "NAND"

From The iPhone Wiki
Jump to: navigation, search
m (Undo revision 27457 by 5urd (talk) chip size, not iOS device)
(completely rewrote page)
Line 1: Line 1:
[[Image:8GBflash.jpg|thumb|left|Example of a NAND chip.]]
+
[[File:8GBflash.jpg|thumb|right|A NAND chip.]]
  +
'''NAND''', so called because of its use of [[wikipedia:NAND gate|not AND gates]], is a type of [[wikipedia:Flash memory|non-volatile memory chip]] that is used in all [[iDevice]]s. This chip is where all the ''storage'' (not memory) of the device is located. NAND chips can range anywhere from 4 GiB to 128 GiB.
This refers to the NAND flash chip used in the [[Apple TV]], [[iPad]], [[iPhone]], and [[iPod touch]]. This is where all the storage capacity comes from. The capacity in each chip can range from as little as 4 GB to as many as 128 GB. In iOS, it is split into two partitions: the system partition and the user partition. The system partition contains the [[iOS]] operating system and the native Apple applications, and is mounted as read-only. The user partition contains all user data, including installed applications, music, and movies, and is mounted as read/write. Jailbreaking modifies the file [[/etc/fstab]] to enable read and write access on both partitions.
 
<div style="clear:both"></div>
 
   
== Extras ==
+
== Partitions ==
  +
{{seealso|/private/etc/fstab}}
NAND partition layout in modern devices, courtesy [[CPICH]], published in [https://twitter.com/cpich3g/status/15966288660660224 Twitter] ([http://freepdfhosting.com/29256fdff9.pdf NAND partition layout])...
 
  +
In the case of [[iOS]], it is split into two [[/private/etc/fstab|partitions]], a root partition ranging from 256(?) MiB to 1 GiB, and a user partition occupying the rest. The root partition is located first on the chip and is [[/sbin/mount|mounted]]<sup>[<nowiki/>[[wikipedia:mount (Unix)|WP]]<nowiki/>][<span class="plainlinks">[http://linux.die.net/man/8/mount man]</span>]</sup> to the [[/|root of the filesystem]] (<code>/</code>). The user partition is located after the root partition on the chip and is mounted to [[/private/var/mobile]] ([[/private/var/root]] on [[iOS|iPhone OS]] 1.1.2 and below).
  +
=== Size of Partitions ===
  +
The size of the root partition has varied throughout [[iOS]]'s history, while the user partition just fills the rest of the space of the NAND chip. Here is a comparison of the size of the root partition compared to iOS version:
  +
* 256 MiB: ?<!-- did this even exist? -->
  +
* 512 MiB: ? - 4.0(?)
  +
* 1024 MiB: 4.0(?) - present
   
=== PDF thumbs ===
+
== Jailbreaking ==
  +
{{seealso|Jailbreak}}
  +
Jailbreaking, in it's simplest form, involves modifying [[/private/etc/fstab]] before being parsed by the [[kernelcache|kernel]] to mount the [[/|root partition]] as read-write (<code>rw</code>), as opposed to read-only (<code>ro</code>). The only use of a so called "bare-bones" jailbreak is a proof-of-concept. A semi known example (the only publicly disclosed) of a "bare-bones" jailbreak is the [[k66ap|Apple TV 2G]] from [[Mojave 8M89 (Apple TV 2G)|4.0]] (4.1) to [[Jasper 8C150 (Apple TV 2G)|4.1]] (4.2).
  +
  +
== Data Layout ==
  +
As NAND chips are not hard drives, their "sector" sizes are different than that of a typical hard drive. In fact, they aren't even called sectors, but instead called a "page".
  +
  +
The difference between a page and a sector is that a [modern] hard drive sector contains either 512 or 4096 bytes of data with anywhere from roughly 30 to 250 bytes of [[Error detection and correction|error correction code]] (ECC) data, while a page contains 8192 bytes of data and **no** ECC. ECC is most likely not used as flash memory uses transistors, which are more reliable than magnetism to store data. It has, however, been [http://www.micron.com/~/media/Documents/Products/Software%20Article/SWNL_implementing_ecc.pdf proposed to implement ECC in flash memory] as the smaller [[wikipedia:Semiconductor device fabrication|fabrication process]] has shrunk to the width of about [[wikipedia:22 nanometer|150]] helium atoms (<code>.14 nm</code>).
  +
  +
The next level up from a page is a block which is a collection of 128 pages. A block can be compared to a 4K sector hard drive that emulates 512 byte sectors.
  +
  +
The layout of an 8 GiB chip containing [[iOS]] has been documented by [[CPICH]]. He [https://twitter.com/cpich3g/status/15966288660660224 notes] that the document is an [[iPhone 4]], but it could easily be adapted to any other [[iDevice|device]] or [[Firmware|firmware version]]. He uploaded the document [http://freepdfhosting.com/29256fdff9.pdf FreePDFHosting]<sup>[dead]</sup>, but it was later removed after 30 days as per [http://freepdfhosting.com/faq.php their policy]. The document was later thumbnailed by [[User:MuscleNerd|MuscleNerd]] and uploaded here:
 
<gallery>
 
<gallery>
Image:N1.png|Page 1
+
File:N1.png|Page 1
Image:N2.png|Page 2
+
File:N2.png|Page 2
Image:N3.png|Page 3
+
File:N3.png|Page 3
Image:N4.png|Page 4
+
File:N4.png|Page 4
Image:N5.png|Page 5
+
File:N5.png|Page 5
 
</gallery>
 
</gallery>
  +
  +
== See Also ==
  +
* [[/private/etc/fstab]]
  +
* [[Jailbreak]]
   
 
== External Links ==
 
== External Links ==
  +
* [http://freepdfhosting.com/29256fdff9.pdf NAND Layout of iPhone 4]<sup>{{man|VERSION}}{{man|DEAD}}</sup> documented by [[CPICH]]
*[http://esec-lab.sogeti.com/dotclear/public/publications/11-hitbamsterdam-iphonedataprotection.pdf Presentation "iPhone data protection in depth" explaining the encryption]
 
  +
* [http://esec-lab.sogeti.com/ SOGETI ESEC-Labs] on the [http://esec-lab.sogeti.com/dotclear/public/publications/11-hitbamsterdam-iphonedataprotection.pdf encryption of iOS devices]

Revision as of 00:36, 31 December 2012

A NAND chip.

NAND, so called because of its use of not AND gates, is a type of non-volatile memory chip that is used in all iDevices. This chip is where all the storage (not memory) of the device is located. NAND chips can range anywhere from 4 GiB to 128 GiB.

Partitions

Template:Seealso In the case of iOS, it is split into two partitions, a root partition ranging from 256(?) MiB to 1 GiB, and a user partition occupying the rest. The root partition is located first on the chip and is mounted[WP][man] to the root of the filesystem (/). The user partition is located after the root partition on the chip and is mounted to /private/var/mobile (/private/var/root on iPhone OS 1.1.2 and below).

Size of Partitions

The size of the root partition has varied throughout iOS's history, while the user partition just fills the rest of the space of the NAND chip. Here is a comparison of the size of the root partition compared to iOS version:

  • 256 MiB: ?
  • 512 MiB: ? - 4.0(?)
  • 1024 MiB: 4.0(?) - present

Jailbreaking

Template:Seealso Jailbreaking, in it's simplest form, involves modifying /private/etc/fstab before being parsed by the kernel to mount the root partition as read-write (rw), as opposed to read-only (ro). The only use of a so called "bare-bones" jailbreak is a proof-of-concept. A semi known example (the only publicly disclosed) of a "bare-bones" jailbreak is the Apple TV 2G from 4.0 (4.1) to 4.1 (4.2).

Data Layout

As NAND chips are not hard drives, their "sector" sizes are different than that of a typical hard drive. In fact, they aren't even called sectors, but instead called a "page".

The difference between a page and a sector is that a [modern] hard drive sector contains either 512 or 4096 bytes of data with anywhere from roughly 30 to 250 bytes of error correction code (ECC) data, while a page contains 8192 bytes of data and **no** ECC. ECC is most likely not used as flash memory uses transistors, which are more reliable than magnetism to store data. It has, however, been proposed to implement ECC in flash memory as the smaller fabrication process has shrunk to the width of about 150 helium atoms (.14 nm).

The next level up from a page is a block which is a collection of 128 pages. A block can be compared to a 4K sector hard drive that emulates 512 byte sectors.

The layout of an 8 GiB chip containing iOS has been documented by CPICH. He notes that the document is an iPhone 4, but it could easily be adapted to any other device or firmware version. He uploaded the document FreePDFHosting[dead], but it was later removed after 30 days as per their policy. The document was later thumbnailed by MuscleNerd and uploaded here:

See Also

External Links