1

I'm trying to understand the partition table of my MTK-6572 based android smartphone (Karbonn-A35). The idea is to enlarge the internal Storage partition (mounted as /data) and correspondingly shrink the Phone Storage partition (mounted as /mnt/sdcard), so that I can install more apps on the phone without getting the "Disk Full" error. However, there is one thing I want to understand before proceeding to change the EBR1 partition file. Presently, here is how my MBR & EBR1 look like (yeah, I'm also wondering why the heck do they create an extended partition of 2TiB in size, whilst my sdcard is just 2GB!):

$disktype MBR
--- MBR
Regular file, size 512 bytes
DOS/MBR partition map
Partition 1: 2.000 TiB (2199023255040 bytes, 4294967295 sectors from 1024)
  Type 0x05 (Extended)
Partition 2: 10 MiB (10485760 bytes, 20480 sectors from 18432)
  Type 0x83 (Linux)
Partition 3: 10 MiB (10485760 bytes, 20480 sectors from 38912)
  Type 0x83 (Linux)
Partition 4: 650 MiB (681574400 bytes, 1331200 sectors from 113152)
  Type 0x83 (Linux)


$disktype EBR1
--- EBR1
Regular file, size 512 bytes
DOS/MBR partition map
Partition 1: 376 MiB (394264576 bytes, 770048 sectors from 1443328)
  Type 0x83 (Linux)
Partition 2: 1.293 GiB (1388314624 bytes, 2711552 sectors from 2213376)
  Type 0x83 (Linux)
Partition 3: 1.998 TiB (2196501691904 bytes, 4290042367 sectors from 4924928)
  Type 0x83 (Linux)

If you see the 4th and 5th partitions (i.e. the end of 4th in MBR and beginning of 1st in EBR1), there is some overlap. The fourth partition says 1331200 sectors from 113152. But when you count 1331200 sectors from 113152, you get 1444352 from where the next partition should begin. However, the next partition (i.e. the 1st in EBR) begins from 1443328 which is a bit earlier than that. Isn't that a kind of overlap for those few sectors (1444352−1443328=1024)? Those 1024 sectors are both part of 4th and 5th partitions? Or am I missing something about my understanding about partition tables?

That's one thing, another thing is about the third partition in EBR1. This wikipedia article on EBR says that only the first two entries in an EBR are supposed to be used:

EBRs have essentially the same structure as the MBR; except only the first two entries of the partition table are supposed to be used, besides having the mandatory boot record signature (or magic number) of 0xAA55 at the end of the sector.

Then how come the EBR1 of my device contains three entries? Again, is this a non-standard thing or am I missing something?

edit

Hex output of the EBR1 showing the three entries:

enter image description here

  • Please name the specific program (or file) that provided the above MBR & EBR output. – agc Jul 7 '16 at 2:44
  • @agc The file names are MBR and EBR1, I've extracted them from my phone using recovery tools. The disktype command gave the above output (edited the question). – Prahlad Yeri Jul 7 '16 at 3:12
  • I cannot explain these files but I think your idea to shrink and enlarge may be flawed in the first place. I would expect /mnt/sdcard to be removable SD card while Internal Storage may be a different internal device. If that's true, then you cannot expand one at the expense of the other. Can you remove the SD card and examine it under Linux in PC? – Kamil Maciorowski Jul 7 '16 at 5:20
  • @KamilMaciorowski Nope, the removable/external sdcard is a totally different beast which sits in /storage/sdcard1. This is about the main sdcard which is built inside the phone. On that, there are various partitions like /boot, /recovery, /data, etc. and finally the /sdcard (and also has a symlink at /mnt/sdcard). – Prahlad Yeri Jul 7 '16 at 6:09
  • All I want to do is take some space off the /sdcard partition and give it back to the /data partition. Reason why I want to do is that I already have a large 32gb external/removable sdcard already sitting on the /storage/sdcard1. But if the /data partition becomes full, the Play Store starts complaining and I can no longer install apps. – Prahlad Yeri Jul 7 '16 at 6:11
1

Extended boot records only need contain two values, and your EBRs probably do. The second entry in an EBR points to the next EBR (unless it is the last one in the chain).

Your disktype utility walks the chain of three EBRs and display each of the entries as if they were a multiple entry MBR.

(This is explained in the Values section of the wikipedia article)

  • Well, actually my EBR1 contains three entries, not two! I'm so sure of it because I opened the EBR1 file in a hex editor and seen those three values (I've edited the question with the hex values). – Prahlad Yeri Jul 7 '16 at 6:13
  • And I'm still unable to understand why that space overlap of 1024 sectors between the fourth and fifth partitions? – Prahlad Yeri Jul 7 '16 at 6:19

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.