B&N repartition SD card Boot - Barnes & Noble Nook Tablet

This is straight from the mSD card that they have been using at every B&N. So you can just do it yourself at your convenience.
Gives you 8GB of external storage and the rest is for Barnes and Noble content.

Thanks. But how should we use it? Copy to SD and reboot? Use Win32DiskImager write the image to a SD?

Sent from a Galaxy far, far away

Does it install version 1.42?

otisw said:
Does it install version 1.42?
Click to expand...
Click to collapse
I had 1.4.0 before, and still had it after.
Sent from a Galaxy far, far away

Did root remain intact?

Anxiyz said:
Did root remain intact?
Click to expand...
Click to collapse
No, it completely erases everything.
Sent from a Galaxy far, far away

Damn, I could have used that last week before I took my NT in and had them do it for me. Oh well. Thanks for posting it though.

.CRS. said:
Here is how I got it to work.
IT ERASES EVERYTHING SO BACKUP BEFORE YOU DO THIS
1. Put flashing_boot.img on the root of your sd card
2. Turn off Nook
3. Hold the power button and the N button until the black N flashes on and off
4. Push the power button to turn the nook back on
5. It will show a factory reset menu, just push the N button to continue
View attachment 955245
Sent from a Galaxy far, far away
Click to expand...
Click to collapse
Just a note. You must have stock recovery for this to work not CMW or other.

Failed Several Times
I tried this several times but my media storage was still 1GB. Do I need to write the attached image or just copy it straight forward. When just copying, I can't pursue with the factory reset.

Same thing here, tried several times and still getting 1GB

Ditto. I was able to perform a factory reset, but I still have just 1GB of user storage after the update.
I suspect the problem may have something to do with the NOOK Tablet not recognizing the microSD card. I've noticed when using ClockworkMod that sometimes I have to remove it and re-insert it before it's recognized -- but there's no way to tell whether the stock recovery is seeing the card or not.
I tried removing/re-inserting it a few times during one of the three attempts to use this img, but that didn't seem to help.

That's the issue I had, not recognizing the card itself. I even copied the file unto a different card altogether and same thing. Still working on it, not ready to give up on it just yet.

No luck here and I'm sure it's not my cards. The couple cards I've tried all work with CWM. I've tried 2 different 1GB cards, a 256MB card, a 4GB card and an 8GB card.... I don't feel like clearing out my 32GB card. I've tried both FAT and FAT32. Does this need a different format, such as ext2? I've also tried using Win32DiskImager to actually "write" the image to the card... This I only tried on the 256MB.
jmeyerhead, any chance of getting a MD5 checksum? I have f94cd4df7351f81a2623f15e1853e205 .
CRS... Did you do anything that the rest of us haven't listed? Did you download from a different location?
EDIT: I'm also running the stock recovery. I run CWM off SD when I need it.

To use this you will need a 50MB FAT32 LBA Bootable partition with MLO, u-boot.bin from b&n update 1.4.2 and flashing_boot.img from the first post.
I extracted the kernel and ramdisk and they have a couple of shell scripts to do all the work.
However the scripts refer to a second ext3 partition on the sdcard which will allow you to reinstall the tablet from scratch as they do in the factory
I was able to pull the executables genpart make_ext4fs mkdosfs simg2img busybox etc and push them to my nook running with clockwork mod. Then inside a adb shell I was able to restore my tablet completely the only files I needed were the rombackup.zip from the original so that I retained my serial etc
Here is a approximate record of the steps I did inside the adb shell
Code:
#!/bin/sh
export emmc_total_sectors=31129600
export disk_total_sectors=31117905
export disk_media_sectors=25165823
./genptable ptable.new
# Enable performance mode
echo 4 > "/sys/devices/platform/mmci-omap-hs.1/mmc_host/mmc0/mmc0:0001/power_class"
./busybox dd if=/dev/zero of=/dev/block/mmcblk0 bs=4096 count=256 conv=notrunc,fsync
./busybox if=ptable of=/dev/block/mmcblk0
./busybox dd if=MLO of=/dev/block/mmcblk0p1
./busybox dd if=u-boot.bin of=/dev/block/mmcblk0p2
./busybox dd if=recovery.img of=/dev/block/mmcblk0p3
./busybox dd if=boot.img of=/dev/block/mmcblk0p4
./mkdosfs -F32 -n rom /dev/block/mmcblk0p5
./mkdosfs -F32 -n bootdata /dev/block/mmcblk0p6
./mkdosfs -F32 -n MyNook /dev/block/mmcblk0p10
./make_ext4fs -L factory /dev/block/mmcblk0p7
./make_ext4fs -L system /dev/block/mmcblk0p8
./make_ext4fs -L cache /dev/block/mmcblk0p9
./make_ext4fs -L userdata /dev/block/mmcblk0p11
./busybox mkdir -p /mnt/factory
./busybox mkdir -p /mnt/rom
./busybox mkdir -p /mnt/bootdata
./busybox mount -t ext4 /dev/block/mmcblk0p7 /mnt/factory
./busybox mount -t vfat /dev/block/mmcblk0p5 /mnt/rom
./busybox mount -t vfat /dev/block/mmcblk0p6 /mnt/bootdata
cd /mnt
/tmp/byhand/busybox unzip /tmp/byhand/rombackup.zip
cd /tmp/byhand
./busybox dd if=/dev/zero of=/mnt/bootdata/BCB bs=1088 count=1
./busybox dd if=/dev/zero of=/mnt/bootdata/BootCnt bs=4 count=1
./busybox umount /mnt/rom
./busybox umount /mnt/bootdata
./busybox cp factory.zip /mnt/factory/
./busybox cp rombackup.zip /mnt/factory/
cd /mnt/factory
/tmp/byhand/busybox unzip factory.zip romrestore.zip
cd /tmp/byhand
./busybox umount /mnt/factory
I did fiddle with the partition sizes a bit since I wanted 12.6GB so the exports at the beginning are different from what is in the flashing_boot.img
BIG FAT WARNING - I did this and it works form me don't try it unless you feel confident to recover from a clockworkmod booting off a sdcard

Well, mine is bricked. I can boot CWM SD though so I'm sure all is not lost. I'll have to experiment with it later. Just so everyone else knows I made formatted the disk as stated, copied the stated files. When I booted I immediately got a "software update" screen (I don't think I even held the n button down). Then once done it said to remove the card and restart.... never restarted (screen didn't light up, no 'n' screen, nada. I popped in my CWM SD and it did boot. Tried restoring a backup but that won't boot either. Should have stuck to the manual method or just gone in... I was hoping for something in the middle as far as complexity.
UPDATE: Ok, well I've gone in with Parted and let it correct the found errors (the expected ones reported in the manual formatting thread). Looking at the output from parted the repartitioning worked but something got screwed up. I've tried another restore after letting Parter do its thing but no joy. Is there anything else I should try while I'm in CWM and have ADB up? Any ideas?
Oh, and mine is a 16GB NT.... not 8GB and not Nook Color. I'm trying to download Adam's total wipe Ubuntu image but the host has exceeded its daily limit and the torrent is near dead.... So I'll just hurry up and wait while continuing to try different fixes via CWM.
EDIT: Read on. I did actually get my NT partitioned but ran into some issues with the file system I didn't expect. Thanks to meghd00t everything is now working perfectly... Read on.

if you have a copy of acclaim_update.zip for 1.4.0 or the b&n updates for 1.4.1.or 1.4.2 rename the file to acclaim_update.zip put it on the root of a FAT32 formated sd card and boot the nook by inserting the usb cable
if the steps from my previous post have worked all you need is a partition table MLO u-boot.bin boot.img recovery.img and rombackup.zip
when the tablet boots just like it looks for flashing_boot.img it also looks for the acclaim_update.zip if it is present and the MLO u-boot boot and recovery are OK it will completely reflash the OS to stock - However to retain serial number and B&N website access preserve the rombackup.zip from the factory partition

Did your thread get cut off?
Well, obviously I don't know how to set this up properly. I assume that it had actually booted off the internal system and not the SD I *thought* I set up. Is there a tutorial on building a SD properly for this or should I just go ahead and go with AdamOutler's Ubuntu card? Do I need to take a special precautions in either case to preserve the serial number?
Thanks for all the help!

Actually I had the exact same experience as you, so when the partition table was fixed I did not bother to create the contents of the 2nd ext3 partition, Instead I just copied the necessary files in adb and used dd to install MLO, u-boot, boot & recovery format all the Fat32 & ext4 partitions and copied factory.zip rombackup.zip to the factory partition and allowed the factory reset to happen.

from a quick look at the script the 2nd ext3 partition should atleast have these files
Code:
mkdir /images_to_flash
mount /dev/mmcblk1p2 /images_to_flash
if [ -f /images_to_flash/preflash.img ]; then
test -r /images_to_flash/noshutdown && cp /images_to_flash/noshutdown /
test -r /images_to_flash/version.ppm.gz && fbsplash -s /images_to_flash/version.ppm.gz
dd if=/images_to_flash/preflash.img of=/dev/mmcblk0 bs=4M conv=notrunc,fsync
simg2img /images_to_flash/factory.img /dev/mmcblk0p7
umount /images_to_flash
elif [ ! -f /images_to_flash/factory.img ]; then
if [ -f /images_to_flash/bootcnt ]; then
dd if=/images_to_flash/MLO of=/dev/mmcblk0p1
dd if=/images_to_flash/u-boot.bin of=/dev/mmcblk0p2
dd if=/images_to_flash/recovery.img of=/dev/mmcblk0p3
test -r /images_to_flash/boot.img && dd if=/images_to_flash/boot.img of=/dev/mmcblk0p4
if [ -f /images_to_flash/factory.zip ]; then
cp /images_to_flash/factory.zip /mnt/factory/factory.zip
dd if=/images_to_flash/MLO of=/dev/mmcblk0p1 bs=4096 conv=notrunc,fsync
dd if=/images_to_flash/u-boot.bin of=/dev/mmcblk0p2 bs=4096 conv=notrunc,fsync
dd if=/images_to_flash/recovery.img of=/dev/mmcblk0p3 bs=4096 conv=notrunc,fsync
dd if=/images_to_flash/boot.img of=/dev/mmcblk0p4 bs=4096 conv=notrunc,fsync
test -r /images_to_flash/factory.img && simg2img /images_to_flash/factory.img /dev/mmcblk0p7
if [ ! -f /images_to_flash/factory.img ]; then
test -r /images_to_flash/system.img && simg2img /images_to_flash/system.img /dev/mmcblk0p8
if [ -f "/images_to_flash/factory.img" ]; then
if [ -f /images_to_flash/factory.zip ]; then
cp /images_to_flash/factory.zip /mnt/factory/factory.zip
if [ -f "/images_to_flash/factory.img" ]; then
umount /images_to_flash
I guess these could be made by
1. preflash.img - ignore we dont want a factory install
2. bootcnt - dd if=/dev/zero of=bootcnt bs=4 count=1
3. MLO - unzip from factory.zip and rename
4. u-boot.bin - unzip from factory.zip
5. boot.img - unzip from factory.zip
6. recovery.img - unzip from factory.zip
7. factory.zip - rename the acclaim_update.zip for 1.4.0 or rename one of the b&n updates for 1.4.1 or 1.4.2
8. factory.img - this i think is a blank ext4 fs on a sparse disk, however if it does not exist the script will format the partition
9. system.img - not required
Why dont you go ahead and create a 2nd ext3 partition on the sdcard and create these files I am sure you will be able to unbrick and retain the rombackup and all the serials etc
just FYI I am attaching the shell script inside the flashing_boot.img that is doing all the work

Related

[Q] System.img Editing Dev Help

Hi all,
im working on making a ROM for the Asus Transformer and im struggling a bit. im totall new to Linux, using mint and just getting used to it.
Basically im just trying to take a stock ROM and add root but adding superuser.apk and SU binary but im running into problems.
Asus Roms are a bit unusual, packed into blob files, ive unpacked that no problem, the system image is called blob.APP but its just the same as system.img just the name as i understand it.
ok so what ive done:
Code:
mkdir system
sudo mount -t ext4 -o loop blob.APP system/
so this mounts the ext4 fs as a loop device and allows me to copy the contents out
Code:
sudo cp -ar system new_system
then ive copied superuser.apk to /app and SU binary to /dev with drop and drag.
then make the filesystem image
Code:
sudo ./make_ext4fs -l 512m -a system blob.APP new_system/system
then just pack it up and flash it, flashing works fine, no errors but when i go to reboot it warns that theres no OS so somethings not worked. ive tried everything i can find googeling!
i just started learning linux on weds so go easy on me
any advice or help would be really great. thanks!
mkdir system here you will mount the old system
mkdir system_new here you will mount the new system
we now create the actual image
dd if=/dev/zero of=system_new.img bs=4k count=60000
bs=4k is the block size
count=60000 the number of blocks of 4kb size
so is something like 60000*4= 240000 which is actually 240 Mb
so it depends to you how big you want the image.
now we format the system.img in ext4
mkfs.ext4 system_new.img
Proceed anyway? (y,n) y
now we override the filesystem check
tune2fs -c0 -i0 system_new.img
Now we mount the the 2 directories that we created in the first step
mount -o loop system_new.img system_new/
mount -o loop system_new.img system/
Now we copy the contet of the old image to the new one with all the perimissions
cp -v -r -p system/* system_new/
We sinc the files
sync
We unmount the partitions
umount system_new/
umount system/
And voila, the system.img in ext4 is created.
Tips: you will need superuser acces.
if you will copy new files besides the ones from the old system you will have to set by hand all the permissions.
If you are using ubuntu just type
sudo su
and you will be root and no more sudo at each command.
Thank u so much for your guide this is exactly what I'm looking for so massive thanks!
So to add root I.can drop and drag superuser.apk and the binary into the new image?
Also do I need to worry about the android mountpoint?
Sent from my HTC Sensation Z710e using xda premium
yes you can do that, as long as you set the permissions right. (you can google for them)
and from what i remeber you will have to set also the ownership of the su, and superusers files
you need to do tests first, and then try
the mountpoint should be ok as it is now.
globula_neagra said:
mkdir system here you will mount the old system
mkdir system_new here you will mount the new system
we now create the actual image
dd if=/dev/zero of=system_new.img bs=4k count=60000
bs=4k is the block size
count=60000 the number of blocks of 4kb size
so is something like 60000*4= 240000 which is actually 240 Mb
so it depends to you how big you want the image.
now we format the system.img in ext4
mkfs.ext4 system_new.img
Proceed anyway? (y,n) y
now we override the filesystem check
tune2fs -c0 -i0 system_new.img
Now we mount the the 2 directories that we created in the first step
mount -o loop system_new.img system_new/
mount -o loop system_new.img system/
Now we copy the contet of the old image to the new one with all the perimissions
cp -v -r -p system/* system_new/
We sinc the files
sync
We unmount the partitions
umount system_new/
umount system/
And voila, the system.img in ext4 is created.
Tips: you will need superuser acces.
if you will copy new files besides the ones from the old system you will have to set by hand all the permissions.
If you are using ubuntu just type
sudo su
and you will be root and no more sudo at each command.
Click to expand...
Click to collapse
U said, we have to set permissions by ourselves. So what are the permissions that needs to be set when I add a new folder with an APK in it?
Sudo chmod 777 filepath/filename.apk
Sudo chmod a-rwx filepatch/filename.apk.
This is what I remember from top of my head. Google it a bit if it does not work from the first try as I have not used this like in 5 years.
If you allready have root you can you a file manager and just copy the file/folder where you want and set the permissions via thw file manager or using terminal commanda or via adb.
From what remember you can t make a folder in the apk folder as you won t be able to run the apk.

symlink /data/data to /mnt/sdcard

Hi... I have a rooted Sony Xperia J. It has phone memory of 764 mb, Internal SD card of 2.01gb and an ext SD card of 32gb.
What I want to do is move my app data which I think is in /data/data to my internal SD card which I think is mounted at /mnt/sdcard? I am going to create a folder on my sdcard called data.
I need some advice though as to whether this is possible and safe to do?
is it as simple as doing;
mkdir /mnt/sdcard/data
cp -r /data/data /mnt/sdcard/data
ln -s /data/data /mnt/sdcard/data
Then rebooting ?
in fact, thinking this might be a better option? Please can someone confirm this wont brick my phone?
mkdir /mnt/sdcard/data
mkdir /mnt/sdcard/app
cp -r /data/data /mnt/sdcard/data
cp -r /data/app /mnt/sdcard/app
ln -s /data/data /mnt/sdcard/data
ln -s /data/app /mnt/sdcard/app
Then rebooting ?
Sorry, I am doing lots of reading on this, but still haven't seen if anyone has done exactly this before. Would like some confirmation. I think I got the linking the wrong way around, so I now think it should be like this;
mkdir /mnt/sdcard/data
mkdir /mnt/sdcard/app
cp -pr /data/data /mnt/sdcard
cp -pr /data/app /mnt/sdcard
rm -r /data/data
rm -r /data/app
ln -s /mnt/sdcard/data /data/data
ln -s /mnt/sdcard/app /data/app
Then rebooting ?
yeah, that doesnt workd... soft bricked
ninjaprawn said:
yeah, that doesnt workd... soft bricked
Click to expand...
Click to collapse
Just in case someone needs this.
This wont work as you guys described because you need to format your card to EXT2 or EXT4, android is linux and needs perms wich FAT32 dont have. Also you need to make init script to mount the sdcard at boot and not at startup.
magix01 said:
Just in case someone needs this.
This wont work as you guys described because you need to format your card to EXT2 or EXT4, android is linux and needs perms wich FAT32 dont have. Also you need to make init script to mount the sdcard at boot and not at startup.
Click to expand...
Click to collapse
But is there any app that makes it easy?
i've a tablet vega with honeice android.
my problem is /data dimension, too.
i'm using link2sd app but /data is full, evenly.
why?

[Q] Is /sdacard part of /data in 4.2.2? (Data recovery help)

My phone is a gs4, but this most likely pertains to any device running 4.2.2. On every other phone I have owned (with CWM recovery) when I did a factory reset, it left my (internal) SD card contents intact. I wasn't thinking and did a factory reset and deleted everything.
As you all know reformatting a hard drive doesn't actually wipe the drive. From the looks of things the internal sd card is part of /data. So I took data's block device and did the following from ADB shell
I'm not looking up the exact paths but I believe I determined the block device to use by looking at "busybox df -h"s output
Code:
dd if=/dev/*--PATH-TO-mmblk-WHICH-DATA-IS-ON/ of=/cache/img1.img bs=1M count=1024
tar cvzf /cache/img1.tar.gz /cache/img1.img
*Copy img*.tar.gz to network share on my comp with ES file explorer
rm -f /cache/img*
dd if=/dev/*--PATH-TO-mmblk-WHICH-DATA-IS-ON/ of=/cache/img2.img bs=1M count=1024 offset=1024
tar cvzf /cache/img2.tar.gz /cache/img1.img
*Copy img*.tar.gz to network share on my comp with ES file explorer
rm -f /cache/img*
dd if=/dev/*--PATH-TO-mmblk-WHICH-DATA-IS-ON/ of=/cache/img3.img bs=1M count=1024 offset=2048
tar cvzf /cache/img3.tar.gz /cache/img1.img
*Copy img*.tar.gz to network share on my comp with ES file explorer
rm -f /cache/img*
,
.
.
I did this with all 12 or so GB of /data/. I then opened these up in a hex editor and searched for known strings in my saved data (contents of messages from SMS backup & restore). I was unable to find my data. As far as texts are concerned I was able to find raw texts on my current device (not before I reset),
My question is, is the internal sd card on a different partiton than /data/?

[TUTORIAL] Nandroid backup/restore directly from your PC

This guide is intended for those who own 16G MI3W which, sadly, often doesn't have enough space to make nandroid backup. This tutorial will show you how you can make nandroid backup directly to your PC and restore it later. Entire procedure will not store any single byte to your phone's internal memory.
Great part of this tutorial (and the whole idea) is taken from scandiun's thread, so some credits go to him.
WAS IT NECESSARY?
As we know, this operation (backup and restore) can, sort of, be done using adb backup command. But this command leaves out sms messages, call logs and some other information. So, backup made with adb backup may not be full, and does not reflect phone's current state.
REQUIREMENTS
This tutorial requires you to have:
ClockworkMod custom recovery installed on your phone
BusyBox installed into /system/xbin directory (your device probably already has it there). But you can check it or install it using this application (requires root).
Linux machine or MS Windows. I recommend linux, but if you're using Windows, please install Cygwin with netcat (nc), pv and util-linux (you can select those binaries in Cygwin setup).
Adb installed into some PATH directory. For windows, adb executable could be put into Windows directory (eg. C:\Windows). For linux, you can use command shown here to install adb, which will automatically put adb into your PATH directory.
Let's get down to business!
Whole philosophy lies behind opening some port on your device, over which will /data, /system or /cache partition be transfered from MI3 to PC's hard drive. Data is also being compressed/decompressed on the fly, so backup size is reduced. You can also see transfer speeds and total amount of data transfered.
Process is tested and it works!
BACKUP
To initiate a backup, we first have to run ADB. Connect USB cable to your phone. Then boot your device into recovery and select system 1. After that, go into Storage and mounts and mount /data, /cache and /system.
Finally, open Cygwin/linux shell and type the following:
Code:
adb kill-server
sudo adb start-server
adb forward tcp:1234 tcp:1234
adb shell
Then open another Cygwin/linux shell and create and enter directory which will hold MI3 backup. I called my directory mibackup.
Code:
mkdir ~/mibackup
cd ~/mibackup
You can see that we are working here with two consoles. First console will always represent phone's memory, and second will always represent our PC.
We will backup total of three partitions: /data, /cache and /system. That is essentially everything you need.
/system holds android system, and /data partition holds internal storage, applications, dalvik-cache and every other data including SMS messages, etc. But be prepared, because backup of this data partition can take up to 12,5GB of PC's hard drive space. It is usually lower because of compression, but just so you know. /system partition can take up to around 600MB, and is also usually lower than that.
/data partition (without internal storage)
Whole backup procedure of /data partition relies on few simple commands. Type this command in your first console, where adb shell is run:
Code:
cd /system/xbin
./busybox tar -pcf - /data --exclude='data/media/0' | ./busybox nc -l -p 1234
And then type command below into another shell:
Code:
nc localhost 1234 | pv -i 0.5 | gzip -c > data.gz
This will start backup process. As you may have noticed, this will backup our /data partition, but without internal storage (internal SD card).
Internal storage backup
After backup is complete, we can also backup our phone's storage (a.k.a. internal SD card), using following commands.
Type these commands in first console:
Code:
cd /system/xbin
./busybox tar -pcf - /data/media/0 | ./busybox nc -l -p 1234
and this command into second console:
Code:
nc localhost 1234 | pv -i 0.5 | gzip -c > sdcard.gz
/cache partition
Cache partition does not hold any important data. But I've noticed that when I wiped it, my current theme reset! This partition can be backed up in a matter of seconds, so why wouldn't we give it a try?
Type these commands in first console:
Code:
cd /system/xbin
./busybox tar -pcf - /cache | ./busybox nc -l -p 1234
and this command into second console:
Code:
nc localhost 1234 | pv -i 0.5 | gzip -c > cache.gz
/system partition
Finally, we can backup our /system partition. But, because BusyBox is located in /system, and we do not want to use this partition while it's in backup/restore phase, we have to copy xbin directory (busybox) to internal SD card.
Type these commands in your first console:
Code:
cp -R /system/xbin /data/media/0
cd /data/media/0/xbin
./busybox tar -pcf - /system | ./busybox nc -l -p 1234
and this command into second console:
Code:
nc localhost 1234 | pv -i 0.5 | gzip -c > system.gz
After the process is done, type following commands in first console to clean up xbin directory from internal storage, and to close adb.
Code:
cd /
rm -rf /data/media/0/xbin
exit
adb kill-server
And you have just created backup of your phone, into chosen directory. Congratulations!
Backup is in this case made of four files: data.gz, sdcard.gz, cache.gz and system.gz.
RESTORE
Before each restore procedure, we should wipe partition we are going to restore. So be careful! It is also important to check if /data, /cache and /system are mounted after each wipe/format.
To prepare things for restoration, open console and type in:
Code:
adb kill-server
sudo adb usb
adb forward tcp:1234 tcp:1234
adb shell
Then open another terminal, and go into directory where backups are stored. When I showed you how to create backup, I used mibackup directory. So, let's go into that directory once again, so we can pull our backups from there.
Code:
cd ~/mibackup
/data partition (doesn't contain internal storage)
If you are going to restore /data and /sdcard, then go to mounts and storage, and choose the last option - format /data and /data/media.
If you are going to restore only phone's data (and not /sdcard), select wipe data/factory reset from CWM menu. Don't skip this step! After that, make sure that /system and /data partitions are mounted.
To restore data partition then, type this commands into first console:
Code:
cd /
/system/xbin/busybox nc -l -p 1234 | tar -px
and this command into second:
Code:
gunzip -ck data.gz | pv -i 0.5 | nc localhost 1234
Internal storage
Make sure that /system and /data are mounted.
If you just restored /data partition, you don't have to wipe/format anything. Otherwise, if you just want to restore your internal SD card, you can type following command into first console, to wipe it first:
Code:
cd /
rm -rf /data/media/0/*
Type these commands into first console to restore your internal SD card (if you've backed it up):
Code:
cd /
/system/xbin/busybox nc -l -p 1234 | tar -px
and this command into second one:
Code:
gunzip -ck sdcard.gz | pv -i 0.5 | nc localhost 1234
/cache partition
Make sure that /system and /cache are mounted, and then format /cache from CWM.
/cache partition will be restored just as fast as it was backed up.
Type these commands into first console:
Code:
cd /
/system/xbin/busybox nc -l -p 1234 | tar -px
and this command into second console:
Code:
gunzip -ck cache.gz | pv -i 0.5 | nc localhost 1234
/system partition
After process is finished, we can restore system partition in a similar fashion we did when we backed it up. Just make sure that /system and /data are mounted, and then format /system from CWM.
Type this commands into first console:
Code:
cp -R /system/xbin /data/media/0
cd /
/data/media/0/xbin/busybox nc -l -p 1234 | tar -px
And this command into second one:
Code:
gunzip -ck system.gz | pv -i 0.5 | nc localhost 1234
After that, we just have to do some housekeeping jobs:
Code:
cd /
rm -rf /data/media/0/xbin
exit
adb kill-server
And last, but not least, if you haven't restored /cache partition, you should format it from CWM recovery.
That's it!

[PIT] SGH-S959G: Merge /data and /storage/sdcard0 (/data/media mod)

HOW TO:
Merge "Internal Storage" (/storage/sdcard0) and "Data" (/data) partitions.
WHY:
1) Eliminate "not enough storage" limitation on installed apps. Install as many as you want.
2) Increase potential Internal Storage space (adding unused space from the /cache /preload /data and /emmc partitions together into one mega partition).
3) True full device encryption for /data and /storage/sdcard0 (if you desire).
OVERVIEW OF HOW IT WORKS:
1) Use Odin to flash a modified PIT file to repartition your device. /data is sized to 14+ GB, /cache, /preload, and /emmc are all downsized to 10MB each and are unused.
2) Use my script to modify your ROM to store your "Internal Storage" files on the /data/media/0 folder. This script will hijack your "su" and "sdcard" binaries to work properly.
3) Use my custom TWRP recovery for all of your recovery needs (supports encryption).
4) Encrypt your device if you like.
DIFFICULTY:
Medium
REQUIRED SKILLS:
1) Know how to use ADB
2) Know how to use Odin
3) Know how to fully backup your device and restore it after a factory reset.
SUPPORTED DEVICES:
SGH-S959G ONLY
"COULD BE" SUPPORTED DEVICES:
***DO NOT USE THIS METHOD FOR ANYTHING OTHER THAN SGH-S959G OR YOU WILL RISK HARD-BRICKING IT.
***IF YOU WANT TO TRY IT OUT THEN YOU MUST POST TO THIS FORUM FIRST AND WE WILL DISCUSS
***GETTING YOUR DEVICE SUPPORTED
***Possibly SGH-I777
***Possibly SGH-I9100
***Maybe Others
SUPPORTED ROMS:
CyanogenMOD 12+ (and probably derivative ROMs)
*Risk of soft brick if trying on another ROM (but no higher risk of hard brick).
RISKS: There is a very small risk of hard-brick when flashing a PIT file to your device. To minimize your risk:
1) Don't try to flash during a thunderstorm.
2) Don't try to flash to an unsupported device.
3) Don't try to flash if your USB cable / port / charging port is damaged/faulty. YOU MUST HAVE A RELIABLE USB PORT
4) Don't try to flash with your battery at 0%.
5) Don't try to flash with a computer that likes to crash a lot.
6) Don't unplug or restart your device or computer in the middle of a flash (it takes 10 seconds, be patient, geez).
STEPS TO INSTALL:
Step #1:
Make 2 backups of everything on your phone. All partitions, sdcard, micro-SD, etc...
MOVE THESE BACKUPS TO YOUR COMPUTER, THEY WILL BE ERASED FROM YOUR PHONE.
Make sure you know how to fully restore a completely wiped phone (without a preinstalled recovery) using the computer backups, starting only from the phone's BOOTLOADER/Download/Odin mode.
If you don't know how to do this, you must stop here.
PROCEEDING WITH THIS TUTORIAL WILL PERMANENTLY WIPE MOST PARTITIONS ON YOUR PHONE, THAT INCLUDES: /cache /modem /system /data /emmc /preload
Did you back up your /efs?
BACK UP YOUR /efs!!!
Step #2: Download all attached files.
Step #3: Verify that you have an uncorrupted version of both PIT files. To do this, use the md5 tool (attached) in the windows command line:
> md5 Original_SGH-S959G.pit
Output should read:
7237EC02379B497C6028236B5BBC0C91 Original_SGH-S959G.pit
> md5 MEGADATA_SGH-S959G.pit
Output should read:
9036368F41FAD9FAA266D08398EA2A33 MEGADATA_SGH-S959G.pit
If the MD5 sums don't match, STOP HERE.
DO NOT FLASH A .PIT FILE IF THE MD5 SUM IS WRONG.
Step #5: Install recovery ...
SGH-S959G_TWRP_v2.8.7.0_datamedia.zip
Step #6: Flash PIT
Did you do Step 3? Do it again, don't be lazy.
Open Odin (attached), click the PIT button. Select MEGADATA_SGH-S959G.pit
Re-Partition, Auto Reboot and F. Reset Time should be checked. The PIT filename should appear next to the PIT button.
NOTHING ELSE SHOULD BE CHECKED.
Boot your phone into bootloader/download mode and connect it. The first ID:COM field should turn yellow and have text that looks like 0:[COM5]. In the message field you will see something like <ID:0/005> Added!
Review the risks of what you're about to do above.
Hold your breath, press the start button.
Flashing takes about 10 seconds. Once it's done your phone will reboot. You can close Odin at this point.
Step #7: Format partitions.
Boot into recovery.
Format EMMC: adb shell make_ext4fs mmcblk0p11
Format PRELOAD: adb shell make_ext4fs mmcblk0p12
Wipe CACHE using recovery interface (from advanced wipe screen).
Format DATA using recovery interface (special button present on wipe screen) .
Wipe INTERNAL STORAGE using recovery interface (from advanced wipe screen).
Step #8: Restore partitions.
Reboot into recovery (you must do this again after you format, and the recovery must be datamedia version if you are installing, regular version if you are uninstalling - did you follow step #5?).
... restore your /modem /system /data and /emmc partitions. /cache and /preload should not be restored.
Step #9: Modify Android ...
(I tested on a fully booted android system, but probably works from recovery too.)
Run these commands (obviously correcting the "C:datamedia_installer" path).
*********************************
** If installing from recovery **
*********************************
** mount /data **
** mount /system **
*********************************
adb root
adb push "C:datamedia_installer" /data/local/datamedia_installer
adb shell chmod 700 /data/local/datamedia_installer
To Install: adb shell /data/local/datamedia_installer install
Note: If you ever flash a new ROM in the future it will likely disable this mod. You'll have to do the Step #9 command(s) again.
To Uninstall: adb shell /data/local/datamedia_installer uninstall
Reboot.
Step #10: Adjust /data/media permissions ...
adb root
adb shell chown -R media_rw /data/media/0
adb shell chgrp -R media_rw /data/media/0
adb shell find /data/media/0 -type d -exec chmod 775 {} +
adb shell find /data/media/0 -type f -exec chmod 664 {} +
adb shell chcon -R ubject_r:media_rw_data_file:s0 /data/media/0
Congratulations, if you made it this far you're golden.
STEPS TO UNINSTALL:
Step #1: Install recovery ...
SGH-S959G_TWRP_v2.8.7.0.zip
Step #2: MD5 Verify and then Flash PIT ... (see Step #6 above)
Original_SGH-S959G.pit
Step #3: Format Partitions ... (see Step #7 above)
Step #4: Restore partitions ... (see Step #8 above)
Make sure you are using regular version, not datamedia version.
**You can optionally skip the /emmc restore at this point, and instead finish Step #5 below, then restore to /storage/sdcard0 while Android is running (not in recovery). This should (theoretically) setup the right permissions so you can skip step #6 below.
Step #5: Modify Android ... (see Step #9 above)
Only difference is the first argument for datamedia_installer script (use "uninstall")
Step #6: Adjust /mnt/media_rw/sdcard0 permissions ...
Not sure exactly what the permissions need to be, never had to do this. Let me know if you are trying to do this and I can help you troubleshoot.
**See my note in uninstall Step #4 if you are having trouble here.
XDA:DevDB Information
[PIT] SGH-S959G: Merge /data and /storage/sdcard0 (/data/media mod), Tool/Utility for the AT&T Samsung Galaxy S II SGH-I777
Contributors
dimoochka, Lanchon (thanks for the idea!)
Version Information
Status: Stable
Created 2015-10-07
Last Updated 2015-10-07
great work!
for those wanting to peek at the script without downloading 17MB...
Code:
if [ $1 ] && [ $1 == "install" ]
then
if [ -e /system/bin/sdcard_bin ]
then
echo "Already installed."
else
mount -o remount,rw /system
cp /system/xbin/su /data/local/su_bin_backup
cp /system/bin/sdcard /data/local/sdcard_bin_backup
chmod 700 /data/local/su_bin_backup /data/local/sdcard_bin_backup
cp /system/bin/sh /system/bin/sdcard_sh
mv /system/bin/sdcard /system/bin/sdcard_bin
mv /system/xbin/su /system/xbin/su_bin
echo "#!/system/bin/sdcard_sh" > /system/bin/sdcard
echo "" >> /system/bin/sdcard
echo "while true; do" >> /system/bin/sdcard
echo " sleep 10000" >> /system/bin/sdcard
echo "done" >> /system/bin/sdcard
echo "if [ \$7 ] && [ \$7 == \"/storage/sdcard0\" ]" >> /system/bin/sdcard
echo "then" >> /system/bin/sdcard
echo "fi" >> /system/bin/sdcard
echo "#!/system/bin/sh" > /system/xbin/su
echo "" >> /system/xbin/su
echo "if [ \$1 ] && [ \$1 == \"--daemon\" ]" >> /system/xbin/su
echo "then" >> /system/xbin/su
echo " /system/xbin/sdcardd&" >> /system/xbin/su
echo "fi" >> /system/xbin/su
echo "/system/xbin/su_bin \"\[email protected]\"" >> /system/xbin/su
echo "#!/system/bin/sh" > /system/xbin/sdcardd
echo "" >> /system/xbin/sdcardd
echo "while [ \"\$mprop\" != running ]; do" >> /system/xbin/sdcardd
echo " sleep 1" >> /system/xbin/sdcardd
echo " mprop=\`getprop init.svc.fuse_sdcard0\`" >> /system/xbin/sdcardd
echo "done" >> /system/xbin/sdcardd
echo " setenforce 0" >> /system/xbin/sdcardd
echo " runcon u:r:init:s0 /system/bin/sh -c \"
setenforce 1;
/system/bin/sdcard_bin -u 1023 -g 1023 -d /data/media/0 /storage/sdcard0&
/system/bin/sdcard_bin -u 1023 -g 1023 -d /mnt/media_rw/sdcard1 /storage/sdcard1&
/system/bin/sdcard_bin -u 1023 -g 1023 -d /mnt/media_rw/usbdisk0 /storage/usbdisk0&
\"&
" >> /system/xbin/sdcardd
chmod 755 /system/xbin/su /system/xbin/sdcardd
chmod -R 755 /system/bin/sdcard /system/bin/sdcard_sh
chown -R root /system/bin/sdcard /system/bin/sdcard_sh
chgrp -R shell /system/bin/sdcard /system/bin/sdcard_sh
chcon u:object_r:su_exec:s0 /system/xbin/su
chcon u:object_r:su_exec:s0 /system/xbin/sdcardd
chcon u:object_r:sdcardd_exec:s0 /system/bin/sdcard
chcon u:object_r:sdcardd_exec:s0 /system/bin/sdcard_sh
mount -o remount,ro /system
echo "Successfully installed (you can ignore any device busy errors and should not see any other errors)."
fi
fi
if [ $1 ] && [ $1 == "uninstall" ]
then
if [ -e /system/bin/sdcard_bin ]
then
mount -o remount,rw /system
mv -f /system/bin/sdcard_bin /system/bin/sdcard
mv -f /system/xbin/su_bin /system/xbin/su
rm /system/bin/sdcard_sh
rm /system/xbin/sdcardd
mount -o remount,ro /system
echo "Successfully installed (you can ignore any device busy errors and should not see any other errors)."
else
echo "Not installed."
fi
fi
This looks interesting to me, I have the 4 GB pit mod on my S959G and I have been wondering if one could take the internal SD card space and put it to /data. You made my day with this but has anyone had luck in doing this mod and using xposed modules to make the external SD card the card apps, music, pictures, downloads, and etc folders as a fake internal SD card or is that what modding the android system does so that ROMs see the external SD card as the only expandable memory directory?
Sent from my CM 10 Toshiba Thrive using XDA Free mobile app
cidlover said:
This looks interesting to me, I have the 4 GB pit mod on my S959G and I have been wondering if one could take the internal SD card space and put it to /data. You made my day with this but has anyone had luck in doing this mod and using xposed modules to make the external SD card the card apps, music, pictures, downloads, and etc folders as a fake internal SD card or is that what modding the android system does so that ROMs see the external SD card as the only expandable memory directory?
Sent from my CM 10 Toshiba Thrive using XDA Free mobile app
Click to expand...
Click to collapse
In a nutshell, this is what my mod does:
/data points to mmcblk0p10 (I think off the top of my head)
/storage/sdcard0 points to /mnt/media_rw/sdcard0 which points to mmcblk0p11 (I think off the top of my head)
By installing my PIT, you severely shrink mmcblk0p11 and expand mmcblk0p10 to monster size.
My script then changes the location that /storage/sdcard0 points to (to /data/media/0 which is located on mmcblk0p10).
Android puts everything (pictures, downloads, etc.) by default onto /storage/sdcard0 -> so these files get redirected to the partition which has all the space (/data/media/0 or mmcblk0p10).
So, to answer your question, an Xposed mod to redirect all of that stuff to /storage/sdcard1 (external SD) instead may or may not work depending on the method it uses. If it tells the system that the default directory to use is /storage/sdcard1 via some environment variable or method then there should be no interaction (which is probably the way that the mod works; that's the simplest method). If it does some unmounting/mounting of directories then that may interfere with my script depending on the timing with which the Xposed mod activates.
If you decide to try to get Xposed to do this and it doesn't work - let me know what mod you're using. I can fix my script to accommodate it.
Alternatively, you don't even need Xposed. Instead you can just edit the script at this point (in notepad):
/system/bin/sdcard_bin -u 1023 -g 1023 -d /data/media/0 /storage/sdcard0&
/system/bin/sdcard_bin -u 1023 -g 1023 -d /mnt/media_rw/sdcard1 /storage/sdcard1&
First line: change /storage/sdcard0 to /storage/sdcard1
Second line: change storage/sdcard1 to /storage/sdcard0
*don't add/remove any whitespace or new lines (or really change anything other than the 0 and 1) or you may break the script
This will swap the folders so that /storage/sdcard0 points to external SD and /storage/sdcard1 points to /data/media/0.
Why do you want to do this anyway? 14+ gigs of /data not enough for your carefully curated porn collection?
dimoochka said:
In a nutshell, this is what my mod does:
/data points to mmcblk0p10 (I think off the top of my head)
/storage/sdcard0 points to /mnt/media_rw/sdcard0 which points to mmcblk0p11 (I think off the top of my head)
By installing my PIT, you severely shrink mmcblk0p11 and expand mmcblk0p10 to monster size.
My script then changes the location that /storage/sdcard0 points to (to /data/media/0 which is located on mmcblk0p10).
Android puts everything (pictures, downloads, etc.) by default onto /storage/sdcard0 -> so these files get redirected to the partition which has all the space (/data/media/0 or mmcblk0p10).
So, to answer your question, an Xposed mod to redirect all of that stuff to /storage/sdcard1 (external SD) instead may or may not work depending on the method it uses. If it tells the system that the default directory to use is /storage/sdcard1 via some environment variable or method then there should be no interaction (which is probably the way that the mod works; that's the simplest method). If it does some unmounting/mounting of directories then that may interfere with my script depending on the timing with which the Xposed mod activates.
If you decide to try to get Xposed to do this and it doesn't work - let me know what mod you're using. I can fix my script to accommodate it.
Alternatively, you don't even need Xposed. Instead you can just edit the script at this point (in notepad):
/system/bin/sdcard_bin -u 1023 -g 1023 -d /data/media/0 /storage/sdcard0&
/system/bin/sdcard_bin -u 1023 -g 1023 -d /mnt/media_rw/sdcard1 /storage/sdcard1&
First line: change /storage/sdcard0 to /storage/sdcard1
Second line: change storage/sdcard1 to /storage/sdcard0
*don't add/remove any whitespace or new lines (or really change anything other than the 0 and 1) or you may break the script
This will swap the folders so that /storage/sdcard0 points to external SD and /storage/sdcard1 points to /data/media/0.
Why do you want to do this anyway? 14+ gigs of /data not enough for your carefully curated porn collection?
Click to expand...
Click to collapse
Lol, no, I wanted to see if we turn, in theory, our Galaxy S2 phones into a phone with no Internal Memory and the only expandable memory is a external sd card to expand it, i just was thinking a few xposed modules can help after doing this mod.
cidlover said:
Lol, no, I wanted to see if we turn, in theory, our Galaxy S2 phones into a phone with no Internal Memory and the only expandable memory is a external sd card to expand it, i just was thinking a few xposed modules can help after doing this mod.
Click to expand...
Click to collapse
Just to clarify, the behavior of the device after this mod is identical. If installed properly, this mod does not create any new problems that need fixing. It still behaves exactly the same as if an internal storage partition exists.
dimoochka said:
Just to clarify, the behavior of the device after this mod is identical. If installed properly, this mod does not create any new problems that need fixing. It still behaves exactly the same as if an internal storage partition exists.
Click to expand...
Click to collapse
Sorry to bring this up again, but how is sd card data handled? Like .obb files in the Android folder on the internal SD card after this mod. And has anyone tried this mod yet?
cidlover said:
Sorry to bring this up again, but how is sd card data handled? Like .obb files in the Android folder on the internal SD card after this mod. And has anyone tried this mod yet?
Click to expand...
Click to collapse
Real simple. Instead of files being placed into /storage/sdcard0 they are redirected to /data/media/0. At the end of the day that is the primary difference.
The /data/media/obb folder remains empty (I have no idea what this is used for normally).
I've been using this mod for 2 months, it's worked great. I think me and you are probably the only two people interested in doing it :laugh:
dimoochka said:
The /data/media/obb folder remains empty (I have no idea what this is used for normally).
Click to expand...
Click to collapse
http://blog.notfaqs.com/2013/05/android-obb-files-location.html
http://developer.android.com/google/play/expansion-files.html
/system 1gb
I would like to get some help modifying the /system partition to be 1 gb is there any help i can get?

Categories

Resources