![]() |
#16 |
Member
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 17
Karma: 17948
Join Date: Oct 2012
Device: KT
|
@eureka: Thank you. I will try this method on my K4 later.
When you mount the new ext3 partition you do not use the entries of the partitiontable in mmcblk0p4. This means there is a discrepancy between that partition table and the actual start of the ext3 partition? This calculated offset could be written into the partition table on mmcblk0p4, so that mounting the ext3 partition on the host can be done without the offset option? Why do I have to mount it via /dev/loop? What about simply doing "mount -o offset=1075838976 /dev/mmcblk0p4 /somehwere" ? |
![]() |
![]() |
![]() |
#17 | ||
but forgot what it's like
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 741
Karma: 2345678
Join Date: Dec 2011
Location: north (by northwest)
Device: Kindle Touch
|
Quote:
But it's:
Also, I don't use entries from parition table at /dev/mmcblk0p4, because I don't know how to do it. I believe, it's not possilble at all. /dev/mmcblk0p4 is the partition, not the separate block device. Tools just don't know anything about that "embedded" paritition table and they couldn't be pointed at it. Quote:
You could mount with your command. With losetup loop device is chosen by you, and with your command loop device is chosen by mount tool. It's the sole difference, AFAIK. Last edited by eureka; 11-01-2012 at 12:48 AM. Reason: provide PART_SIZE |
||
![]() |
![]() |
Advert | |
|
![]() |
#18 |
but forgot what it's like
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 741
Karma: 2345678
Join Date: Dec 2011
Location: north (by northwest)
Device: Kindle Touch
|
And here is a basic upstart script for mounting/unmounting filesystem (described earlier):
Code:
start on started system and started syslog stop on stopping filesystems pre-start script source /etc/upstart/functions losetup -o 1075838976 /dev/loop/1 /dev/mmcblk0p4 mount -t ext3 /dev/loop/1 /mnt/newpart f_log I newpart mount "newpart is mounted" end script post-stop script source /etc/upstart/functions umount /mnt/newpart losetup -d /dev/loop/1 f_log I newpart umount "newpart is unmounted" end script |
![]() |
![]() |
![]() |
#19 | |||
Carpe diem, c'est la vie.
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 6,433
Karma: 10773668
Join Date: Nov 2011
Location: Multiverse 6627A
Device: K1 to PW3
|
Quote:
Quote:
I thought that loop mounting was for mounting an image file as a block device, rather than raw partitions. If I am wrong in my thinking here, please enlighten me. Thanks... EDIT: WikiPedia seems to agree with me: http://en.wikipedia.org/wiki/Loop_device Quote:
Last edited by geekmaster; 11-01-2012 at 03:43 AM. |
|||
![]() |
![]() |
![]() |
#20 | |
Member
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 17
Karma: 17948
Join Date: Oct 2012
Device: KT
|
Quote:
Code:
fdisk -l /dev/mmcblk0p4 Code:
sfdisk --force -l /dev/mmcblk0p4 Code:
fdisk -l /dev/sdc Adding the offset to the start value in the partition table avoids the need to remember this offset. |
|
![]() |
![]() |
Advert | |
|
![]() |
#21 |
BLAM!
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 13,506
Karma: 26047190
Join Date: Jun 2010
Location: Paris, France
Device: Kindle 2i, 3g, 4, 5w, PW, PW2, PW5; Kobo H2O, Forma, Elipsa, Sage, C2E
|
Just a quick note to point out that (according to the PW's cramfs mount scripts), loop/1 is historically reserved for the SDCard (while loop/0 is the userstore). (And the PW uses a couple of loop devices for cramfs, too).
|
![]() |
![]() |
![]() |
#22 |
Going Viral
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
|
Notes:
There is (should be, don't know the behavior of your Busybox build) a: "find next free" loop device option. No need to hard code which one to use, lots of reasons to not do so. Yes, the loop driver can operate as a device-device layer, not just as a file-device layer. In fact, if I recall correctly, the author of the driver recommends that it be used device-device rather than the more common usage of turning a file into a device. Somewhere in this thread someone posted that the large offset was to the **second** FAT, it isn't, its the offset to the **first** FAT. You can see that in the layout of the eMMC device itself, which has a DOS disk label in the first sector and a 32Mbyte offset to the start of the first partition's file system. And yes, you can have a "DOS disk label" at the first sector of each partition, further dividing that partition. Its in the MS specs. (please don't ask for the link, I lost it years ago). But when you find it, you will find that it is a recursive definition. Not many disk partitioning and formating applications handle that aspect of the "DOS disk label". Back in the day that I needed it for a commercial project, I had to write my own. ![]() |
![]() |
![]() |
![]() |
#23 |
( ͡° ͜ʖ ͡°){ʇlnɐɟ ƃǝs}Týr
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 6,586
Karma: 6299991
Join Date: Jun 2012
Location: uti gratia usura (Yao ying da ying; Mo ying da yieng)
Device: PW-WIFI|K5-3G+WIFI| K4|K3-3G|DXG|K2| Rooted Nook Touch
|
well. I have very little to add other than when the process is 100% solid I will certainly be giving this a go. Thanks everyone for the info
|
![]() |
![]() |
![]() |
#24 | |||||
but forgot what it's like
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 741
Karma: 2345678
Join Date: Dec 2011
Location: north (by northwest)
Device: Kindle Touch
|
Quote:
Quote:
Quote:
What I don't know is how to mount with, say mount /dev/mmcblk0p4p2 instead of using losetup. Quote:
Quote:
Code:
[root@kindle root]# mount rootfs on / type rootfs (rw) /dev/root on / type ext3 (ro,noatime,nodiratime,data=writeback) none on /proc type proc (rw,nosuid,nodev,noexec,relatime) none on /sys type sysfs (rw,nosuid,nodev,noexec,relatime) tmpfs on /dev type tmpfs (rw,relatime,mode=755) tmpfs on /dev/shm type tmpfs (rw,relatime) devpts on /dev/pts type devpts (rw,relatime,gid=5,mode=620) tmpfs on /var type tmpfs (rw,relatime,size=32768k) /dev/loop/1 on /mnt/newpart type ext3 (rw,relatime,errors=continue,data=writeback) /dev/mmcblk0p3 on /var/local type ext3 (rw,relatime,errors=continue,data=writeback) fsp on /mnt/us type fuse.fsp (rw,nosuid,nodev,noatime,user_id=0,group_id=0) /dev/loop/0 on /mnt/base-us type vfat (rw,noexec,noatime,nodiratime,fmask=0022,dmask=0022,codepage=cp437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro) [root@kindle root]# losetup -h losetup: invalid option -- 'h' BusyBox v1.17.1 (2012-07-17 16:29:54 PDT) multi-call binary. Usage: losetup [-o OFS] LOOPDEV FILE - associate loop devices losetup -d LOOPDEV - disassociate losetup [-f] - show Options: -o OFS Start OFS bytes into FILE -f Show first free loop device [root@kindle root]# losetup -f /dev/loop0 Last edited by eureka; 11-01-2012 at 08:07 AM. |
|||||
![]() |
![]() |
![]() |
#25 | |
Member
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 17
Karma: 17948
Join Date: Oct 2012
Device: KT
|
Quote:
But on the connected PC I could mount it directly with the mount command. - On the other hand, why would someone want to mount the ext3 partition on the PC via usbdrive. I am prefering sshfs. So: The offset could be written to the partition table. But it is practically no use. I agree. |
|
![]() |
![]() |
![]() |
#26 | ||
but forgot what it's like
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 741
Karma: 2345678
Join Date: Dec 2011
Location: north (by northwest)
Device: Kindle Touch
|
Quote:
Spoiler:
Quote:
While it generally doesn't bring any harm, sometimes Linux system automounts all paritions on removable device (such as Kindle) and then this parition could be used by heedless user simultaneously from computer side and Kindle side. So there is some value in skipping of creating of new parition (i.e. skipping of making a new record in parition table) and then just using free space after shrinked userstore parition as-is. Here is diff of userstore from Kindle Touch 5.1.2 with just shrinking of userstore parition: Spoiler:
And here is command for calculating absolute offset of new free space (in bytes, from start of eMMC device): Code:
[root@kindle root]# expr 512 \* \( \ > $(sfdisk -uS -l --force /dev/mmcblk0p4 | awk '/mmcblk0p4p1/ {print $3 + 1}') \ > \+ $(cat /sys/class/block/mmcblk0p4/start) \ > \) |
||
![]() |
![]() |
![]() |
#27 |
but forgot what it's like
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 741
Karma: 2345678
Join Date: Dec 2011
Location: north (by northwest)
Device: Kindle Touch
|
Right before intializing of userstore parition (i.e. before creating of parition table and formatting of new parition), usestore script clears first cylinder of /dev/mmcblk0p4 with the following command (some values are defined with variables, but I've expanded them here just for convenience):
Code:
# clear the first cylinder dd if=/dev/zero of=/dev/mmcblk0p4 bs=64 count=1 |
![]() |
![]() |
![]() |
#28 |
Going Viral
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 17,212
Karma: 18210809
Join Date: Feb 2012
Location: Central Texas
Device: No K1, PW2, KV, KOA
|
Yeah, right!
As if a flash device had "cylinders". Do not presume the author of what you read in Consumer Linux devices knew what they where doing. |
![]() |
![]() |
![]() |
#29 |
( ͡° ͜ʖ ͡°){ʇlnɐɟ ƃǝs}Týr
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 6,586
Karma: 6299991
Join Date: Jun 2012
Location: uti gratia usura (Yao ying da ying; Mo ying da yieng)
Device: PW-WIFI|K5-3G+WIFI| K4|K3-3G|DXG|K2| Rooted Nook Touch
|
|
![]() |
![]() |
![]() |
#30 |
Carpe diem, c'est la vie.
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 6,433
Karma: 10773668
Join Date: Nov 2011
Location: Multiverse 6627A
Device: K1 to PW3
|
Windows XP likes to "think" that FAT devices have 53 sectors per track, which makes a cylinder a multiple of 53 (NOT a power of two). Because all partitions start on a cylinder boundary, this causes misalignment between disk clusters and mmc erase block, causing wasteful read/modify/write operations across mismatched boundaries (which has the side effect of flashing each erase block TWICE). This was remedied in Windows 7, by using SSD-friendly 1MB alignment.
So, from an XP point of view, the device IS treated as having "cylinders", much to the detriment of performance (and extra write wear). And older linux drivers use "XP-style" FAT partition alignment... |
![]() |
![]() |
![]() |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
PRS-T1 Questions about repartitioning | simongee | Sony Reader Dev Corner | 47 | 11-06-2012 05:07 AM |
Kindle Touch: Bricked and readonly filesystem | pmugabi | Kindle Developer's Corner | 6 | 09-17-2012 01:50 AM |
PRS-T1 Completed guide for repartitioning. | homeos | Sony Reader Dev Corner | 20 | 04-05-2012 11:54 AM |
PB360 Filesystem error | ArchCarrier | PocketBook | 4 | 06-06-2010 08:46 AM |
Stock kindle 2 filesystem (2.0.3 or newer preferred) | eousphoros | Kindle Developer's Corner | 10 | 02-17-2010 08:40 PM |