View Single Post
Old 10-31-2012, 02:10 AM   #7
EternalCyclist
Member
EternalCyclist for a long time would go to bed early.EternalCyclist for a long time would go to bed early.EternalCyclist for a long time would go to bed early.EternalCyclist for a long time would go to bed early.EternalCyclist for a long time would go to bed early.EternalCyclist for a long time would go to bed early.EternalCyclist for a long time would go to bed early.EternalCyclist for a long time would go to bed early.EternalCyclist for a long time would go to bed early.EternalCyclist for a long time would go to bed early.EternalCyclist for a long time would go to bed early.
 
Posts: 17
Karma: 17948
Join Date: Oct 2012
Device: KT
If had read Eureka's post in time, I would have tried that. But I was already in troubles at that time. "Was" because now it works - well, almost.

What I did up to now
I kept the diags partition and just resized and moved mmcblk0p4.

Save the beginning of /dev/mmcblk0.
.. assuming that there is the partition table and other data I might have to reflash sometimes.
Spoiler:
Code:
dd if=/dev/mmcblk0 | nc myhost
I actually forgot to set the count option and just killed the pipe after a few seconds.

Unmount mmcblk0p4
Spoiler:
Code:
unmount /mnt/base-us
Trying to unmount /mnt/us failed with "device busy". Therefore I killed the fsp process.
Luckily it just died and did not restart.

Repartition
Using fdisk I moved the start of /dev/mmcblk0p4. Moving up the start instead of moving down the end is neccessary, as I want to resize /dev/mmcblk0p2 in order to keep partition numbering the same.

The new partition table:
Spoiler:
Quote:
fdisk -l

Disk /dev/mmcblk0: 3909 MB, 3909091328 bytes
4 heads, 16 sectors/track, 119296 cylinders
Units = cylinders of 64 * 512 = 32768 bytes

Device Boot Start End Blocks Id System
/dev/mmcblk0p1 * 1025 12224 358400 83 Linux
/dev/mmcblk0p2 12225 14272 65536 83 Linux
/dev/mmcblk0p3 14273 15296 32768 83 Linux
/dev/mmcblk0p4 80000 119296 1257504 b Win95 FAT32

After writing the partition table fdisk said:
"kernel still has old partition table. cannot fdisk /dev/mmcblk0p4".
True.
Code:
fdisk -l /dev/mmcblk0p4
still prints the original partition table.
Thus writing of that secondary partition table is not possible without reboot. As I doubted that the Kindle will come up with a damaged partition, I dd'ed the raw data of the beginning of the original partition to the start of the resized one.
Spoiler:
Code:
# verify that I am really at the beginning of the table and compare it with the backup of the partition on PC.
dd if=/dev/mmcblk0 bs=512 skip=978943 count=10 | hd
dd if=/data/kindle/mmcblk0p4_20121029.img bs=512 skip=0 count=10 | hd

# Copying.Note: Maybe count should have matched the new partition size, but
# the filesystem is damaged anyway.
dd if=/dev/mmcblk0 bs=512 skip=978944 count=10000 of=/dev/mmcblk0 seek=5119936
# compare beginning of new partition with the old one
dd if=/dev/mmcblk0 bs=512 skip=5119936 count=10 | hd

THAT WAS A MISTAKE! Because the partition table has wrong size and the vfat file system ist damaged.
I rather should have created a new mmcblk0p4 with the new size at the PC. Formatting it there and even copying the original data to that system and dd|nc'ing it to the new Kindle partition.

After rebooting the Kindle hanged. dmesg on the PC printed some infos about new scssi device but did not mount it. Almost the same as I had the night before after restoring the old partition (see first post). But this time I was at least able to put the Kindle in bootloader mode and reboot it with imx_usb. But it hangs, regardless of main or diags booting. Leaving it, going to sleep.

This morning the Kindle is working again. After setting it in USB device mode the PC even mounted the damaged partition table. Of course with some error messages.
Spoiler:
Code:
> dmesg
...
[  120.978992] scsi 13:0:0:0: Direct-Access     Kindle   Internal Storage 0100 PQ: 0 ANSI: 2
[  120.979656] sd 13:0:0:0: Attached scsi generic sg8 type 0
[  120.984855] sd 13:0:0:0: [sdg] 2515008 512-byte logical blocks: (1.28 GB/1.19 GiB)
[  121.092740] sd 13:0:0:0: [sdg] Write Protect is off
[  121.092745] sd 13:0:0:0: [sdg] Mode Sense: 0f 00 00 00
[  121.092748] sd 13:0:0:0: [sdg] Assuming drive cache: write through
[  121.202342] sd 13:0:0:0: [sdg] Assuming drive cache: write through
[  121.202348]  sdg: sdg1
[  121.205427] sdg: p1 size 6655984 exceeds device capacity, enabling native capacity
[  121.312102] sd 13:0:0:0: [sdg] Assuming drive cache: write through
[  121.312107]  sdg: sdg1
[  121.313300] sdg: p1 size 6655984 exceeds device capacity, limited to end of disk
[  121.431998] sd 13:0:0:0: [sdg] Assuming drive cache: write through
[  121.432006] sd 13:0:0:0: [sdg] Attached SCSI removable disk

> ls /media/usb0/
ls: cannot access /media/usb0/developer: Input/output error
ls: cannot access /media/usb0/diagnostic_logs: Input/output error

fdisk on the PC shows the original (now wrong) partition table.
Spoiler:
Code:
 
> fdisk -l /dev/sdg

Disk /dev/sdg: 1287 MB, 1287684096 bytes
4 heads, 16 sectors/track, 39297 cylinders
Units = cylinders of 64 * 512 = 32768 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x00000003

   Device Boot      Start         End      Blocks   Id  System
/dev/sdg1               1      104000     3327992    b  W95 FAT32

So far...
I think I will try to format the partition from the PC. At least in diags mode it should do no harm.

Last edited by EternalCyclist; 10-31-2012 at 02:10 AM. Reason: typo
EternalCyclist is offline   Reply With Quote