Register Guidelines E-Books Search Today's Posts Mark Forums Read

Go Back   MobileRead Forums > E-Book Readers > Amazon Kindle > Kindle Developer's Corner

Notices

Reply
 
Thread Tools Search this Thread
Old 03-11-2012, 06:42 PM   #1
geekmaster
Всё гениальное просто.
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: 5,066
Karma: 6789001
Join Date: Nov 2011
Location: Щедрость не имеет пределов.
Device: *.*
kindle touch partition within a partition?

I saw these messages in my touch logs (captured output) while poking around in diags:
Code:
Disk /dev/mmcblk0p4: 105536 cylinders, 4 heads, 16 sectors/track
Old situation:
Units = sectors of 512 bytes, counting from 0

   Device Boot    Start       End   #sectors  Id  System
/dev/mmcblk0p4p1            16   6754303    6754288   b  W95 FAT32
/dev/mmcblk0p4p2             0         -          0   0  Empty
/dev/mmcblk0p4p3             0         -          0   0  Empty
/dev/mmcblk0p4p4             0         -          0   0  Empty
New situation:
Units = sectors of 512 bytes, counting from 0

   Device Boot    Start       End   #sectors  Id  System
/dev/mmcblk0p4p1            16   6754303    6754288   b  W95 FAT32
/dev/mmcblk0p4p2             0         -          0   0  Empty
/dev/mmcblk0p4p3             0         -          0   0  Empty
/dev/mmcblk0p4p4             0         -          0   0  Empty
Successfully wrote the new partition table

Re-reading the partition table ...
Perhaps that explains why we need to mount mmcblk0p4 with offset=8192, except for the fact that those devices do not *actually* exist. I wonder if we can resize those partitions inside the mmcblk0p4 partition...

Last edited by geekmaster; 03-11-2012 at 06:48 PM.
geekmaster is offline   Reply With Quote
Old 03-11-2012, 06:54 PM   #2
ixtab
0x2A
ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.
 
ixtab's Avatar
 
Posts: 2,903
Karma: 6677427
Join Date: Dec 2011
Device: K3, K4, K5, KPW, KPW2
I don't know how it could be done on the Kindle itself, but if you have an image file, you can just use fdisk,parted, etc. using the file instead of a real device. If you're using some tool which refuses to work on files, you could losetup a device first.

It's pretty much exactly the same method as used here, except that you're treating the device as a disk rather than as a partition (i.e., run fdisk /dev/loop0, rather than mkfs.ext3)
ixtab is offline   Reply With Quote
Old 03-11-2012, 07:08 PM   #3
geekmaster
Всё гениальное просто.
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: 5,066
Karma: 6789001
Join Date: Nov 2011
Location: Щедрость не имеет пределов.
Device: *.*
Quote:
Originally Posted by ixtab View Post
...
It's pretty much exactly the same method as used here, except that you're treating the device as a disk rather than as a partition (i.e., run fdisk /dev/loop0, rather than mkfs.ext3)
I have done plenty of loop mounts (usually with "mount -o loop"). It just seemed odd to me here that these startup script output messages report that it "successfully wrote" a partition table inside mmcblk0p4, and using /dev/mmcblk0p4p1, which is not in /dev/mmc*.

BTW, these messages are created when "/bin/sh /etc/rcS.d/S50diags start" starts up.
geekmaster is offline   Reply With Quote
Old 03-11-2012, 07:17 PM   #4
ixtab
0x2A
ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.
 
ixtab's Avatar
 
Posts: 2,903
Karma: 6677427
Join Date: Dec 2011
Device: K3, K4, K5, KPW, KPW2
Quote:
Originally Posted by geekmaster View Post
I have done plenty of loop mounts (usually with "mount -o loop"). It just seemed odd to me here that these startup script output messages report that it "successfully wrote" a partition table inside mmcblk0p4, and using /dev/mmcblk0p4p1, which is not in /dev/mmc*.
The "p1-p4" suffixes could simply be an artifact of whichever program output the message when it modified the "disk" /dev/mmcblk0p4.
BTW, the nomenclature is unusual for Linux, it looks more like what you see on BSD systems.

That said, think of it as fdisk running on some device (/dev/sample0, assuming that's a valid one) . While you're modifying the partition table, you would "write" to partitions /dev/sample0p1 etc. and possibly log messages accordingly, even if these devices only come to life once the partition table was written and the kernel reloaded it.

Hope this was understandable
ixtab is offline   Reply With Quote
Old 03-11-2012, 09:52 PM   #5
Nyoxi
Connoisseur
Nyoxi can really shake a tail feather.Nyoxi can really shake a tail feather.Nyoxi can really shake a tail feather.Nyoxi can really shake a tail feather.Nyoxi can really shake a tail feather.Nyoxi can really shake a tail feather.Nyoxi can really shake a tail feather.Nyoxi can really shake a tail feather.Nyoxi can really shake a tail feather.Nyoxi can really shake a tail feather.Nyoxi can really shake a tail feather.
 
Posts: 55
Karma: 116549
Join Date: Jan 2012
Device: Kindle Touch
Damn. At first I thought that geekmaster has faulty memory, but after inspecting the IRC logs it seems more like my memory is faulty. I could swear that we did already discuss this ... well maybe not.

Yes the trick with mmcblk0p4 is that it doesn't contain the FAT filesystem directly but instead for some reason I still don't understand it contains a partition table and then the FAT filesystem.

As for the output (created by fdisk) ... the nonexisting device names like /dev/mmcblk0p4p1 are not a problem. It is just fdisk trying to be smart and helpful by telling user what the device names for the partitions most likely are (it is in no way attempting to access them).

So now I told you. Better late than never, huh?

I would really like to know what made people at Amazon decide to do this.
Nyoxi is offline   Reply With Quote
Old 03-11-2012, 10:10 PM   #6
geekmaster
Всё гениальное просто.
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: 5,066
Karma: 6789001
Join Date: Nov 2011
Location: Щедрость не имеет пределов.
Device: *.*
Quote:
Originally Posted by Nyoxi View Post
... after inspecting the IRC logs it seems more like my memory is faulty. I could swear that we did already discuss this ...
"Déjà vu" all over again, eh? http://en.wikipedia.org/wiki/Déjà_vu
"the experience of feeling sure that one has already witnessed or experienced a current situation, even though the exact circumstances of the prior encounter are uncertain and were perhaps imagined"

BTW, this is a sign of not enough sleep ... or your connection to "The Matrix" has been hijacked.

Quote:
Originally Posted by Nyoxi View Post
... I would really like to know what made people at Amazon decide to do this.
Although I did not study extended partitions in any detail, this is sort of how they work.

You can only have 4 primary partitions. If you set one or more of them to an extended partition, then you can put multiple logical partitions inside the extended partitions.

I suspect that treating partition 4 as a block device and giving it 4 more primary partitions was an easier hack than adding support for extended partitions and logical partitions inside them, and amazon wanted these things ready in time for the Christmas shopping season.

Why they did this, but then did not USE any extra partitions inside the inner partition table, is the *real* mystery -- perhaps for future expansion.

It looks like you COULD put more partitions on the "inner" block device and they would survive startup (but perhaps not a factory restore). This would let you shrink the vfat partition and add an ext3 partition after it. But WHY would anybody EVER want to do THAT?

Last edited by geekmaster; 03-11-2012 at 10:31 PM.
geekmaster is offline   Reply With Quote
Old 03-12-2012, 03:13 AM   #7
ixtab
0x2A
ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.ixtab ought to be getting tired of karma fortunes by now.
 
ixtab's Avatar
 
Posts: 2,903
Karma: 6677427
Join Date: Dec 2011
Device: K3, K4, K5, KPW, KPW2
I *guess* the reason is actually pretty simple.

The Kindles need to export a part of their storage via USB. Then again, Windows doesn't seem to like devices which do not contain a partition table, but directly a filesystem. Try it: take an old usb stick and mkfs.vfat /dev/sdb.

I think (assuming non-faulty memory ) that I've seen Windows accept such devices a few times, but simply not being able to use them most of the time. Windows clearly wants a partition table on a disk, even one with a single partition in it.

So there you have it. The easiest way to achieve this is to export the partition as a drive - and to create a partition table in the partition.
ixtab is offline   Reply With Quote
Old 03-12-2012, 07:13 AM   #8
Nyoxi
Connoisseur
Nyoxi can really shake a tail feather.Nyoxi can really shake a tail feather.Nyoxi can really shake a tail feather.Nyoxi can really shake a tail feather.Nyoxi can really shake a tail feather.Nyoxi can really shake a tail feather.Nyoxi can really shake a tail feather.Nyoxi can really shake a tail feather.Nyoxi can really shake a tail feather.Nyoxi can really shake a tail feather.Nyoxi can really shake a tail feather.
 
Posts: 55
Karma: 116549
Join Date: Jan 2012
Device: Kindle Touch
The "extended partition" stuff works differently. You designate the last partition (let's say number 4) as extended and this allows you to create more partitions inside numbered 5, 6, etc. So after that you realy have block devices /dev/foo5 and /dev/foo6 along with your /dev/foo1 etc.

But what ixtab says gives sense. You have also the partition table on the exported usb drive. But I always thought that this is only virtual.
Nyoxi is offline   Reply With Quote
Old 03-12-2012, 08:53 AM   #9
geekmaster
Всё гениальное просто.
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: 5,066
Karma: 6789001
Join Date: Nov 2011
Location: Щедрость не имеет пределов.
Device: *.*
Quote:
Originally Posted by Nyoxi View Post
The "extended partition" stuff works differently. You designate the last partition (let's say number 4) as extended and this allows you to create more partitions inside numbered 5, 6, etc. So after that you realy have block devices /dev/foo5 and /dev/foo6 along with your /dev/foo1 etc.

But what ixtab says gives sense. You have also the partition table on the exported usb drive. But I always thought that this is only virtual.
That is why I said "sort of how they work", meaning that it has similar behavior, but is implemented differently.

@ixtab: Yes, that makes a lot of sense. I have various flash media that I have put multiple partitions on, and only SOME of them can be marked as a USB HARD DRIVE instead of generic removable media.

If you cannot mark your media as a hard drive (using special USB commands not supported by all flash media), then you need to fake it with windows registry changes, so that windows will see more than the first partition.

Alternate solutions that amazon *could* have used would be to make the exported USB drive appear as a USB hard drive, or to make the first partition on the main partition table. But their solution is probably more reliable.

One side benefits of exporting a device as a USB hard drive is that windows will let you format it as NTFS without using special software to do that.

Thanks ixtab for finally managing to get the information you have been trying to teach me into my "thick" head.
geekmaster is offline   Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
How to copy apps from unrooted partition to a rooted partition? fredlave Nook Color & Nook Tablet 2 06-16-2012 12:46 PM
Easy way to resize kindle partition? zxcvbs Kindle Developer's Corner 0 04-16-2012 01:50 PM
Dear Advanced Users. Could please share Kindle DX graphite Us version partition stranger_st Kindle Developer's Corner 0 10-19-2011 08:29 AM
Unmounting a partition? owly Barnes & Noble NOOK 0 09-29-2011 02:38 PM
Installer partition Mike_73 Sony Reader 0 03-12-2010 03:56 PM


All times are GMT -4. The time now is 02:45 AM.


MobileRead.com is a privately owned, operated and funded community.