View Single Post
Old 05-05-2016, 08:11 PM   #48
geekmaster
Carpe diem, c'est la vie.
geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.geekmaster ought to be getting tired of karma fortunes by now.
 
geekmaster's Avatar
 
Posts: 6,433
Karma: 10773670
Join Date: Nov 2011
Location: Multiverse 6627A
Device: K1 to PW3
As I mentioned above, adding a fifth primary partition to an MBR partition table is a bad idea. Leaving it as unused space and then using it anyway is an ugly hack. The right way is to shorten the first logical partition in the extend partition table in mmpblk0p4. I will list the master and extended partition tables here (this is on a K5):
Code:
[root@kindle us]# sfdisk -l /dev/mmcblk0

Disk /dev/mmcblk0: 120832 cylinders, 4 heads, 16 sectors/track
Units = cylinders of 32768 bytes, blocks of 1024 bytes, counting from 0

   Device Boot Start     End   #cyls    #blocks   Id  System
/dev/mmcblk0p1   *   1024   12223   11200     358400   83  Linux
/dev/mmcblk0p2      12224   14271    2048      65536   83  Linux
/dev/mmcblk0p3      14272   15295    1024      32768   83  Linux
/dev/mmcblk0p4      15296  120831  105536    3377152    b  W95 FAT32
[root@kindle us]# sfdisk -l /dev/mmcblk0p4 --force

Disk /dev/mmcblk0p4: 105536 cylinders, 4 heads, 16 sectors/track
Units = cylinders of 32768 bytes, blocks of 1024 bytes, counting from 0

   Device Boot Start     End   #cyls    #blocks   Id  System
/dev/mmcblk0p4p1          0+ 105535  105536-   3377144    b  W95 FAT32
/dev/mmcblk0p4p2          0       -       0          0    0  Empty
/dev/mmcblk0p4p3          0       -       0          0    0  Empty
/dev/mmcblk0p4p4          0       -       0          0    0  Empty
[root@kindle us]#
Note that I had to force sfdisk to list the extended partition, to stop it from complaining.

As shown above, the extended partition table (inside mmcblk0p4) has three empty extended partitions available. Placing multiple partitions inside mmcblk0p4 *should* allow them to be exported to some host operating systems (though windows tends to only show the first partition on USB flash devices).

And just to prove that mmcblk0p4 is special (includes its own partition table), here is an example of trying to list the partitions in mmcblk0p3:
Code:
[root@kindle us]# sfdisk -l /dev/mmcblk0p3 --force

Disk /dev/mmcblk0p3: 1024 cylinders, 4 heads, 16 sectors/track

sfdisk: ERROR: sector 0 does not have an msdos signature
 /dev/mmcblk0p3: unrecognized partition table type
No partitions found
[root@kindle us]#
EDIT:And in fact, this is why the userstore partition is loop mounted with an offset, to skip over the MBR partition table and mount the internal extended partition (simulating mounting a virtual mmcblk0p4p1 which is not provided as its own device in /dev). You need to extract offsets from the extended partition table and loop mount the contents with that offset.

Last edited by geekmaster; 05-05-2016 at 09:17 PM.
geekmaster is offline   Reply With Quote