New: XDA launches forum for app developers. Discuss coding, tools, marketing, and more.
XDA Developers Android and Mobile Development Forum
Forgot your password?
 
Post Reply+
Tip us?
 
roustabout
Old
(Last edited by roustabout; 30th August 2011 at 08:39 PM.) Reason: add partition details
#1  
Senior Member - OP
Thanks Meter 141
Posts: 425
Join Date: Feb 2011
Default Nook Touch Partition Hacking

Folks are starting to look at the ST partition table and the file layout on the ST. This post is intended for other folks with power tools to think about.

My goals:

- expose the BN content (so I can read the New Yorker on my NC, mostly, but also so I can manage the library on my ST with Calibre as I do on the NC)

- understand how much room I have on the internal memory

- increase the amount of memory available for sideloading.

I got in well over my head during a conference call last week, but my ST is reborn and now able to do cool things.

However: I did not start from a factory fresh partitioning scheme, sadly. My first backup of the device went permanently offline (the disk and linux install containing it) and I was unable to return to it after I'd borked the ST pretty badly on the call. All I really was sure of was the partition order.

The tools:

- "noogie." Available and discussed at http://nookdevs.com/NookTouch_Rooting

- the rooting disk from http://forum.xda-developers.com/show....php?t=1132693 (currently at 1-6-24 - mad props to the folks who put that together!)

- a working Linux installation with USB support. Vmware player in Windows works just fine for this.

Note: currently, that third element is key; this is not intended as a walkthrough that tons of people could follow today, but to spark awareness of the technique - it seems possible that something very much like the DeanG scripts for redoing the NC partitions could emerge. Hint Hint.

First: the noogie disk is super cool. You boot from it and it mounts all of your ST partitions. So you can get a complete backup in linux (or Mac) by :

#dd if=/dev/sdX of=virigin.ST.img bs=1M

A true disk image backup.

You could (if you were patient) get the individual partitions as well - there is value in doing that, because within the first three partitions your serial number is stored. It's possible to restore this image to a different ST -- but then you've also transferred your serial number. whoops.

You can mount the partitions in linux and copy all the files from each of them as well.

After you have a backup, power off, insert the simple touch root disk, and power up. It will boot to a screen that reads "rooted forever" (as does Noogie) and after a pause, will continue booting as it does some setup.

You will wind up with ADB enabled over wifi by default and google apps installed.

You may also need to restart immediately -- I've found that sometimes after rooting, my s/n is all zeroes. Restarting clears that.

I also find that in order to get the Android marketplace working, I need to hunt down a copy of Vending.apk that is 2 meg (2,125,824 bytes on disk) in size and install it over the copy that touchnooter installs. I believe this one is the one that folks use for cm7?

The command to install it is:

#adb install -r Vending.apk

The -r is needed to avoid getting told the signature's bad. It's a reinstall flag.

So , once rooted, you have access to ADB and to fdisk for examining and changing disk layout.

The layout is interesting. Here's the issue: I know the order of the layout, but I screwed up my partition boundaries before I started, so the actual values here are from AFTER I finished:

(these values are from the fdisk display; they are not commands)

/dev/block/mmcblk0p1 c Win95 FAT 1-38
/dev/block/mmcblk0p2 c Win95 FAT 39-46
/dev/block/mmcblk0p3 83 Linux 47-141
/dev/block/mmcblk0p4 5 Extended 142-926
/dev/block/mmcblk0p5 83 Linux 142-285
/dev/block/mmcblk0p6 6 FAT16 406-807
/dev/block/mmcblk0p7 83 Linux 808-926
/dev/block/mmcblk0p8 83 Linux 286-405

It's partitions 5-8 that are interesting.

5 is /system, and I leave it untouched.

6 is /media - the area you can copy files to. 6 is -- on my device -- the SECOND to last PHYSICAL partition.

7 is /cache. It is the LAST physical partition.

8 is /data - and it is the 6th PHYSICAL partition.

The device restore scripts from BN don't care how big the partitions are, but they do care what ORDER they're in.

I will give my current partition table at the end - I want to avoid posting a (wrong) copy of what I thought I started with, because I screwed it up.

A stock ST writes your purchases to /data, not to /media.

It writes them to /data/media, in fact.

So, first question: what happens if you do an
#rm -r
inside /data/media, then
#cd ..
#rmdir media
then do
#ln -s media /media to so you wind up with

lrwxrwxrwx root root 2011-08-29 20:19 media -> /media

in your /data partition?

1) It works
2) restart, grab stuff from BN - and you see it from your desktop system. Your content is visible.

Win!

Ok, so the next thing is: bugger . I only have 240 M or so of room for stuff now? Eh?

shell back in and use fdisk to delete the partitions and rebuild them.

The order is key here. They are named as they're made, but you need them laid out out of physical order.

The following worked for me:

#fdisk /dev/block/mmcblk0

d6
d6
d6

Partitions 6, 7 and 8 are gone now.

Next, to create partitions of a useful size in the correct order

n
(creates p6)
406 807
n
(creates p7)
808
926
n
(creates p8)
286 405

write your changes from fdisk.

reboot.

But - now you've picked stuff and moved it around. It's a Really Good Idea to reformat the partitions before use.

The best way is probably to use the mkfs tools on the device.

Best way, schmest way. I booted to Noogie and used qtparted in linux so I had a gui to doublecheck my partition layout.

formatted these as ext3 for the Linux partitions at 7 and 8, and as fat16 for the win partition at 6.

It's entirely possible that you could format that as fat32, but it comes from the factory at fat16 so I stuck with that.

Power down, remove noogie, power up.

I got a "failed to install" followed by a reboot followed by being back in the OS.

I did not have to reroot to get my apps, but I did need to reroot to fix the marketplace - the /data partition being blown out meant that the Android market was crashing.

Now, to finish:

go back in via adb and reestablish the symlink (you just blew it out when you resized /data)

So:

shell in

#cd /data/media

#rm -r
(only inside /data/media, it WILL tear out any files it sees.) then
#cd ..
#rmdir media
then do
#ln -s media /media

And your stuff is put on the /media directory and can be managed properly.

I think this stuff may well be scriptable.

There's a great thread on the repartitioning that I found last night, making use of sfdisk rather than fdisk:

http://forum.xda-developers.com/show....php?t=1225196

As far as I know, swapping /data/media out to /media is new, but if it's not I apologize for being unaware of it.

So, here's the layout I finished with:

Disk /dev/block/mmcblk0: 1958 MB, 1958739968 bytes
128 heads, 32 sectors/track, 934 cylinders
Units = cylinders of 4096 * 512 = 2097152 bytes

Device Boot Start End Blocks Id System
/dev/block/mmcblk0p1 * 1 38 77808 c Win95 FAT32 (LB
A)
/dev/block/mmcblk0p2 39 46 16384 c Win95 FAT32 (LB
A)
/dev/block/mmcblk0p3 47 141 194560 83 Linux
/dev/block/mmcblk0p4 142 926 1607680 5 Extended
/dev/block/mmcblk0p5 142 285 294896 83 Linux
/dev/block/mmcblk0p6 406 807 823296 6 FAT16
/dev/block/mmcblk0p7 808 926 243696 83 Linux
/dev/block/mmcblk0p8 286 405 245728 83 Linux

Partition table entries are not in disk order
The Following 2 Users Say Thank You to roustabout For This Useful Post: [ Click to Expand ]
 
nickveldrin
Old
#2  
Member
Thanks Meter 1
Posts: 50
Join Date: Jun 2011
Can you please format your commands in such a way that they look correctly? Current formatting in the post with your commands seem strange and incorrect.
 
roustabout
Old
(Last edited by roustabout; 30th August 2011 at 08:39 PM.)
#3  
Senior Member - OP
Thanks Meter 141
Posts: 425
Join Date: Feb 2011
I think all are OK except the fdisk commands.

Unfortuantely, the fdisk commands are given inside of an ascii gui of sorts, to there's really no 'great' way to represent them, I don't think.

I've prepend the others with # so it's obvious they're shell commands.
 
jago25_98
Old
#4  
Senior Member
Thanks Meter 22
Posts: 321
Join Date: Jul 2007
How's about symlinking various things to a 2nd partition (ext4?) on the sdcard then?
RSS feed for NookTouch Dev forum: http://forum.xda-developers.com/exte...&forumids=1201
Bitmit is like ebay Refer to each phone by it's model name where possible - i.e. "i9000", not "Galaxy S"
 
n8nmad
Old
#5  
n8nmad's Avatar
Member
Thanks Meter 3
Posts: 30
Join Date: Jan 2011
Default gparted?

Has anybody tried gparted to resize the partitions? If it works it could be useful.
 
domi.nos
Old
#6  
Senior Member
Thanks Meter 26
Posts: 159
Join Date: Jan 2011
Location: Warszaw
Have any one tried doing it on windows and using which software? I'm thinking of mini tool's partition manager. But i'm not sure. Anyone?
 
LastSilmaril
Old
(Last edited by LastSilmaril; 6th December 2011 at 08:46 AM.)
#7  
Senior Member
Thanks Meter 36
Posts: 158
Join Date: Nov 2011
Location: Kings County, NY
Quote:
Originally Posted by roustabout View Post

#cd /data/media
#rm -r
(only inside /data/media, it WILL tear out any files it sees.) then
#cd ..
#rmdir media
then do
#ln -s media /media

And your stuff is put on the /media directory and can be managed properly.
Thanks a lot for this, but the second and last lines are wrong:
rm -r should be rm -r *
ln -s media /media should be ln -s /media media

Still, thanks for the idea!
I wonder if symlinking to the sdcard could fix the whole 'shelves don't work for sideloaded books on sdcards' problem.


XDA PORTAL POSTS

Voice Control Your Phone with Tasker and AutoVoice – XDA Developer TV

XDA Developer TV Producer Kevin set up his phone to respond to … more

Guide to Take Better Control of Your Volume Levels

Would you like to know one of the things that really annoys me on a daily basis? Tough, … more

Get the Android 4.2.2 Status Bar on Your Gingerbread-Based Samsung

There are still quite a few of folks who run Gingerbread on their … more

Responses From Ubuntu Pouring Into Ubuntu Touch Q&A Thread

Ubuntu has become the most successful *nix distribution for a number of reasons, … more