You are on page 1of 13

Partitionsdetailedlookateachone

Jumptosection:
Introductiondumpingpartitions Fileandpartitionsizes References Mountinganimage /dev/block/nandabootloader /dev/block/nandbenv /dev/block/nandcboot /dev/block/nanddsystem /dev/block/nandedata /dev/block/nandfmisc /dev/block/nandgrecovery /dev/block/nandhcache /dev/block/nandiemmc(a.k.a.databk) /dev/block/nandjsdcard

Introductiondumpingpartitions
This is all done on Mum's tablet, which has the original firmware on it. I had been using it for a while,sotherewillbeadditionalapplicationsanddatapresent.First,let'sdumpeachpartitionfrom thedeviceontoanSDcard.InsertablankSDcard(atleast4GBthiswilltakeupalotofspace), bootupintoAndroid,connecttothecomputer,thenrunthefollowingADBcommands:
a d bk i l l s e r v e r a d bd e v i c e s a d bs h e l l" c a t/ d e v / b l o c k / n a n d a>/ m n t / e x t s d / n a n d a . i m g " a d bs h e l l" c a t/ d e v / b l o c k / n a n d b>/ m n t / e x t s d / n a n d b . i m g " a d bs h e l l" c a t/ d e v / b l o c k / n a n d c>/ m n t / e x t s d / n a n d c . i m g " a d bs h e l l" c a t/ d e v / b l o c k / n a n d d>/ m n t / e x t s d / n a n d d . i m g " a d bs h e l l" c a t/ d e v / b l o c k / n a n d e>/ m n t / e x t s d / n a n d e . i m g " a d bs h e l l" c a t/ d e v / b l o c k / n a n d f>/ m n t / e x t s d / n a n d f . i m g " a d bs h e l l" c a t/ d e v / b l o c k / n a n d g>/ m n t / e x t s d / n a n d g . i m g " a d bs h e l l" c a t/ d e v / b l o c k / n a n d h>/ m n t / e x t s d / n a n d h . i m g " a d bs h e l l" c a t/ d e v / b l o c k / n a n d i>/ m n t / e x t s d / n a n d i . i m g " a d bs h e l l" c a t/ d e v / b l o c k / n a n d j>/ m n t / e x t s d / n a n d j . i m g "

(These commands could be put into a batch file.) After 510min, you should now have image files correspondingtoeachofthe10partitions.TransfertheseovertoaUSBstickmoreusefullater.

Fileandpartitionsizes
Here'sthecontentsof/proc/partitionsonthetablet.Thesizesarein blocks ,whereonblock=1024 bytes.
m a j o rm i n o r # b l o c k s n a m e 9 3 9 3 9 3 9 3 0 8 1 6 2 4 1 6 3 8 4n a n d a 1 6 3 8 4n a n d b 3 2 7 6 8n a n d c 5 2 4 2 8 8n a n d d

9 3 9 3 9 3 9 3 9 3 9 3

3 2 4 0 4 8 5 6 6 4 7 2

1 0 4 8 5 7 6n a n d e 1 6 3 8 4n a n d f 3 2 7 6 8n a n d g 2 6 2 1 4 4n a n d h 1 3 1 0 7 2n a n d i 1 8 0 9 4 0 8n a n d j

Next,here'sthesizes(inbytes)ofeachoftheimagefiles,obtainedusinglslonLinux:
l i n d s a y @ l i n d s a y V o s t r o 1 3 1 0 : ~ $l sl t o t a l3 9 8 3 5 4 0 2 2 4 r w r r -1l i n d s a yl i n d s a y 1 6 7 7 7 2 1 6J a n r w r r -1l i n d s a yl i n d s a y 1 6 7 7 7 2 1 6J a n r w r r -1l i n d s a yl i n d s a y 3 3 5 5 4 4 3 2J a n r w r r -1l i n d s a yl i n d s a y 5 3 6 8 7 0 9 1 2J a n r w r r -1l i n d s a yl i n d s a y1 0 7 3 7 4 1 8 2 4J a n r w r r -1l i n d s a yl i n d s a y 1 6 7 7 7 2 1 6J a n r w r r -1l i n d s a yl i n d s a y 3 3 5 5 4 4 3 2J a n r w r r -1l i n d s a yl i n d s a y 2 6 8 4 3 5 4 5 6J a n r w r r -1l i n d s a yl i n d s a y 1 3 4 2 1 7 7 2 8J a n r w r r -1l i n d s a yl i n d s a y1 8 5 2 8 3 3 7 9 2J a n

41 2 : 4 3n a n d a . i m g 41 2 : 4 3n a n d b . i m g 41 2 : 4 3n a n d c . i m g 41 2 : 4 6n a n d d . i m g 41 2 : 5 0n a n d e . i m g 41 2 : 5 0n a n d f . i m g 41 2 : 5 0n a n d g . i m g 41 2 : 5 1n a n d h . i m g 41 2 : 5 2n a n d i . i m g 41 2 : 5 8n a n d j . i m g

Inordertocomparethiswiththepartitionsizes,weneedtodisplaythefilesizesinblocksaswell. Thiscanbedoneusingtheblocksize=1024switch:
l i n d s a y @ l i n d s a y V o s t r o 1 3 1 0 : ~ $l slb l o c k s i z e = 1 0 2 4 t o t a l3 8 9 0 1 9 2 r w r r -1l i n d s a yl i n d s a y 1 6 3 8 4J a n 41 2 : 4 3n a n d a . i m g r w r r -1l i n d s a yl i n d s a y 1 6 3 8 4J a n 41 2 : 4 3n a n d b . i m g r w r r -1l i n d s a yl i n d s a y 3 2 7 6 8J a n 41 2 : 4 3n a n d c . i m g r w r r -1l i n d s a yl i n d s a y 5 2 4 2 8 8J a n 41 2 : 4 6n a n d d . i m g r w r r -1l i n d s a yl i n d s a y1 0 4 8 5 7 6J a n 41 2 : 5 0n a n d e . i m g r w r r -1l i n d s a yl i n d s a y 1 6 3 8 4J a n 41 2 : 5 0n a n d f . i m g r w r r -1l i n d s a yl i n d s a y 3 2 7 6 8J a n 41 2 : 5 0n a n d g . i m g r w r r -1l i n d s a yl i n d s a y 2 6 2 1 4 4J a n 41 2 : 5 1n a n d h . i m g r w r r -1l i n d s a yl i n d s a y 1 3 1 0 7 2J a n 41 2 : 5 2n a n d i . i m g r w r r -1l i n d s a yl i n d s a y1 8 0 9 4 0 8J a n 41 2 : 5 8n a n d j . i m g

Comparingthesewiththepartitionsizesfrom/proc/partitions,wecanseethattheyareexactlythe same,asexpected.

References
Here'ssomegoodreferencesonpartitions: http://androidforums.com/evo4gallthingsroot/278898androidpartitionskernels explained.html http://androidforums.com/evo4gallthingsroot/279261moreinformationaboutandroid partitions.html http://www.addictivetips.com/mobile/androidpartitionsexplainedbootsystemrecoverydata cachemisc/

MountinganimageasafilesystemunderLinux
SomeofthepartitionimagesarefilesystemswhichcanbedirectlymountedunderLinux.Thistakes a wee bit of trickery. As an example, we'll use the nanda.img image file. All this is done under Ubuntu12.04. First, copy the image file to the Linux machine I put it on the desktop (i.e. under /home/lindsay/Desktop). Next, make a new directory on the desktop for example, nanda. This will be the mount point for

theimagefile. To enable read/write permissions on the mounted image, we need to know the user id (UID) and groupid(GID)ofthecurrentuser.Thisisdoneusingtheidcommand:

l i n d s a y @ l i n d s a y V o s t r o 1 3 1 0 : ~ $i d u i d = 1 0 0 0 ( l i n d s a y )g i d = 1 0 0 0 ( l i n d s a y )g r o u p s = 1 0 0 0 ( l i n d s a y ) , 4 ( a d m ) , 2 4 ( c d r o m ) , 2 7 ( s u d o ) , 3 0 ( d i p ) , 4

So,theUIDis1000,andtheGIDis1000. We'renowreadytomountthedevice.Runthefollowingcommand(seehere):
s u d om o u n tol o o p , u i d = 1 0 0 0 , g i d = 1 0 0 0tv f a tn a n d a . i m gn a n d a

This mounts the nanda.img file, with the directory nanda as the mount point. The t switch specifiedavfatfilesystem,andtheospecifiestheUIDandGIDoptions(soyoucanread&write tothefilesystem).Browsethenandafolderyou'llseethewholefilesystemandcanaddorremove filesasrequired. Oncefinished,unmounttheimagewiththefollowing:
s u d ou m o u n tn a n d a

Thenanda.imgimagefile,althoughremainingthesamesize,willcontaintheupdatedfilesystem. Let'stakealookatthepartitions.

/dev/block/nandabootloader
Thisistheveryfirstpartitionwhichtheprocessorlooksatonstartup.Mountusing
s u d om o u n tol o o p , u i d = 1 0 0 0 , g i d = 1 0 0 0tv f a tn a n d a . i m gn a n d a

Here'sthecontentsoftheimage:

Some interesting stuff. script.bin is the configuration file used by the A13 processor when first starting (see here, although that's for an A10). boot.axf appears to be Allwinner's own bootloader, whichcanthenloaduboot(containedinsidethelinuxdirectory). Clickhereforatreelistingofallfilesanddirectoriesintheimage(obtainedusingthe sudo tree F command). Here'sthecontentsofthelinuxdirectory:

Andthecontentsoflinux.ini:
[ s e g m e n t ] i m g _ n a m e=c : \ l i n u x \ u b o o t . b i n i m g _ s i z e=0 x 8 0 0 0 0 i m g _ b a s e=0 x 4 A 0 0 0 0 0 0 [ s c r i p t _ i n f o ] s c r i p t _ b a s e=0 x 4 3 0 0 0 0 0 0 s c r i p t _ s i z e=0 x 1 0 0 0 0 [ l o g o _ i n f o ] l o g o _ n a m e=c : \ l i n u x \ l i n u x . b m p l o g o _ s h o w=1

Thissaystousetheubootbootloader.Tochangethesmallsquarelogoshownfirstonstartup,just replacethelinux.bmpimagewithanotherofthesamekind(32bitcolour). The os_show directory contains various images used by the bootloader, mainly battery charging symbols.

/dev/block/nandbenv
Thispartitionisabitofamystery.Verylittleinformationisavailableonit. It appears to be related to the uboot bootloader (which is located on /dev/block/nanda). According tohere,itistheenvironmenttoassistuboot. Somemoreinformationisavailablehere: Many embedded devices these days use the UBoot bootloader. This bootloader stores its configurationintoanareaoftheflashcalledtheenvironmentthatcanbemanipulatedfromwithinU Boot using the printenv, setenv and saveenv commands, or from Linux using the fw_printenv and fw_setenv userspace utilities provided with the UBoot source code. This environment is typically stored in a specific flash location, defined in the board configuration header in UBoot. The environment is basically stored as a sequence of nullterminated strings, with a little header containingachecksumatthebeginning. Andmore,fromhere: Many embedded devices these days use the UBoot bootloader. This bootloader stores its configurationintoanareaoftheflashcalledtheenvironment...... YetanotherhintisintheCOMMON_SYS_CONFIG000000.fexfilewhichcanbeunpackedfromthe stockROM.Init,variouspartitionsarelisted,andthisoneiscalled"environmentforuboot". Going through the file. We first have, from 0x4 to 0x1D6, some text with the NUL char signifying endofline:

b o o t d e l a y = 2 b o o t c m d = r u ns e t a r g sb o o t _ n o r m a l c o n s o l e = t t y S 0 , 1 1 5 2 0 0 n a n d _ r o o t = / d e v / n a n d c m m c _ r o o t = / d e v / m m c b l k 0 p 4 i n i t = / i n i t l o g l e v e l = 8 s e t a r g s = s e t e n vb o o t a r g sc o n s o l e = $ { c o n s o l e }r o o t = $ { n a n d _ r o o t }i n i t = $ { i n i t }l o g l e v e l = $ { l o g l e v e b o o t _ n o r m a l = n a n dr e a d4 0 0 0 7 8 0 0b o o t ; b o o t a4 0 0 0 7 8 0 0 b o o t _ r e c o v e r y = n a n dr e a d4 0 0 0 7 8 0 0r e c o v e r y ; b o o t a4 0 0 0 7 8 0 0 b o o t _ f a s t b o o t = f a s t b o o t r e c o v e r y _ k e y _ v a l u e _ m a x = 0 x 1 3 r e c o v e r y _ k e y _ v a l u e _ m i n = 0 x 1 0 f a s t b o o t _ k e y _ v a l u e _ m a x = 0 x 8 f a s t b o o t _ k e y _ v a l u e _ m i n = 0 x 2

All 00 until 0x1F4D5 to 0x2016C. Some gibberish first, but then we have the text (from 0x2004 to 0x2016C):

b o o t d e l a y = 3 b o o t c m d = r u ns e t a r g sb o o t _ n o r m a l c o n s o l e = t t y S 0 , 1 1 5 2 0 0 n a n d _ r o o t = / d e v / n a n d d m m c _ r o o t = / d e v / m m c b l k 0 p 7 i n i t = / i n i t l o g l e v e l = 8 s e t a r g s = s e t e n vb o o t a r g sc o n s o l e = $ { c o n s o l e }r o o t = $ { m m c _ r o o t }i n i t = $ { i n i t }l o g l e v e l = $ { l o g l e v e l b o o t _ n o r m a l = m m cr e a d4 0 0 0 7 8 0 02 2 0 0 01 0 0 0 0 ; b o o t a4 0 0 0 7 8 0 0

b o o t _ r e c o v e r y = m m cr e a d4 0 0 0 7 8 0 0r e c o v e r y ; b o o t a4 0 0 0 7 8 0 0 b o o t _ f a s t b o o t = f a s t b o o t

All00untilgibberishbetween0x3F4D7to0x3FFFF,thenFFforremainderoffile. Whateverthisis,itlooksimportant,soit'sprobablyagoodideatoalsobackupthispartition.

/dev/block/nandcboot
Thiscontainsthekernelandramdisk.Itagaincannotbemountedasis,soitagainhastobesplit up and unpacked using unmkbootimg and gunzip, as descriped elsewhere. After doing this, we get:

Clickherefortreelisting. initlogo.rle is the image which is shown immediately after the small square bootloader image but beforetheanimatedAndroidtextlogo.It'spossibletochangethisseeelsewhere. Descriptionofthispartition(fromhere): This is the partition that enables the phone to boot, as the name suggests. It includes the kernel and the ramdisk. Without this partition, the device will simply not be able to boot. Wiping this partition from recovery should only be done if absolutely required and once done, the device must NOTberebootedbeforeinstallinganewone,whichcanbedonebyinstallingaROMthatincludesa /bootpartition.

/dev/block/nanddsystem
ThisiswherealltheAndroidsystemfilesarelocated.Mountusing
s u d om o u n tol o o pte x t 4n a n d d . i m gn a n d d

Note that the uid=1000,gid=1000 doesn't apply to an ext4 filesystem, so it will be mounted read only. To add/remove any files from it, you'll either need to do it with sudo at the shell prompt, or (moredangerous)startasuperusersessionofyourfilemanagere.g.sudonautilus. Here'sthecontents:

Clickhereforatreelisting.Noticethebuild.propfilethiscontainsdetailsaboutthetablet. Descriptionofthispartition(fromhere): Thispartitionbasicallycontainstheentireoperatingsystem,otherthanthekernelandtheramdisk. This includes the Android user interface as well as all the system applications that come pre installedonthedevice.WipingthispartitionwillremoveAndroidfromthedevicewithoutrenderingit unbootable,andyouwillstillbeabletoputthephoneintorecoveryorbootloadermodetoinstalla newROM.

/dev/block/nandedata
Mountusing:
s u d om o u n tol o o pte x t 4n a n d e . i m gn a n d e

Screenshotofthecontents:

Clickhereforatreelisting. Descriptionofthispartition(fromhere): Alsocalleduserdata,thedatapartitioncontainstheusersdatathisiswhereyourcontacts, messages,settingsandappsthatyouhaveinstalledgo.Wipingthispartitionessentiallyperformsa factoryresetonyourdevice,restoringittothewayitwaswhenyoufirstbootedit,orthewayitwas afterthelastofficialorcustomROMinstallation.Whenyouperformawipedata/factoryresetfrom recovery,itisthispartitionthatyouarewiping.

/dev/block/nandfmisc
Accordingtohere: This partition contains miscellaneous system settings in form of on/off switches. These settings mayincludeCID(CarrierorRegionID),USBconfigurationandcertainhardwaresettingsetc.Thisis animportantpartitionandifitiscorruptormissing,severalofthedevicesfeatureswillwillnot functionnormally. Andhere: Partitionusedtopassdataamongstvariousstagesofthebootchain(e.g.bootintorecoverymode, fastbootetc) However,itappearsthatthispartitionisn'tusedforthispurposeonmytablets.Thenandfimagefile seemstocontainjustafewlargeblocksof0x00or0xFF.Here'sasummaryofthecontentsofthe imagefileobtainedfromavarietyofdifferentsituations.Ialsodidatesttoseewhat,ifanything,is writtentothepartition.Textdescriptionsfirst,thenanimage.

1. From original good tablet (Mum's). 0x00 from offset 0x0 to 0x43F, then 0xFF from 0x440 to 0xFFFFFF. 2. Also from original good tablet, but can't remember how I obtained this. 0xFF from 0x0 to 0x1FF,0x00from0x200to0x43F,then0xFFfrom0x440to0xFFFFFF. 3.Totallyrandom.Icreatedanimagefilewithtotallyrandombytesthroughoutandflashedthisto nandfonthetestingtablet. 4. Random image, after booting into Android. Booted the testing tablet into Android. nandf is identicaltotherandomimagenochange. 5. Random image, after rebooting into CWM recovery. Next booted into CWM recovery. Some change0xFFfrom0x00to0x1FF,remainderrandomasbefore. 6.Randomimage,afterrebootingintoAndroidagain.Nochangefrombefore. To make all this eaiser to visualise, here's a graphical representation of each image file. Each image shows the first 3200 bytes, arranged in 16x200 pixels, with the grayscale value correspondingtothebyte.

Itwouldappearthatthispartitionissomehowwritten tobythetablet,soIwouldguessthereisno needtobackupthispartition,solongasitexists.

/dev/block/nandgrecovery
Thiscontainstherecoverypartition.Itcannotbemountedasis,sinceitcontainsbothakerneland ramdisk. It has to be split up using the technique described on my other page "Unpacking and repacking CWM recovery image". After using unmkbootimg and gunzip, we end up with the followingramdiskcontents:

Clickhereforthetreestructure. ThisisverysimilartotheCWMrecoveryramdisk,withslightdifferences(e.g.fewerimagesinthe res/images directory, and a different init binary). This is because the recovery is a stock recovery partition. The contents of this partition are also very similar to the boot (nandc) partition, since it alsocontainsakernelandramdisk. Descriptionofthispartition(fromhere): The recovery partition can be considered as an alternative boot partition that lets you boot the deviceintoarecoveryconsoleforperformingadvancedrecoveryandmaintenanceoperationsonit.

/dev/block/nandhcache
Mountwith
s u d om o u n tol o o pte x t 4n a n d h . i m gn a n d h

Contents:

Clickhereforatreelisting. The only interesting file is recovery/last_log click here to see it. It appears to be a log of everythingwhichhappenedthelasttimethetabletwasbootedintorecoverymode. Descriptionofthispartition(fromhere): This is the partition where Android stores frequently accessed data and app components. Wiping thecachedoesnteffectyourpersonaldatabutsimplygetsridoftheexistingdatathere,which getsautomaticallyrebuiltasyoucontinueusingthedevice.

/dev/block/nandiemmc(a.k.a.databk)
Thispartitioniscalled emmcwhenbootedintoCWMrecovery,andiscalled databkwhenyoulook atthedmesglogfromthebootedAndroidsystem.Mountusing:
s u d om o u n tol o o pte x t 4n a n d i . i m gn a n d i

Here'sascreenshotoftherootdirectory:

Clickhereforatreelisting. Not much interesting there what's data_backup.tar though? Let's copy it out and extract it it producesafoldercalleddata,whichcontains:

Clickherefortreelisting. This would appear to be a complete backup copy of the data partition (hence the name databk in thedmesgoutput).Whenorhowitwascreated,I'mnotsureperhapsthelasttimerecoverymode was started. Since it is a backup copy, I would imagine that this partition (emmc) could be wiped withoutanyproblems. Further confirmation that this is a backup of the data partition comes again from the COMMON_SYS_CONFIG000000.fex file, where it's called "data image backup". I don't quite see how it could be a complete backup, since the emmc partition is much smaller than the data partition.

/dev/block/nandjsdcard
Thisisthe"internal"SDcard,usedforstoringuserfiles,pictures,videosetc.Mountusing
s u d om o u n tol o o p , u i d = 1 0 0 0 , g i d = 1 0 0 0tv f a tn a n d j . i m gn a n d j

Here'sascreenshotoftherootdirectory:

Clickhereforatreelistingofallfilesanddirectories. Descriptionofthispartition(fromhere): This is not a partition on the internal memory of the device but rather the SD card. In terms of usage,thisisyourstoragespacetouseasyouseefit,tostoreyourmedia,documents,ROMsetc. on it. Wiping it is perfectly safe as long as you backup all the data you require from it, to your computerfirst.ThoughseveraluserinstalledappssavetheirdataandsettingsontheSDcardand wiping this partition will make you lose all that data. On devices with both an internal and an externalSDcarddevicesliketheSamsungGalaxySandseveraltabletsthe/sdcard partitionisalwaysusedtorefertotheinternalSDcard.FortheexternalSDcardifpresent analternativepartitionisused,whichdiffersfromdevicetodevice.IncaseofSamsungGalaxy S series devices, it is /sdcard/sd while in many other devices, it is /sdcard2. Unlike /sdcard, no system or app data whatsoever is stored automatically on this external SD card and everything present on it has been added there by the user. You can safely wipe it after backing up any data fromitthatyouneedtosave.

Backtoindex

You might also like