[HOW TO] linux native in sbk2 devices, purelinux and pseudo-dualboot methods - Eee Pad Transformer Q&A, Help & Troubleshooting

This is a guide for installing and running natively any linux distribution on tf101 devices with sbk2 bootloader, but with some tweeks it would work also in tfp devices.
What is needed? you will need a rooted device with cwm recovery installed microsd for purelinux and a good microsd is recommended for one of the pseudo-dualboot options.
This guide is also prepared to execute all the commands in a computer running linux and with adb prepared to work, but you can also do it in windows, just google a bit for abootimg, blobpack and adb.
The binarys provided are precompiled for x86 system.
I am going to use as example ubuntu but you can install any linux distibution making some tweaks that i am not going to explain in this thread because i already opened another one explaining this.
DISCLAIMER: This is as safe as flashing custom roms (even a little bit less) you will always have a risk to brick your devices, I have a sbk1 device and in all my tests i haven't brick my device but i have the option of use nvflash so use it at your own risk
There are two basic options, running purelinux and pseudo-dualboot, and this last one has different variants.
Purelinux
YES: you will have the option to go to stock with cwm recovery
This will install ubuntu in the internal ssd in the data partition wich in tf101 is /dev/block/mmcblk0p7
With this method you will lose all the data in your android rom so make backups if necesary.
First of all we have to prepare the boot.img with the kernel and initrd, for that we will need abootimg, and a kernel already compiled, you either can compile your own kernel following lilsteive's, wiki instructions or use the one in OLIFE script. The initrd needed it's a bit diferent from OLIFE's one so i will attach the files needed at the end of this post.
We have kernel image: 2636-zImage
We have initd: initrd.img
and we need a boot.cfg file with this inside:
Code:
bootsize = 0x800000
pagesize = 0x800
kerneladdr = 0x10008000
ramdiskaddr = 0x11000000
secondaddr = 0x10f00000
tagsaddr = 0x10000100
name =
cmdline = [email protected] [email protected] vmalloc=128M gpt video=tegrafb console=tty0 usbcore.oldscheme_first=1 [email protected] root=/dev/mmcblk0p7 ro quiet splash
Now we can build boot.img with abootimg with this command.
Code:
./abootimg-i686 --create boot.img -f boot.cfg -k 2636-zImage -r initrd.img
Now we have created boot.img wich is ready to blobpack. It's VERY important to blobpack it to LNX partition to not overwrite cwm recovery.
Code:
./blobpack kernelblob LNX boot.img
Now we have kernelblob file and ubuntu.img. This is al we need to flash our device, but we can use a zip file suitable for cwm to flash the kernelblob. I will explain later in the pseudo-dualboot options.
So now we place those files in a microsdcard and we reboot into cwm.
Once in there we have to get a shell trough adb
In some version of cwm you cannot see microsd but you see the sdcard, in that case you will have to manually mount the microsd.
I don't remember right now if in cwm shell you are already root or not, but if not just su to gain permissions.
Now this is the most risky part we have to dd the kernel blob to the correct partition, in this case is /dev/block/mmcblk0p4. As i said before we can flash the kernel blob also through a zip file.
assuming we are in the folder where both files are:
Code:
dd if=kernelblob of=/dev/block/mmcblk0p4
and now we flash ubuntu.img over data partition, but we have to be sure is unmounted, depending wich version of cwm recovery you may need to do it manually
the command mount will show you if is mounted or not and if it is, umount it
Code:
umount /dev/block/mmcblkop7
and then dd
Code:
dd if=ubuntu.img of=/dev/block/mmcblk0p7
This will take some time, so be patient.
And that's it, just reboot and go through oem instalation procedure and you have it.
To go back to android you will only need to boot into cwm wipe everything to avoid problems reboot again into cwm and flash any rom wanted.
With the last cwm version i had some trouble accesing to sdcard or microsd so i needed to delete a symbolik link (/sdcard was a symbolik link to /media/data and i don't know why) and create /sdcard folder, mount /dev/block/mmcblk0p7 over sdcard create a microsd folder and mount microsd manually over that folder.
Pseudo-dualboot
We have two options here, we can install over a microsdcard or put the image file in the internal sdcard.
If you have a good 10 class microsd for me that's the best option if not, it will be much slower than the other option.
Pseudo-dualboot over microsd
The process here is almost the same than in pure linux, the diference is only that in the boot.cfg file rootfs parameter will be diferent partition:
Code:
bootsize = 0x800000
pagesize = 0x800
kerneladdr = 0x10008000
ramdiskaddr = 0x11000000
secondaddr = 0x10f00000
tagsaddr = 0x10000100
name =
cmdline = [email protected] [email protected] vmalloc=128M gpt video=tegrafb console=tty0 usbcore.oldscheme_first=1 [email protected] root=/dev/mmcblk1p1 ro quiet splash
instead of /dev/mmcblk0p7 (wich is data partition of the internal sdcard) it will be /dev/mmcblk1p1 wich is the microsdcard)
and instead of dd-ing ubuntu.img over internal sdcard we will dd to the microsd, we can do this also in cwm recovery or in a computer with sdcard reader.
As i think it's less risky to dd things in your computer instead in cwm and you will need an ubuntu.zip and android.zip to change your operating system flashing the kernel trough cwm i've attached Ubuntu.zip to do that. It's already prepared for microsd instalation.
If you compile the latest kernel (wich have some patches like the sound working) or you want to use it to purelinux instalation just do all the abootimg and blobpack proces and open ubuntu.zip and delete kernelblob and add your own one.
You will also need an android.zip file with the android kernel you prefer to choose again android system to boot.
I think it is aslo posible to do this with a pendrive is you have a dock, but i haven't tested it and i don't know if the kernel reads the usb devices soon enough to mount rootfs.
If you want to try, just boot linux, see wich device in /dev/ is asigned to the usb and place the correct device in root=/dev/XXXX in the boot.cfg
Pseudo-dualboot with loopmounted image placed in the internalsd
Just place ubuntu.img in the internal sdcard and flash ubuntu-mountloop.zip to boot into ubuntu and flash android.zip to boot into android.
There still are a couple of fixes to do, but i have no time right now and i am not using this configuration because i have sbk1 device so i won't be able to test and develop this but i will be glad to answer the questions i am able to.
I've also added the latest kernel and modules compiled from git but i haven't test them.
abootimg, blobpack and blobunpack files:
http://dl.dropbox.com/u/60048492/transformer/blobutils-abootimg.zip
ubuntu asus kernel (the OLIFE one, the git kernel has some fixes as sound enabling), initrd and boot.cfg
http://dl.dropbox.com/u/60048492/transformer/kernel-initrd-boot.cfg.zip
Unbutu-sdcard.zip (with kernelblob prepared for microsd installation)
http://dl.dropbox.com/u/60048492/transformer/Ubuntu-sdcard.zip
Android.zip (with revolver 3.1 default kernel)
http://dl.dropbox.com/u/60048492/transformer/Android.zip
Ubuntu-mountloop.zip for pseudo-dual boot with ubuntu.img placed in the internal sdcard
http://dl.dropbox.com/u/60048492/transformer/Ubuntu-mountloop.zip
Latest git kernel and modules precompiled
http://dl.dropbox.com/u/60048492/transformer/kernel-and-modules-from-git.zip
Thanks to rdnetto, Jhinta and of course lilstevie

Awesome! Waiting for the dualboot

How To - Step by step​
A few notes:
pseudo-dualboot over external microsd >> deletes all data on your external microsd card, but doesn't delete files on internal storage
pseudo-dualboot with loopmounted image placed in the internal storage >> doesn't delete files on internel storage (internal microsd)
how to resize img file (this you don't do in Ubuntu in TF):
Code:
dd if=/dev/zero bs=1G count=1 >> ubuntu.img
e2fsck -f ubuntu.img
resize2fs ubuntu.img
bs=1G >> how much large, new size is 3GB
mount data from Android in Ubuntu:
Code:
mkdir ~/Android/; mount /dev/block/mmcblk0p7 ~/Android/
after you find data in your home directory in folder Android
I recommend use the last CWM > http://forum.xda-developers.com/showthread.php?t=1213723 you need option flash package from internal storage
For work all components follow here: http://forum.xda-developers.com/showpost.php?p=25549030&postcount=1973 and http://forum.xda-developers.com/showpost.php?p=26149064&postcount=2048
You don't must nothing compile only apply change!
Dualboot with loopmounted image placed in the internal storage (I recommend, it is faster and smoother than sdcard version)
1. download http://lilstevie.geek.nz/ports/ubuntu.img.gz and extract ubuntu.img from .gz package to internal storage on /sdcard/
(second mirror > http://www.ulozto.net/xyFaPBA/ubuntu-img-gz)
2. download http://www.mediafire.com/?7f5fpatmgmg01ha and place to internal storage on /sdcard/
3. download from http://www.mediafire.com/?labcx60jowrdx one package for back to Android(by the ROM you use) and place to internal storage on /sdcard/ *
4. reboot into CWM recovery and flash the package Ubuntu.zip from 2. point
5. reboot and you booting to Ubuntu
6. you must add to /lib/modules/ this > http://www.2shared.com/file/843Sq6-J/3110tar.html
Code:
mkdir 3.1.10; tar -xzf 3.1.10.tar.gz -C 3.1.10; sudo cp -r 3.1.10 /lib/modules/
7. reboot and enjoy
When you want back to Android so reboot into recovery and flash your package from 3. point.
Dualboot over external mirco sd:
- your microsd card must have capacity more than 2GB (4GB is optimal)
1. download http://lilstevie.geek.nz/ports/ubuntu.img.gz and extract ubuntu.img from .gz package to internal storage on /sdcard/
2. open terminal emulator or run adb shell from your PC and enter the command:
Code:
dd if=/sdcard/ubuntu.img of=/dev/block/mmcblk1p1
(mmcblk1p1 is external microsd card)
- wait a few minutes
- after succesful finished you can delete ubuntu.img
- you don't see files in microsd card, but this is normal
3. download http://dl.dropbox.com/u/60048492/transformer/Ubuntu-sdcard.zip and place to internal storage on /sdcard/
4. download from http://www.mediafire.com/?labcx60jowrdx one package for back to Android(by the ROM you use) and place to internal storage on /sdcard/ *
5. reboot into CWM recovery and flash the package Ubuntu-sdcard.zip from 3. point
6. reboot and you booting to Ubuntu
7. you must add to /lib/modules/ this > http://www.2shared.com/file/843Sq6-J/3110tar.html
Code:
mkdir 3.1.10; tar -xzf 3.1.10.tar.gz -C 3.1.10; sudo cp -r 3.1.10 /lib/modules/
8. reboot and enjoy
When you want back to Android so reboot into recovery and flash your package from 4. point.
* when you can't find the package for your ROM or latest version so extract blob file from your ROM package .zip, rename to kernelblob and replace in Android-xxx.zip package
Original post:
Very thanks!
A few questions:
it deletes all data in my TF
ubuntu.img is from http://forum.xda-developers.com/showpost.php?p=16101612&postcount=3 (RootFS)
./abootimg-i686 --create boot.img -f boot.cfg -k 2636-zImage -r initrd-2.6.36.img << here should be initrd.img

jozka.1 said:
Very thanks!
A few questions:
ubuntu.img is from http://forum.xda-developers.com/showpost.php?p=16101612&postcount=3 (RootFS)
./abootimg-i686 --create boot.img -f boot.cfg -k 2636-zImage -r initrd-2.6.36.img << here should be initrd.img
Click to expand...
Click to collapse
Thanks, already corrected, and yes, that's an option, but the last version of ubuntu.img i think it's 2.0 GB and that one is 535MB or something like that, for all my tests i've used the 2GB one i think is inside OLIFE prime. But you can also build your own one with another distro. The question is wich type of instalation are you going to use, because in the native (internal or external) the image will be automatically resizes to fit the partition in the first boot so it doesn't matter, but in the loopmount one will keep the same size. So either of them would be a bad option.
I will explain this later and wich options we have to increase the space.
EDIT:
http://forum.xda-developers.com/showthread.php?t=1476835
i have to rewrite that to correct grammar but it will help you understanding a couple of things

And I can't this process without microsdcard (I can't have the ubuntu.img in internal memory), because dd if=ubuntu.img of=/dev/block/mmcblk0p7 deletes all files on /data/media. Is it right?

jozka.1 said:
And I can't this process without microsdcard (I can't have the ubuntu.img in internal memory), because dd if=ubuntu.img of=/dev/block/mmcblk0p7 deletes all files on /data/media. Is it right?
Click to expand...
Click to collapse
Yes, installing in the internal sdcard will erase all your data, and with the microsd even if you have a good one it will be a bit laggy sometimes.
The loopmount option it's another option, but i haven't try it yet and i will not write a guide for that until i do it, but basically is the same, we put the img file in the internal sd we modify the boot.cfg to mountloop and we'll need to tweak up the initrd to mount over loop device the image.
I don't know if that precompiled kernel support that, i think it does, but i am not sure if it's necesary recompile it.
In the other way, we would also need to resize the image to have a system with more than 2gb and that also would require editing the fstab.
I think i remember from time ago working with qemu there was two types of images qcow and raw. One of them had a good feature, you could create a 10gb image but it only weigth the space ocupied inside the image and not the all 10gb, but i don't know if we could use that feature in the mountloop option.

Do we have to compile again kernel with a new modules? Or how to mounts virtual disk?

jozka.1 said:
Do we have to compile again kernel with a new modules? Or how to mounts virtual disk?
Click to expand...
Click to collapse
I don't know yet, i don't think so but i have not compile the kernel myshelf. I have to take a look to init file in the initrd and figure where to put mount comands for the rootfs, i can't give you more information right now because i've never done that before, but here is "again" how the process i think it would be:
in boot.cfg root=/dev/loop0
and inside the initrd there is a file call init where whe have to mount /dev/mmcblk0p7 over somewhere, for example /media/data and then loopmount with losetup /media/data/ubuntu.img
That's what i think, but i am not sure

Just a point which is still not really clear for me, following those instructions, it will erase EVERYTHING on my ssd ? Or it's just a wipe like when we flash a new rom ?

outpox said:
Just a point which is still not really clear for me, following those instructions, it will erase EVERYTHING on my ssd ? Or it's just a wipe like when we flash a new rom ?
Click to expand...
Click to collapse
This process (the first one, purelinux option) will erase /data partition not the entire sdcard
it doesn't either erase android system wich is another partition. So (and this is a guess, when i test it i didn't have just a kernel blob to flash so i flashed the entire revolver rom) if you reboot into cwm recovery wipe data and install android.zip (wich i'll upload a bit later) . you would be able to boot into android like if it was a clean instalation.
So, yes, is like a full wipe. But only in the first option, the other two options don't touch your data.
But all this is yet to be confirmed, i am quite new in android systems i ony have experience in linux systems. I am pretty sure it is like a say but i would not bet my life on it

shaola said:
This process (the first one, purelinux option) will erase /data partition not the entire sdcard
it doesn't either erase android system wich is another partition. So (and this is a guess, when i test it i didn't have just a kernel blob to flash so i flashed the entire revolver rom) if you reboot into cwm recovery wipe data and install android.zip (wich i'll upload a bit later) . you would be able to boot into android like if it was a clean instalation.
So, yes, is like a full wipe. But only in the first option, the other two options don't touch your data.
But all this is yet to be confirmed, i am quite new in android systems i ony have experience in linux systems. I am pretty sure it is like a say but i would not bet my life on it
Click to expand...
Click to collapse
Okey that's nice
When I come home I will make a back up and I will try it !
I'll let you know if I experience any issues

I have the problem.
When I make dd if=ubuntu.img of=/dev/block/mmcblk0p7 so I get IO problem and now when I choose in CWM install zip from sdcard, so I get E: can't mount sdcard
E: mount: mounting /dev/block/mmcblk0p7 on /sdcard/ failed: Invalid argument
E2: solved, I made small .img file (2MB) and dd if=smal.img of=/dev/block/mmcblk0p7
E3: no, data is mount successful, but the size is small, any ideas how to resize back to default ?

I don't understand what exactly are you saying, anyway, the partition will not by resized in anyway, not when you dd not ever, is the filesystem what is resized. So wipe data trough cwm

Code:
/sdcard # cat /proc/partitions
major minor #blocks name
179 0 30203904 mmcblk0
179 1 524288 mmcblk0p1
179 2 542208 mmcblk0p2
179 3 2048 mmcblk0p3
179 4 542208 mmcblk0p4
179 5 5120 mmcblk0p5
179 6 512 mmcblk0p6
179 7 28563968 mmcblk0p7
179 8 1931264 mmcblk1
179 9 1930240 mmcblk1p1
but:
Code:
~ # df
Filesystem 1K-blocks Used Available Use% Mounted on
tmpfs 369644 32 369612 0% /dev
/dev/block/mmcblk0p2 533664 9072 524592 2% /cache
/dev/block/mmcblk0p7 39663 4587 33028 12% /data
I made dd if=smal.img of=/dev/block/mmcblk0p7, because it doesn't mount, but smail.img is 40MB.
Wipe data doesn't help to me.

ups, your data partition was mounted, it has to be unmounted before dd, that's the problem. Sorry i forget to put that in the guide. i will correct it now
just umount /data and try to dd again the ubuntu.img
Corrected. Sorry, i assumed that everyone should now that a partition has to be unmounted before attemp to dd. My fault

jozka.1 said:
[
I made dd if=smal.img of=/dev/block/mmcblk0p7, because it doesn't mount, but smail.img is 40MB.
Wipe data doesn't help to me.
Click to expand...
Click to collapse
It is mounted as you see in df command

No, I made mount.

jozka.1 said:
No, I made mount.
Click to expand...
Click to collapse
I am a bit lost, so
Did you check the md5sum of ubuntu.img before attemping this?
are you using a microsd card?
after wipe data did you reboot into cwm again?
wich version of cwm do you have?

I'm sorry, my fail.
I used dd with my smal image(40MB) for repair mount /data, then /data was so small. I used dd with ubuntu.img, kernelblob > reboot and all is it right.
I have one more question. When I want return to android, so I make factory reset (wipe data, cache) and flash a ROM ?

jozka.1 said:
I'm sorry, my fail.
I used dd with my smal image(40MB) for repair mount /data, then /data was so small. I used dd with ubuntu.img, kernelblob > reboot and all is it right.
Click to expand...
Click to collapse
So, you finally have running ubuntu natively with sbk2 device?

Related

How to swap SD cards w/ Apps2SD

All props go to Jonnythan who gave the steps in another post. Mods may want to sticky this....
1. As always: Nandroid backup
2. reboot phone
3. adb shell into the phone
4. mkdir /sdcard/backup/
mkdir /sdcard/backup/app
mkdir /sdcard/backup/app-private
cp -r /data/app/* /sdcard/backup/app/
cp -r /data/app-private/* /sdcard/backup/app-private/
5. copy sd card to pc
6. Shut off phone and remove old sdcard and insert new sdcard
7. Start in recovery mode and partition new sdcard (fat32, ext2, swap)
8. Enable usb mode, copy data from old sdcard to newly partitioned sdcard
9. reboot and ignore force closings
10. Plug in USB and enable USB mode
From PC ADB shell into phone and type the following (enter after each line):
rm -r /data/app/*
rm -r /data/app-private/*
[chances are those directories are empty already, but you never know]
cp -r /sdcard/backup/app/* /data/app/
cp -r /sdcard/backup/app-private/* /data/app-private
reboot recovery
11. Restore most recent nandroid
12. reboot and enjoy
All thanks again to Jonnythan
Tweaks:
Between 5 and 6, shut off phone. Then start step 7 by specifying to start into recovery mode to partition the card. Then specify that you need to plug in the usb and adb shell for step 10. End step 10 by typing in "reboot recovery" which will reboot you right into the recovery partition.
Thanks for writing it up! Now I don't have to
Ok, I must be doing something wrong here... Does this require a custom ROM or anything? Im on the sprint Hero, stock ROM and I do have root. Everytime I get to step 4, at the cp -r /data/app/* /sdcard/backup/app/ command i get an error. It cant find the directory. Also, if i check the folder properties through Astro or linda file manager, it says 0 files, 0 folders, and also shows that it is not taking up any space. Just as a test to see if I was somehow blocked, I made a nandroid backup and deleted the /data folder, and upon reboot nothing had changed. Still have all of my apps on the phone...
I think the stock ROM doesn't include the cp command.
jonnythan said:
I think the stock ROM doesn't include the cp command.
Click to expand...
Click to collapse
Wait, when i get my sd card I have to do all this? I can't just reformat using the utility and drag and drop everything back into the sd card?
runsoverfrogs said:
Wait, when i get my sd card I have to do all this? I can't just reformat using the utility and drag and drop everything back into the sd card?
Click to expand...
Click to collapse
Not if you're using AppsToSD.
If you're not using A2SD then just make a backup of the old card, unmount it, put the new one in, and copy everything back. If you are using A2SD, the process is more complex.
Cp = Copy. Works on any rom. Like he said since you're on the stock rom, I doubt you're using Apps2SD so no you don't have to do all this.
If only people would actually read the thread title....
"How to swap SD cards w/ Apps2SD."
Don't have Apps2SD? Then this isn't the thread for you.
Exactly what I was thinking.
jonnythan said:
If only people would actually read the thread title....
"How to swap SD cards w/ Apps2SD."
Don't have Apps2SD? Then this isn't the thread for you.
Click to expand...
Click to collapse
I'm using the modaco 1.1, i should've mentioned that. Doesnt that come with Apps2SD built in?
Only if you partitioned your sd card before you flashed.
After step 6, how do you boot into recovery mode to partition the new card if you dont have the recovery image on the new card? Did I miss a step where I added the recovery image to the new card?
chalan30 said:
After step 6, how do you boot into recovery mode to partition the new card if you dont have the recovery image on the new card? Did I miss a step where I added the recovery image to the new card?
Click to expand...
Click to collapse
The recovery partition is installed on the phone itself, not the card.
thanks I dont know why the first time I tried i didn't get back into the recovery screen but the second time I booted into it just fine... oh well thanks for all your hard work!!!
Partitioning links
To partition the new card, you might want to include links to sdparted and this page for people who want to do it manually.
I have a question about how to make the swap. I have moved /data/dalvik-cache/ to my sd card and freed up about 25 meg of space on internal memory. Is there anything I need to do in addition to your instructions or would it be better to just do a wipe and start from scratch. I am using MoCaDo 1.2 Rom using apps2sd and ext3 partition. I have a 16 gig card coming. By moving the cache I now have 143 meg of internal memory with about 65 apps installed counting some of the stock apps. I have removed several of those as well. 34 apps from the market or handmark.
esoteric1311 said:
All props go to Jonnythan who gave the steps in another post. Mods may want to sticky this....
1. As always: Nandroid backup
2. reboot phone
3. adb shell into the phone
4. mkdir /sdcard/backup/
mkdir /sdcard/backup/app
mkdir /sdcard/backup/app-private
cp -r /data/app/* /sdcard/backup/app/
cp -r /data/app-private/* /sdcard/backup/app-private/
5. copy sd card to pc
6. Shut off phone and remove old sdcard and insert new sdcard
7. Start in recovery mode and partition new sdcard (fat32, ext2, swap)
8. Enable usb mode, copy data from old sdcard to newly partitioned sdcard
9. reboot and ignore force closings
10. Plug in USB and enable USB mode
From PC ADB shell into phone and type the following (enter after each line):
rm -r /data/app/*
rm -r /data/app-private/*
[chances are those directories are empty already, but you never know]
cp -r /sdcard/backup/app/* /data/app/
cp -r /sdcard/backup/app-private/* /data/app-private
reboot recovery
11. Restore most recent nandroid
12. reboot and enjoy
All thanks again to Jonnythan
Click to expand...
Click to collapse
I see some possible problems with this method... what happens if you're copying the sdcard onto a windows machine to backup? You'll lose symlinks, uid, and the like.
Also, what if /app and /app-private don't get put back onto the new sdcard? You'll end up with symlinks that point to nothing.
How 'bout this method? (just a little tweak).
Boot into recover (adb shell reboot recovery)
when recovery comes up, go to the shell (adb shell)
Then, issue these commands (this assumes your ext partition is ext3, and that you're using Amon-Ra's recovery so you have BusyBox 1.13.2 or later):
mkdir /sdcard/extback
mount -o ro -t ext3 /dev/block/mmcblk0p2 /system/sd
cp -a /system/sd/. /sdcard/extback/
Now, back up the sdcard to a linux machine... keeping uid's and everything the same.
Turn the phone off, swap the cards, reboot into recovery (manually), format, partition, and convert ext2->ext3 the sdcard, put all the stuff back onto the card... and in the shell (within recovery
mount -o rw -t ext3 /dev/block/mmcblk0p2 /system/sd
cp -a /sdcard/extback/. /system/sd/
reboot
Now, it should all come up with the same attributes, no force close, and everything...
Basically, this method would swap sd cards outside of the normal OS (in recovery), but would keep all the attributes, symlinks, and uids the same for the main OS.
I think if you're using a windows box to backup the card, then we may want to look into making a tarball of the ext partition. I'm not sure if Amon-Ra's recovery supports this or not.
jmanley69 said:
I see some possible problems with this method... what happens if you're copying the sdcard onto a windows machine to backup? You'll lose symlinks, uid, and the like.
Also, what if /app and /app-private don't get put back onto the new sdcard? You'll end up with symlinks that point to nothing.
How 'bout this method? (just a little tweak).
Boot into recover (adb shell reboot recovery)
when recovery comes up, go to the shell (adb shell)
Then, issue these commands (this assumes your ext partition is ext3, and that you're using Amon-Ra's recovery so you have BusyBox 1.13.2 or later):
mkdir /sdcard/extback
mount -o ro -t ext3 /dev/block/mmcblk0p2 /system/sd
cp -a /system/sd/. /sdcard/extback/
Now, back up the sdcard to a linux machine... keeping uid's and everything the same.
Turn the phone off, swap the cards, reboot into recovery (manually), format, partition, and convert ext2->ext3 the sdcard, put all the stuff back onto the card... and in the shell (within recovery
mount -o rw -t ext3 /dev/block/mmcblk0p2 /system/sd
cp -a /sdcard/extback/. /system/sd/
reboot
Now, it should all come up with the same attributes, no force close, and everything...
Basically, this method would swap sd cards outside of the normal OS (in recovery), but would keep all the attributes, symlinks, and uids the same for the main OS.
I think if you're using a windows box to backup the card, then we may want to look into making a tarball of the ext partition. I'm not sure if Amon-Ra's recovery supports this or not.
Click to expand...
Click to collapse
Now I'm confused don't take much.
I tried reading the ext2 partition using ubuntu and loading it temp on my windows 7 PC. It would not let me open that partition so I could not copy anything to it.
I guess the easiest way is to just wipe the phone back to factory, booting to recovery with the new card in and create the fat32-ext2-swap partition, re-flash the MoDaCo or any Rom that uses Apps2Sd and install all my apps again. I am assuming this would work as well.
jmanley69 said:
I see some possible problems with this method... what happens if you're copying the sdcard onto a windows machine to backup? You'll lose symlinks, uid, and the like.
Also, what if /app and /app-private don't get put back onto the new sdcard? You'll end up with symlinks that point to nothing.
How 'bout this method? (just a little tweak).
Boot into recover (adb shell reboot recovery)
when recovery comes up, go to the shell (adb shell)
Then, issue these commands (this assumes your ext partition is ext3, and that you're using Amon-Ra's recovery so you have BusyBox 1.13.2 or later):
mkdir /sdcard/extback
mount -o ro -t ext3 /dev/block/mmcblk0p2 /system/sd
cp -a /system/sd/. /sdcard/extback/
Now, back up the sdcard to a linux machine... keeping uid's and everything the same.
Turn the phone off, swap the cards, reboot into recovery (manually), format, partition, and convert ext2->ext3 the sdcard, put all the stuff back onto the card... and in the shell (within recovery
mount -o rw -t ext3 /dev/block/mmcblk0p2 /system/sd
cp -a /sdcard/extback/. /system/sd/
reboot
Now, it should all come up with the same attributes, no force close, and everything...
Basically, this method would swap sd cards outside of the normal OS (in recovery), but would keep all the attributes, symlinks, and uids the same for the main OS.
I think if you're using a windows box to backup the card, then we may want to look into making a tarball of the ext partition. I'm not sure if Amon-Ra's recovery supports this or not.
Click to expand...
Click to collapse
Well, for one thing your method requires a linux machine
But what would you even have symlinks on the SD card for? Symlinks, uids, and attributes on SD card files simply aren't an issue at all for most people.
And truthfully if you are already doing that kind of stuff, you don't need this guide.
jonnythan said:
Well, for one thing your method requires a linux machine
But what would you even have symlinks on the SD card for? Symlinks, uids, and attributes on SD card files simply aren't an issue at all for most people.
And truthfully if you are already doing that kind of stuff, you don't need this guide.
Click to expand...
Click to collapse
As far as Linux... get VMWare player for free and download ubuntu and you're set real fast. Also if you notice what I said about doing a tar instead id using Linux.
As far as symlinks. You're right there "shouldn't" be any... but if you're backing up something why not do it right just in case? We have no idea what future versions of apps2ad sill do. It may happen that a file MUST reside on internal memory and therefore you'd need a symlink.
As far as the rest...
Actualy... each app gets its own user id and mismatches in those can cause problems with some apps. And each file in Linux gets attributes to tell the OS who is allowed ti read/write/execute it. If those get messed up it can cause problems.
So... we have a responsibility aa educators to give the best instructions possible. And not give instructions that ultimately would result in a backup that is missing vital information and would lead to a complete reload to fix the problems.
There are many reasons why Google decided to restrict apps to internal memory and we will never know all of them... this may very well be one of the problems they saw happening.

Clone an SD card (including EXT3) to another?

Like ghosting a HDD to another, I wanted to know if there's an app that can do this?
I think my 8GB LG branded MicroSD is failing as Windows keeps reporting that the drive needs to be scanned when I mount it via USB from my Desire so I'd like to just get a new Sandisk 8GB card and clone the old to new one to avoid having to go through restoring backups and so on.
If anyone has any ideas that would be grand!
check winimage.
That app can make image and recover it to drives!
Doesnt matter if disk is bigger than previous ( NB! may need to resize to get total space if its bigger, cannot remember)
I've always used it for vmware ESXi embedded sticks, made a million of them and the app works!
also linux routers.
Hope this helps.
vmware ESXi runs linux so it supports EXT!
No need for a program, copy data from fat partitions vis pc and use this ( from cyanogen wiki page) Used it three times now and no problems
Upgrading SD / Moving data to new SD
If you are using RA recovery, this is all done for you by making a BART backup. The following is if you're wanting to do it from the command line.
1. First, backup your ext partition on to your fat32 partition. Note, you will need enough free space to hold all of your apps.
* In Terminal Emulator or recovery console:
mount -a [enter]
tar cvf /sdcard/ext.tar /system/sd [enter]
Note that you must have root access for Terminal Emulator. If you get "permission denied" after entering the above command, then try entering the command "su". "sudo" will not work. After entering "su" try the above command again.
* Or, Using ADB shell from your PC:
adb shell
mount -a [enter]
tar cvf /sdcard/ext.tar /system/sd [enter]
2. Next, mount your SD card and download/backup everything on your fat32 partition. Make sure to get the ext.tar file that you just created in the previous step.
3. Change cards/repartion, or do whatever it is you planned to do here. For instructions on creating new partitions see the installation instructions above.
4. If you're not already, reboot into your recovery. Restore your backup files to your fat32 partition. Don't boot into CM yet!
5. Either go to console or ADB shell and type:
*
mount -a [enter]
*
tar xvf /sdcard/ext.tar [enter]
6. Double check that your directories are moved with:
ls /system/sd [enter]
7. Now you can reboot into CM!
8. Run fix permissions to fix any corrupted permissions.
9. Enjoy your new card!
If you have Amon Ra's recovery on your android phone you can do a bart backup with your old sd card, partition the new sd card as required, copy the bart backup to new sd card and then do a bart restore. It is what i did when i upgraded from my 2gb to 8gb, worked a treat.
Since I created this thread a few great things have happened, EXT4 support in unrevoked permanent flashed AmonRA recovery being the main one so now I am sorted thanks!
I use Gparted just copy paste

[DEV][DATA2SD] More space (and more I/O) for your Desire (Updated/EXT4/Flashable ZIP)

HI all.
I know it has been already done but I didn't find any detailed tutorial for the hTc Desire so I wrote one for you
Howto for a HTC desire with clockworkmod recovery:
I did this with a stock HTC sense 2.2 froyo rooted rom with init.d support and my own kernel, forked from richardtrip sense kernel v5e. I don't know for other ROMs or Kernels. Your ROM must support init.d boot scripts.
What you need is:
* Fast µSD card (Class 4 or 6 recommended. Lots of issues reported with class 10 on the Desire)
* busybox (http://www.busybox.net/downloads/binaries/) on c:\
* Kernel with EXT4 support. The kernel in original ROM does not provide ext4 support!!
* Rom with init.d script support (StarBurst (Froyo) or Supernova (Gingerbread) have a native DATA2SD support)
* If you already have app2sd+ or a similar script, don't do the following hack (or at your own risks) !!
* If you still want to try it, backup your A2SD scripts and roll-back to a pre-A2SD state. Don't ask me why it's not working, I never used APPs2SD so I can't help.
* To help you with ADB, you can use the GUI
If you feel a bit lazy or you're scared to make any mistake and want to skip all the manual installation, then go straight to the bottom of this post and download the flashable script made by droidzone. Many thanks to him!! You can also flash Supernova (Stock HTC gingerbread release) and you'll be good to go within no time.
If you already have this running but you flashed another rom, have a look here. droidzone posted another script to just update the rom you just flashed to get DATA2SD work properly
[size=+1]1/Get yourself prepared[/size]
A/ backup everything (nandroid).
B/ Make sure everything is backed-up
C/ Copy the content of you SD to your computer and keep it handy for a roll-back.
D/ make a copy !!!! (I think know that you've been warned )
[size=+1]2/ Make 2 primary Mb aligned partitions on your SD[/size]
Primary partition 1 will be your usual storage, must be FAT32.
To optimize it, I really recommend to have a look here
Primary partition 2 will be your new storage (/data).
You can use gparted or fdisk (I do prefer fdisk and wrote a guide here ) to partition your SD; but it's up to you and Gparted is working great too.
Use the MB align option of gparted to align your partitions. This helps big time to get a better R/W speed.
With the latest busybox, you can do that on your phone in recovery mode.
You will need also e2fs progs. They're all attached at the bottom of this howto.
[size=+1]3/ Boot your phone in recovery and get it prepared[/size]
Connect to your phone with "adb shell"
You should get a ~# prompt now.
mount /system
mount /data
mount /sdcard
exit
if mount /sdcard fails, try mount /dev/block/mmcblk0p1 /sdcard
You should get this as a result of a "mount" command:
Code:
~ # mount
mount
rootfs on / type rootfs (rw)
tmpfs on /dev type tmpfs (rw,relatime,mode=755)
devpts on /dev/pts type devpts (rw,relatime,mode=600)
proc on /proc type proc (rw,relatime)
sysfs on /sys type sysfs (rw,relatime)
/dev/block/mtdblock4 on /cache type yaffs2 (rw,nodev,noatime,nodiratime)
/dev/block/mmcblk0p1 on /sdcard type vfat (rw,relatime,fmask=0000,dmask=0000,allow_utime=0022,codepage=cp437,iocharset=iso8859-1,s
hortname=mixed,errors=remount-ro)
/dev/block/mtdblock3 on /system type yaffs2 (rw,relatime)
/dev/block/mtdblock5 on /data type yaffs2 (rw,relatime)
Replace you old busybox exec with the new one. It's located in /system/xbin/
adb push c:\busybox-armv6l /system/xbin/busybox
Add the script to init.d folder:
adb push c:\01data.txt /system/etc/init.d/01data
Add the fstab to /system/etc/
adb push c:\fstab.txt /system/etc/fstab
Extract e2fsprogs-arm.zip to c:\
Push all e2fs progs you've extracted from the zip to /system/bin/ the same way:
adb push c:\e2fsprogs\system\bin\e2fsck /system/bin/
adb push c:\e2fsprogs\system\bin\mke2fs /system/bin/
(etc.... for all apps)
Push all e2fs libs you've extracted from the zip to /system/lib/ the same way:
adb push c:\e2fsprogs\system\lib\libext2_blkid.so /system/lib/
adb push c:\e2fsprogs\system\lib\libext2_com_err.so /system/lib/
(etc... for all libs)
adb shell
cd /system/bin
chmod 755 e2fsck
chown 0.2000 e2fsck
(Do the same for all pushed apps.)
cd /system/lib
chmod 644 libext2*
chmod 755 /system/xbin/busybox
chown 0.0 /system/xbin/busybox
chmod 755 /system/etc/init.d/01data
chown 0.0 /system/etc/init.d/01data
Finally type this:
:> /system/etc/mtab
[size=+1]4/ Instant of creation[/size]
cd /
For a non-journaled version:
/system/bin/mke2fs -T ext4 -b 4096 -E stride=64,stripe-width=64 -O ^has_journal,extent,^huge_file -m 0 -L userdata /dev/block/mmcblk0p2
For a journaled version (safety/AOSP ROMs):
/system/bin/mke2fs -T ext4 -b 4096 -E stride=64,stripe-width=64 -O extent,^huge_file -m 0 -L userdata /dev/block/mmcblk0p2
stride and stripe-width are RAID options but they are used here to align the filesystem to the max erase block size of an SD card. In conjunction with EXT4 extents feature (not present in ext3), it gives a bit of extra performance thanks to block allocation. It's used and recommended for SSDs, so it should help our poor little cheap (SSDs) SD cards
I use 64 because 64x4 (4kb block size)=256Kb. 256Kb is the max erase block size per the SD standards.
Your card may have a smaller erase block size but 256K is at least compatible with every card.
If you want to change the block allocation size, change the "64" parameter.
Just change it to - say - 32 (32x4=128kb) etc ...
Tune this to your actual erase block size if you know it.
If you want journaling (better data integrity) at the cost of performance and probably sd card wear, use the journaled option when you format the ext4 partition. Journal will also use some space on your EXT partition.
Read this article or my tutorial for more details on aligning partition and file system on linux.
I'd like to mention at this stage that fortunately, HTC has implemented a nice and clean unmount of /data at shutdown. Unless you remove your phone battery while it is running or android completely crashes and the cache hasn't been flushed to the sd card, you shouldn't suffer from data loss. In that case though, I've implemented a forced check of the data partition to try to recover any errors on the ext4 partition before booting the phone. You can expect to have a fair amount of safety without journal as long as you turn off your phone with standard HTC menu on sense ROMs
Anyway, if you want to try DATA2SD on a AOSP ROM, you *must* use a journal!
[size=+1]5/ verbatim[/size]
type this:
mkdir /sd
/system/xbin/busybox mount -t ext4 /dev/block/mmcblk0p2 /sd
cd /data
cp -a * /sd
cd /
sync
All you data should copied now.
check with a "ls -l /sd" that you have a least the directory structure.
"df" should report the space used on the new filesystem and should be close to your /data.
/system/xbin/busybox umount /sd
[size=+1]6/ Reboot[/size]
Reboot.
Move all you apps (if you have used the Froyo AP2SD) back to the phone, which is now the SD.
Reboot to get a clean and stable phone
Make sure that you don't install any app in the future to the SD. Some apps are installed automatically to SD, move them back to the phone if it is so.
[size=+1]7/ Comments[/size]
IMHO, a readahead of 128kb could be a bit excessive and can penalise read speed when reading small amounts of data. I've reduced it on my phone to 64kb and noticed a slight improvement when for instance the phone reads data to show apps, icons and size when you open the application list in the settings/applications/manage applications menu. Some kernels have a default value of 4K. This is really bad for performance and it must be changed to get good read performance.
To change it, type this while android is running:
echo 64 > /sys/block/mmcblk0/queue/read_ahead_kb
This setting will be lost on reboot. Just add this line to the script if you want to keep it on reboot.
ownhere did a fantastic job at hacking the libsqlite.so library. I patched the original sense lib and I strongly recommend to replace it with the one attached below.
To do so, just boot into recovery mode, mount /system and backup your /system/lib/libsqlite.so file to your sdcard. Then push the patched lib to /system/lib/ and do a chmod 644 on the pushed file.
Reboot and VOILA!
Updates of the flashable ZIP are available here
If you're coming from previous version (2 FAT32 partitions, ext2 file and loop mount) and want to move to this new one, have a look at this post. You don't have to do everything from start and loose your data. You should get there all the needed info to backup your data and restore it to the new EXT4 partition.
ownhere posted a very interesting option to play with in this post. Apparently nodelalloc mount option is giving better score than delalloc on flash memories. I recently tested it and I had better Quadrant and TAP scores so check-it out!
If you want to impress your friends with Quadrant score, just add "noauto_da_alloc" in the mount option of the script or do this manually with adb shell : busybox mount -o remount,noauto_da_alloc /data
The effect is pretty similar on the final score than nodelalloc (at least on my phone/sdcard )
To get back to normal: busybox mount -o remount,auto_da_alloc /data
(Got this setting from here).
It is simply making the system (thus Quadrant) working in cache (RAM) instead of the SD card.
I'm not sure that this settings improves that much real life usage, but at least you'll get what you're looking for: A super (fake) Quadrand I/O score
I may add this setting in future release of DATA2SD. I'm testing it ATM on my phone.
Many thanks to ownhere and melethron for all their thinkings at bringing issues, help and updates to get to this new version.
Many thanks to too droidzone for his great work on a flashable ZIP and integrating DATA2SD in his ROM to make your life easier you flash maniacs
I hope that I didn't forget something. It's working for me so it should work for you.
Read the thread before asking a question !
This sounds really great ... 2 things :
1. your links are broken
2. Can't we generate the file for /data on the first fat32 partition ... would be a lot easier to format the sdcard with only one partition ...
thank you very much for this great information ...
fogbav said:
This sounds really great ... 2 things :
1. your links are broken
2. Can't we generate the file for /data on the first fat32 partition ... would be a lot easier to format the sdcard with only one partition ...
thank you very much for this great information ...
Click to expand...
Click to collapse
No because you won't be able to use your SD as an external drive when connected to USB.
Just checked the links and they're OK
i vouch for sibere's script... i'm one of first "live testers" for his script and it works great and very, very stable
and from what have been tested by several testers , it can work in these roms :
without a2sd+ :
- rooted stock
- leedroid no-a2sd
with a2sd+ :
- auraxtsense
- defrost
- leedroid
- alex-v
Sibere, allow me to add notes from AndroHero on using the script with a2sd+ rom :
- remove the data2sd (or in auraxt, stuff2sd) from system/etc/init.d in the rom zipfile, or if you have install the rom, just remove from system/etc/init.d
- do the sibere script
Regards
BL
I have follow this easyest tutorial and i'm ok.
All credits to AndroHero for tutorial and to sibere for the hack! I'm only copy and paste from the previous thread!
This tutorial is for all app2sd sense rom so you can follow this tutorial not onfly for lee droid.
As attachment the file that tutorial need.
I have made a 2gb partition for data and is an awesome to see 1.80gb internal memory at first boot!!!!
WOOOOW
Now let's start with tutorial!
------TUTORIAL BEGIN-------
WHAT YOU NEED:
1)Root
2)Android SDK
3)15minutes of time
ALWAYS MAKE A NANDROID BACKUP AND SD BACKUP!!!
LET'S START NOW!
1) download leedroid 2.2f (apps2sd version)
2) unzip the .zip file, open the folder, open the system folder, and then inside that open the folder called etc, you will see a folder called init.d, open that and delete the file called 40a2sd, now just navigate back to the root of the rom and re-zip it.
3) now you need to partition your sd card, use gparted to make 2 fat partitions, a large primary partition and a secondary one about 1gb in size.
4) once you have done that copy the leedroid.zip to the sd card, boot into recovery, do all your wipes and flash the rom, one fashed boot it up and set it up as normal.
5) once set up, hold the power button and choose the option to reboot into recovery.
6) once in recovery connect your phone to your pc, open a command prompt and navigate to the tools folder inside the android SDK.
7) now in the command prompt type the following one at a time:
adb shell
mount /system
mount /data
mount /sdcard
exit
8) now leave the command prompt open and download the file at the bottom of the screen, (i have had to zip it, just open the .zip and the 01data file is inside) and copy it to the root of the c:\ drive on your pc.
9) in the command prompt type (one at a time and always wait for the # to appear again before entering a new command)
adb push c:\01data /system/etc/init.d
adb shell
chmod 755 /system/etc/init.d/01data
cd /
mount /dev/block/mmcblk0p2 /sd-ext
dd if=/dev/zero of=/sd-ext/ext2 bs=1048576
/system/xbin/busybox mke2fs -F -L userdata /sd-ext/ext2
mkdir /sd
/system/xbin/busybox mount -o loop /sd-ext/ext2 /sd
cd /data
cp -a * /sd
cd /
/system/xbin/busybox umount /sd
exit
adb reboot
10) your phone will now reboot with a much bigger /data/ partition.
------TUTORIAL END-------
I suggest to activate the boost!
type in adb shell window with android running:
busybox mount -o remount,noatime,nodiratime /mnt/asec/ext/ext2 /data
sibere said:
No because you won't be able to use your SD as an external drive when connected to USB.
Just checked the links and they're OK
Click to expand...
Click to collapse
Sounds real logical ...8) ... Ups ... shortcut in brain ...8)
bluelavender said:
i vouch for sibere's script... i'm one of first "live testers" for his script and it works great and very, very stable
and from what have been tested by several testers , it can work in these roms :
without a2sd+ :
- rooted stock
- leedroid no-a2sd
with a2sd+ :
- auraxtsense
- defrost
- leedroid
- alex-v
Sibere, allow me to add notes from AndroHero on using the script with a2sd+ rom :
- remove the data2sd (or in auraxt, stuff2sd) from system/etc/init.d in the rom zipfile, or if you have install the rom, just remove from system/etc/init.d
- do the sibere script
Regards
BL
Click to expand...
Click to collapse
Year sure, you're free to add notes mate
will this increase the battery usage?
kakit526 said:
will this increase the battery usage?
Click to expand...
Click to collapse
No effect at all on the battery usage. the usage is around the same .
BL
only one question:
is it better than using a2sd+?
what is the difference?
i had a lot of memory issues with a2sd+ (internal memory decrease very quickly compared to a2sd storage until i get the 'low memory' error message), does this solve my problem?
thanks
bye
Alessandro
Does this really increase IO speed? Can anyone who managed to set this up please post ur Quadrant benchmark.
alessandro_xda said:
only one question:
is it better than using a2sd+?
what is the difference?
i had a lot of memory issues with a2sd+ (internal memory decrease very quickly compared to a2sd storage until i get the 'low memory' error message), does this solve my problem?
thanks
bye
Alessandro
Click to expand...
Click to collapse
Yes, it will solve the problem
The reason why internal memory still decreases with a2sd+ is because not every part of the apps are moved to sd-card . Some of the data parts are still in the internal memory.
This script moves entire data folder to sd card, so nothing in internal memory get decreased
It can be any size you want. So far, the maximum tested size is 2 gb i think was tested by mattiadj & androhero.
BL
I tried once, i got 1956 score (CPU at 998Mhz)
Does this preserve the data on the card? Or do you have to copy everything back on?
Of course I'll have backups, but just asking
coutts99 said:
Does this preserve the data on the card? Or do you have to copy everything back on?
Of course I'll have backups, but just asking
Click to expand...
Click to collapse
it will survive the boot... of course, if you wipe factory data, everything will be gone...but it is safe and survive normal reboot or recovery reboot
BL
This is what is on clean flash of leedroid and after this hack!
I have made a 2gb partition....
Image talks alone....one word: THANKS!
Great job!
Now I expect seeing this bundled into all ROMs around here...
Any improvements are welcome but beside the space can you feel the I/O at some points or is it just a number?
Dude you are legen........ wait for it........... DeRY =D
hope to find a little time to test this awesome tutorial =]
what would happen if the SD card failed? does this render the phone unuseable until a new rom is flashed?

[GUIDE][Using loop devices to workaround corrupt eMMC partitions]

Introduction
This workaround is for those of us (may only be me at this point?) who have bricked your Skyrocket by formatting a partition in an ICS-based kernel. This is where the kernel performed an MMC ERASE command and due to a bug in the eMMC firmware, the wear leveling data was corrupted.
The result is that accessing the affected section of eMMC causes the device to lock up. If we could find a way to avoid accessing those areas, the device might be usable again.
To further complicate matters, it seems that writing to the eMMC causes the problem to move around--probably because the eMMC tries to update the wear leveling data. As a result, any workaround needs to assume that no portion of the eMMC can be used for writable scratch space. That means it can't be used for /data, /cache, /tombstone, or "internal sd".
In this workaround, I create image files for the data, cache, and tombstone partitions on the external SD card. Then I modify the ramdisk to use the loop devices to mount these images as /data, /cache and /tombstone. The result is a bootable system.
The system obviously runs slower, but it is definitely tolerable. Usually the delay is noticed when opening an app for the first time. Another downside is that the "internal sd card" is gone and the "external sd card" is not USB mass storage mountable (since loop files are on it and therefore cannot be unmounted).
Thanks to seedub for the brainstorming session where we came up with this approach. I appreciate his Linux-fu.
Identifying If Important Partitions Work
On Skyrocket, for this workaround to be successful, we need at least the first 24 partitions to be okay. A few tests you should run:
Can you boot into download mode?
Can you boot into recovery mode?
In recovery, run "adb shell dd if=/dev/block/mmcblk0pX of=/dev/null" where X is 1-24. Do these all complete without error?
In recovery, can you install a ROM zip (e.g. CM9) without the device rebooting? (This is to test whether you can write to /system)
If the answer is "yes" to ALL of the questions above, then you are a candidate for this workaround.
Btw, always pull the battery and remove the USB cable before starting the above tests. Once the eMMC is locked up, it needs to be power cycled before it works again.
Creating The Image Files
You will need 1.5GB free. You can adjust the size of the data image to your liking. Boot into recovery and run the following commands in an "adb shell":
Code:
# Create an area on your SD card for the image files
mount /sdcard
cd /sdcard
mkdir emmc_workaround
cd emmc_workaround
# Create the data image file (1 GB - normally on /dev/block/mmcblk0p25)
dd if=/dev/zero of=/sdcard/emmc_workaround/data.img bs=1024 count=1048576
busybox losetup /dev/block/loop0 /sdcard/emmc_workaround/data.img
mkfs.ext4 -m 1 /dev/block/loop0
busybox losetup -d /dev/block/loop0
# Create the cache image file (297 MB - normally on /dev/block/mmcblk0p26)
dd if=/dev/zero of=/sdcard/emmc_workaround/cache.img bs=1024 count=304128
busybox losetup /dev/block/loop1 /sdcard/emmc_workaround/cache.img
mkfs.ext4 -m 1 /dev/block/loop1
busybox losetup -d /dev/block/loop1
# Create the tombstone image file (64 MB - normally on /dev/block/mmcblk0p27)
dd if=/dev/zero of=/sdcard/emmc_workaround/tombstone.img bs=1024 count=65536
busybox losetup /dev/block/loop2 /sdcard/emmc_workaround/tombstone.img
mkfs.ext4 -m 1 /dev/block/loop2
busybox losetup -d /dev/block/loop2
umount /sdcard
Modifying a ROM
We have to modify the ROM to make this work. With a lot of effort you might be able to modify a stock ROM, but I would recommend only modifying a built-from-source ROM. I used CM9 since, well, I am most familiar with it.
Here is the outline of the changes:
Disable the internal SD card on partition 28
Make the external SD card non-removable and disable USB mass storage for it
Rework the init scripts to mount the external SD card, attach the images to loop devices, and mount /cache, /data and /tombstone on their new loop devices
Apply patch #0001 (which is attached) to the device/samsung/skyrocket tree of CM9. See these build instructions: http://forum.xda-developers.com/showpost.php?p=25363482&postcount=3
Apply path #0002 if you want to move /cache to tmpfs instead of an image file. I'm still experimenting with this one.
Possible Improvements
I'm sure there are some ways to speed things up. I'll add to this list as we come up with more ideas.
Use smaller image files
Put /cache into a ramdisk -- probably would increase responsiveness a great deal (see patch #0002)
Repartition external SD card instead of using image files
so if some1 had a true brick where device can not turn on, this method still wont unbrick it
Mr. Top, you, sir, are a genius. Hopefully this will help us move forward with a possible unbrickable mod.
Sent from my SAMSUNG-SGH-I727 using XDA
Idea, What about cloning the whole emmc card boot partition and all to a microsd
vincom said:
so if some1 had a true brick where device can not turn on, this method still wont unbrick it
Click to expand...
Click to collapse
Yup. This is only for the Emmc lockup bug where it affects the data partitions,
Sent from my iPad using Tapatalk HD
tjsooley said:
Idea, What about cloning the whole emmc card boot partition and all to a microsd
Click to expand...
Click to collapse
That would definitely work if the boot partition of the Emmc was intact. I think partition #8. I don't know of a way to redirect the base kernel boot until it starts executing the init scripts.
Sent from my iPad using Tapatalk HD
In theory wouldn't you just have to change the memory address that the phone goes to when it first boots so it never looks at the original boot partition?
Sent from my SAMSUNG-SGH-I727 using XDA
Could you tell me what exactly causes this. So i can avoid it.
im currently on skyics latest leak with clock work mod touch recovery
i just would like to know what not to do. thanks
tpmullan said:
In theory wouldn't you just have to change the memory address that the phone goes to when it first boots so it never looks at the original boot partition?
Sent from my SAMSUNG-SGH-I727 using XDA
Click to expand...
Click to collapse
the memory address the pc points to on first boot/after resets is implemented in hardware iirc,,, bootstrapping etc.
Is there a way to unbrick this device without a JTAG using only the EMMC program? My answer to all the questions in this post is NO, my device does not turn ON at all but when I plug it into the computer, it shows on the Device Manager under COM7 port. I have installed the Qualcomm HS-USB QDLoader 9008 driver and it appears in EMMC software as in Download mode. I've searched on the internet and I cannot find a solution that is not using JTAG. Thanks for answering.

[GUIDE][ROOT] Resizing emulated SD card and userdata partitions

I originally created this guide for Sony Xperia T/TL/TX/V and have since discovered that the method works for other devices, too. So I present the universal guide to getting rid of that annoyingly tiny allocation of space for internal storage in devices that have plenty of it.
Kudos to @teidus for pointing me to this long-forgotten method.
Screenshots of proof are attached to my original post.
WARNING: You will lose a lot of data if you don't follow this guide!
WARNING: These operations require a rooted device. If you are running unrooted Android 4.3 or newer, you cannot proceed.
NOTE: All of these changes will be reversed if you flash a factory image that contains a partition table.
DISCLAIMER: I'm not responsible for bricked devices and data loss from power surges, hardware damage, or changes to the linked software. Always check the native manuals for all the tools listed here!
I'm also not responsible for your curiosity and desire to resize other partitions. I haven't tried that because messing with /system and /cache can lead to unexpected results.
Requirements:
1. Your device must currently have root access, CMW recovery v6.0.4.6 or later, less than 50% allocated to internal storage, emulated SD card (usually, it's /storage/sdcard0), and at least 8GB of total onboard memory. If you answered "No" to at least one of these, this guide won't help you. To check whether you have an emulated SD card, remove your physical SD card, go into a file manager app, and see whether you still have some sdcard listed.
2. A factory image flashing software for your device unzipped and/or installed on your computer. Look in the relevant forums for downloads.
3. ADB from either Android SDK or your device's flashing tool. Look in the relevant forums for instructions.
4. For locked bootloaders, factory firmware image with Android v4.1.2 or v4.0.x saved on your computer (consult your flashing tool's manual for the default location) - nearly 100% of these have root exploits. Look in the relevant forums for downloads.
5. Root exploit with Superuser or SuperSU installer for your device unzipped on your computer. Look in the relevant forums for downloads.
6. CMW recovery installer v6.0.4.6 or later compatible with your device and the factory firmware version obtained in step 4 unzipped on your computer. Look in the relevant forums for downloads.
7. File system utilities (attached) unzipped to a folder on your device's physical SD card you'll remember (I'll be using /fs-utils in this guide).
8. For Windows 8 users, ADB drivers for your device.​
The Guide (skip all the way to the bottom for the short list of ADB commands):
1. Back up all data stored on internal storage:
Option 1: Connect your device to the computer and save it to a computer drive.
Option 2: Open a file manager on the device and copy it to a physical SD card (/sdcard1).​2. Back up your current installation with either Online Nandroid or your current recovery and remove the SD card for safety.
3. Flash your device with basic 4.1.2 install.
Refer to the documentation for your tool.​4. Connect your device to the computer and let the computer recognize it.
5. Enable USB debugging.
5.1 Go to (System) Settings -> Developer options and flip the switch in the top-right corner of the screen.
5.2 Look a bit down (toward the middle of the screen) and check USB debugging.​6. Root your device.
Refer to the documentation for your tool.​7. Install recovery on your device.
Refer to the documentation for your tool.​8. Boot into CMW recovery.
Depending on the device, reboot into recovery may be available in the power menu, or you'll need to press/hold a button during the power on sequence. Refer to the documentation for your recovery.​9. After the device boots into recovery, connect it to the computer.
10. Start ADB shell in command prompt.
Navigate to the folder where adb.exe resides, hold SHIFT, right click the mouse, and select Open command window here, then type adb shell in the command prompt and press ENTER.​11. Execute the following commands one-by-one (you can copy & paste, hit enter, and wait for the output):
Code:
umount /storage
parted /dev/block/mmcblk0
print
These commands unmount all drives, launch parted utility for mmcblk0 (onboard flash storage), and display the partition table on your screen.​12. Write down the info from the following columns for partitions Userdata and SDCard (or Media). Usually, they are the last 2 partitions.
Column 1 - Number, Column 2 - Start, Column 3 - End, Column 5 - File system, Column 6 - Name. The start of the first partition and the end of the second partition are the limits, within which your new partitions will be created. The numbers are in megabytes (MB) unless specified. Make sure the name is recorded just as it appears in the partition table - Andorid is case-sensitive.​13. Remove the 2 partitions by executing the following commands:
Adjust the numbers according to your system.​
Code:
rm 14
rm 15
14. Calculate the new start and end point for both partitions.
For the first partition, the start point will be the same. For the second partition, the end point will be the same. The end point of the first partition is the start point of the second partition.
Take the end number for the first partition you recorded in step 12, add more space to get the new end. Alternatively, if your first partition is actually the emulated storage, subtract the reallocated space to get the new end point. I advise to add at least 2GB (2048MB) to Userdata feel safe about having enough storage for apps. DON'T TRY TO REMOVE EMULATED STORAGE ALTOGETHER BY ALLOCATING ALL OF THE AVAILABLE SPACE TO USERDATA! Emulated storage is coded into OS environment and requires additional modifications to work properly.​15. Create and name new partitions by executing the following commands (don't copy the text in parentheses):
The system might throw several errors in the process. When prompted, just type ignore and hit ENTER.​
Code:
mkpartfs logical ext2 OLD_START NEW_END (change ext2 to fat32 if the first partition had that file system)
name 14 Userdata (change the number and the name according to your environment)
mkpartfs logical ext2 NEW_START OLD_END (change ext2 to fat32 if the second partition had that file system; make sure to include GB as the designation of the end point in order to stretch the partition to the end of the onboard storage)
name 15 SDCard (change the number and the name according to your environment)
quit
These commands create the partitions with ext2 file system and given beginning and end parameters, rename them as required, and close parted.​16. "Damage" the internal, emulated SD card so that it could be formatted properly later. REMOVE YOUR PHYSICAL SD CARD BEFORE THIS STEP TO AVOID WIPING THE WRONG CARD!!!
Tap Mounts and storage -> Format /storage/sdcard0 -> default and confirm the operation.​17. Insert the physical SD card (sdcard1) that you removed in step 2 back into the device.
Make sure it's mounted by going to Mounts and storage and checking its status (it should say unmount /storage/sdcard1/). If not, mount it by executing on the appropriate option.​18. Execute the following commands one-by-one in the ADB command prompt:
Code:
cd /storage/sdcard1/fs-utils (the directory name will be different if you didn't follow my conventions)
tune2fs -j /dev/block/mmcblk0p14 (change the number in mmcblk0pXX according to your environment - that's the partition that need to have file system ext4 - refer to your notes from step 12)
tune2fs -O extents,uninit_bg,dir_index /dev/block/mmcblk0p14 (change the number in mmcblk0pXX according to your environment)
e2fsck -fpDC0 /dev/block/mmcblk0p14 (change the number in mmcblk0pXX according to your environment)
These commands convert Userdata partition into the appropriate ext4 filesystem, which is not supported natively in the recovery environment. If you receive any errors while executing these commands, reboot recovery.​19. Reboot the device into full Android.
19.1 Remove the physical SD card for safety.
19.2 Go to the top menu level of recovery. Then select the top option Reboot the device.​20. When Android loads fully, you'll notice a notification about storage file system. Tap it and follow the prompts to format it.
21. Insert the physical SD card and reboot into the recovery to restore the backup from step 2.
Backup and Restore -> Restore from /storage/sdcard1.​22. Reboot back into full Android and copy the files saved from internal storage back into it. Then reboot again so that apps recognize the data.
DONE!​
Short guide/list of ADB commands and other events (*enclosed in asterisks*) if you know the safety drill & bash-based parted utility:
Code:
*flash 4.1.2 & install recovery*
*boot recovery*
adb shell
umount /storage
parted /dev/block/mmcblk0
print
*record start point of Userdata and end point of SDCard*
rm 15 (change the number according to your environment)
rm 14 (change the number according to your environment)
mkpartfs logical ext2 1621 7865 (change the numbers according to your environment)
name 14 Userdata (change the number and the name according to your environment)
mkpartfs logical ext2 7865 15.6GB (change the numbers according to your environment)
name 15 SDCard (change the number and the name according to your environment)
*remove physical SD card*
*Mounts and storage -> Format /storage/sdcard0 -> default -> confirm*
*insert physical SD card*
*Mounts and storage -> Mount /storage/sdcard1*
cd /storage/sdcard1/fs-utils
tune2fs -j /dev/block/mmcblk0p14 (change the number in mmcblk0pXX according to your environment)
tune2fs -O extents,uninit_bg,dir_index /dev/block/mmcblk0p14 (change the number in mmcblk0pXX according to your environment)
e2fsck -fpDC0 /dev/block/mmcblk0p14 (change the number in mmcblk0pXX according to your environment)
*remove physical SD card*
*reboot*
*format emulated SD card*
*reboot recovery*
*restore backup*
*reboot*
*restore sdcard0/*
*reboot*
FAQ
Will it work with Android 4.2/4.3/4.4 or an older version of recovery?
So far I have tested with the versions mentioned in the guide. You can test whether this method will work for your setup without jeopardizing any data by completing step 7 of requirements and executing the following commands in ADB shell after booting into your recovery:
Code:
parted /dev/block/mmcblk0
print *wait for output*
quit
cd /storage/sdcard1 *change if your physical sdcard is sdcard0*
tune2fs *no parameters*
e2fsck *no parameters*
No errors indicate the method works for you. Please make sure to tell me about your setup in the comments - I'll update the compatibility list.
Tested devices
Did it work on your device or did you fail? Leave a comment and I'll update the list!
Barnes & Noble
- Nook Tablet 16GB
Sony
- Xperia T/TL/TX
Links to tools and recoveries
Reserved
Sorry for bumping an old thread, but is there any way to remove the emulated SD card ? Or, at least point the physical SD Card as the primary SD Card.
I have searched everywhere but I can't seem to do it. If you know a way, it will help a LOT of people, because a lot of people have this problem and the solutions is not working. I tried to use the app from playstore, didn't work. Tried to find vold.fstab, no vold.fstab available in CM11. My device is XIaomi Redmi 1s running CM11.
derpotato said:
Sorry for bumping an old thread, but is there any way to remove the emulated SD card ? Or, at least point the physical SD Card as the primary SD Card.
I have searched everywhere but I can't seem to do it. If you know a way, it will help a LOT of people, because a lot of people have this problem and the solutions is not working. I tried to use the app from playstore, didn't work. Tried to find vold.fstab, no vold.fstab available in CM11. My device is XIaomi Redmi 1s running CM11.
Click to expand...
Click to collapse
As far as I could understand in Xperia environment settings, "internal storage" is a required location for OS. I think it's possible to emulate that access on an SD card but it would require decompiling and recompiling environment data or something else with a high risk of failing since you'd need to modify the OS instead of just the partition table.
bsined said:
As far as I could understand in Xperia environment settings, "internal storage" is a required location for OS. I think it's possible to emulate that access on an SD card but it would require decompiling and recompiling environment data or something else with a high risk of failing since you'd need to modify the OS instead of just the partition table.
Click to expand...
Click to collapse
Oh I see.. that's too bad. Well, thanks for the information
ignore this
does this method work on Xperia ZR stock 4.4.4 with NUT's dual recovery installed?
in the step where phone has to be booted in recovery mode n connected to pc via USB, nothing happens as I connect. when I type adb shell, error message returns as device not found.
Is there any work around or guide for this?
sourabhp said:
does this method work on Xperia ZR stock 4.4.4 with NUT's dual recovery installed?
in the step where phone has to be booted in recovery mode n connected to pc via USB, nothing happens as I connect. when I type adb shell, error message returns as device not found.
Is there any work around or guide for this?
Click to expand...
Click to collapse
I think there are separate drivers for ADB to work in recovery mode. Sorry that I forgot about them and I'm not sure whether they're included with FlashTool. My best suggestion is to search the forums.
bsined said:
I think there are separate drivers for ADB to work in recovery mode. Sorry that I forgot about them and I'm not sure whether they're included with FlashTool. My best suggestion is to search the forums.
Click to expand...
Click to collapse
I searched with google for ADB drivers in recovery mode and found one but even after that device was not detected in recovery mode.
I tried uninstalling and re-installing drivers but no luck. may be need more research
bsined said:
Code:
cd /storage/sdcard1/fs-utils (the directory name will be different if you didn't follow my conventions)
tune2fs -j /dev/block/mmcblk0p14 (change the number in mmcblk0pXX according to your environment - that's the partition that need to have file system ext4 - refer to your notes from step 12)
tune2fs -O extents,uninit_bg,dir_index /dev/block/mmcblk0p14 (change the number in mmcblk0pXX according to your environment)
e2fsck -fpDC0 /dev/block/mmcblk0p14 (change the number in mmcblk0pXX according to your environment)
These commands convert Userdata partition into the appropriate ext4 filesystem, which is not supported natively in the recovery environment. If you receive any errors while executing these commands, reboot recovery.​[/code][/hide]
[/size]
Click to expand...
Click to collapse
Thanx bro. I have successfully partitioned my device (Xperia L).
But when I checked the file system, it is ext3 not ext4.
Still my device is running well.
Will it effect the performance of my device?
Is it possible using this method to shirk down the size of SYSTEM partition too?
Any extra caution need to take k?
jjiiaa said:
Is it possible using this method to shirk down the size of SYSTEM partition too?
Any extra caution need to take k?
Click to expand...
Click to collapse
First off, SYSTEM partition isn't that big - less than 1GB, so you won't gain much from shrinking it. Secondly, I'm not sure where recovery is written. You're risking bricking your phone. Lastly, if you shrink the partition too tightly, you'll effectively remove the ability to upgrade your device's firmware because all ROMs have various sizes.
I have installed Bliss Pop Lollipop 5.0.2 ROM on my Xperia L, will this make any difference? Should this work?
israfild said:
I have installed Bliss Pop Lollipop 5.0.2 ROM on my Xperia L, will this make any difference? Should this work?
Click to expand...
Click to collapse
I think Android 4.4+ utilizes the entire internal storage as a single block, so the guide is pointless. If that's not the case on your device and you're willing to be the guinea pig, please do attempt the repartitioning and report on the results.
Sent from my LT30p using XDA Free mobile app
@bsined i follow the steps but now i stay with a corrupt table and ia cant start my phone XPERIA L i follow the step i dont know what i did bad can you help me?
zero995 said:
@bsined i follow the steps but now i stay with a corrupt table and ia cant start my phone XPERIA L i follow the step i dont know what i did bad can you help me?
Click to expand...
Click to collapse
Just double-checking that you had downgraded to 4.1 before resizing. You should be able to recover your device by flashing any FTF with Flashtool.
i try with 4.1 and 4.2.2 by ftf but no my phone doesnt start now i'm tired i got leave that perhaps i'm gonna buy a new phone pfff :c
zero995 said:
i try with 4.1 and 4.2.2 by ftf but no my phone doesnt start now i'm tired i got leave that perhaps i'm gonna buy a new phone pfff :c
Click to expand...
Click to collapse
If the phone doesn't start at all, that doesn't sound like it's related to partition tables. If the screen, the vibrator, and the LED turn on, the phone is in a soft brick and should be recoverable. You should ask in the FTF threads if you get any errors in flashtool.

Categories

Resources