? How to recover deleted files on rooted Android without USB Debug & PC connection? - Android Q&A, Help & Troubleshooting

? How to recover deleted files on rooted Android without USB Debug & PC connection?
Hello.
I have removed some important files in my DCIM folder on internal memory of my Android device. The USB socket of the phone is broken so I couldn't use any recovery software that using USB debug mode but I have Team Win I want to use the terminal of Team Win to make an image and copy it to SD Card of my Android device. I know that there is a command dd but how to use it in a proper way to make a full image of the partition including also free space.
Thank you very much in advance!

Yes, dd command could be used simmilar to this:
open terminal, cd to external SD folder
dd if=/dev/block/block/bootdevice/by-name/userdata of=data.img
or if you know number of partition
dd if=/dev/block/mmcblk0p18 of=data.img (p18 is on Huawei LDN, image size is that same as partition size 16GB/32GB/64GB..etc, so for bigger then 32GB need to use NTFS sdcard or exFAT sdcard and TWRP also has to support NTFS or exFAT).
Or edit etc/*.fstab and repack twrp. You can back up files from /data for now (as ext4 or f2fs). Just add line to back up full image of /data (as emmc).
If /data has ext4 filesystem it can easilly mount/unpack/scan/rip image. But if /data has f2fs ... got not cure.
Example:
/data f2fs /dev/block/bootdevice/by-name/userdata flags=length=-16384;backup=1;settingsstorage;encryptable=footer;
/data_image emmc /dev/block/mmcblk0p55 flags=display="Data Image";backup=1;flashimg;

adeii said:
Yes, dd command could be used simmilar to this:
open terminal, cd to external SD folder
dd if=/dev/block/block/bootdevice/by-name/userdata of=data.img
or if you know number of partition
dd if=/dev/block/mmcblk0p18 of=data.img (p18 is on Huawei LDN, image size is that same as partition size 16GB/32GB/64GB..etc, so for bigger then 32GB need to use NTFS sdcard or exFAT sdcard and TWRP also has to support NTFS or exFAT).
Or edit etc/*.fstab and repack twrp. You can back up files from /data for now (as ext4 or f2fs). Just add line to back up full image of /data (as emmc).
If /data has ext4 filesystem it can easilly mount/unpack/scan/rip image. But if /data has f2fs ... got not cure.
Example:
/data f2fs /dev/block/bootdevice/by-name/userdata flags=length=-16384;backup=1;settingsstorage;encryptable=footer;
/data_image emmc /dev/block/mmcblk0p55 flags=display="Data Image";backup=1;flashimg;
Click to expand...
Click to collapse
Thank you very much for you point to point reply!
Finally, I choose to use that option with some modifications because vfat doesn't support files larger than 4GB.
Code:
dd if=/dev/block/bootdevice/by-name/userdata conv=noerror,sync bs=100M | gzip -c | split -b1000000000 - mybackup.img.gz

I have mounted this *.img partition using OSFMount for Windows. But after the scanning process (I was using R-Studio that supports ext4 file system I found my deleted files in the tree structure /media/0/DCIM/Camera but all of the deleted files has 0 bytes size and have 2 flags: deleted, wiped.
I couldn't understand how that happened. I mean I didn't use my phone after deleting files at all. I also mounted this *.img as raw disk in Active Undelete but the result is actually the same all of the deleted files have 0 bytes file size.
Is that a bug of the program? Or I have made an image using wrong command? Or Android 9 actually wiping files after deletion?
The files have been accidentally deleted by AirDroid-web app but I don't think so that this app is wiping deleted files it doesn't make sense...

RaTr said:
Thank you very much for you point to point reply!
Click to expand...
Click to collapse
You are welcome. Thank you are for note about 4GB file size limit on vfat/fat32, will save us from a lot of headache.
---------- Post added at 10:03 AM ---------- Previous post was at 09:49 AM ----------
RaTr said:
actually the same all of the deleted files have 0 bytes file size.
Click to expand...
Click to collapse
Maybe to try DiskDigger on phone if it is rooted to scan internal sd?
PhotoRec for Windows/Linux: https://www.cgsecurity.org/wiki/PhotoRec_Step_By_Step
There are few programs to try on your image on GNU/Linux like extundelete, ext4magic, AnalyzeEXT, ext3grep ...
Source: https://askubuntu.com/questions/217606/undelete-files-on-ext4

I am trying to use ext4magic to recover deleted files. But I need a copy of the journal when I am trying to use command
Code:
debugfs -R "dump <8> /var/tmp/home.journal" /dev/mapper/home
I see that Team win terminal do not have this command how to add it or how to make a copy of the journal of my ext4 partition where I am trying to recover my files.

adeii said:
Maybe to try DiskDigger on phone if it is rooted to scan internal sd?
Click to expand...
Click to collapse
I have tried to use DiskDigger. When I am putting a filter to show only deleted files it doesn't show anything. Which is pretty strange.
adeii said:
There are few programs to try on your image on GNU/Linux like extundelete, ext4magic, AnalyzeEXT, ext3grep ...
Source: https://askubuntu.com/questions/217606/undelete-files-on-ext4
Click to expand...
Click to collapse
Next program that I have tried was TestDisk but looks like it doesn´t support ext4 file system.
Thank you for the advice about PhotoRec. It has support of ext4 system. But it won't help. So, there are still some options. I will try to use extundelete as the next one.

If you have an image of EXT4, then you can use 7-Zip Archiver to read all the files inside it.

jwoegerbauer said:
If you have an image of EXT4, then you can use 7-Zip Archiver to read all the files inside it.
Click to expand...
Click to collapse
7-Zip will show deleted files also?..

I have tried 2 more utilities:
1. ext4magic without external journal file. It has done the job but I couldn't find any files that I need.
2. extundelete that program restored less files and also no files that I want to recover.
One more strange thing:
I have installed R-Studio and opened my image there. I fount full list of my deleted files, but all of the records of my deleted files have 2 flags: deleted, wiped and it shows me that the size of that specific files is 0 bytes.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
I have checked other files from different dates, they can be recovered, there is no flag wiped and also I can see the size, in some of them there is a flag cross-link, but I think it is normal, that means part of that file is already overwritten by another one.

RaTr said:
I have tried 2 more utilities:
1. ext4magic without external journal file. It has done the job but I couldn't find any files that I need.
2. extundelete that program restored less files and also no files that I want to recover.
One more strange thing:
I have installed R-Studio and opened my image there. I fount full list of my deleted files, but all of the records of my deleted files have 2 flags: deleted, wiped and it shows me that the size of that specific files is 0 bytes.
I have checked other files from different dates, they can be recovered, there is no flag wiped and also I can see the size, in some of them there is a flag cross-link, but I think it is normal, that means part of that file is already overwritten by another one.
Click to expand...
Click to collapse
I am stuck in the same situation bro
See it here I described the issue very similar to yours. Any luck in trying to recover that `ext4` data

RaTr said:
I found my deleted files in the tree structure /media/0/DCIM/Camera but all of the deleted files has 0 bytes size and have 2 flags: deleted, wiped.
Click to expand...
Click to collapse
expected.
emmc/ufs flash storage is handled different from hard disk drive. there is FTL controller with own firmware that is wear-leveling whole storage all the time. not to mention files are fragmented.
file system sends TRIM on each deletion of file. note the discard mount flag for userdata partition.
Android 4.3 Update Brings TRIM to All Nexus Devices
www.anandtech.com

Hi, I tried dd command, and it returned
Code:
dd: data.img: Read-only file system
But ./adb pull /dev/block/mmcblk0p57 57.img worked, and created a NDIF image.
Why dd did not work?
And which format of image would dd create?
Thanks.

you're trying to write into phones / rootdir. you cannot dump partition into phone itself. external MicroSD card or OTG pendrive is required. but you could redirect to stdout into remote file (note the quotes make the difference where > redirection is executed)
Code:
adb root
adb shell 'dd if=/dev/block/mmcblk0p57 bs=1m status=none' > data.img
open data.img file with HxD editor and have a look into first bytes. search for magic 53 ef at offset 0x438 to confirm it's ext4 image.
dd is useful in case no usb connection available (topic of thread). the result is same as adb pull. you can increase speed with block size (bs= default 512 bytes) up to 1 MB.
Note: on FDE encrypted phone one can't pull userdata directly. instead pull whatever is mounted /data (like /dev/block/dm-0)

aIecxs said:
you're trying to write into phones / rootdir. you cannot dump partition into phone itself. external MicroSD card or OTG pendrive is required. but you could redirect to stdout into remote file (note the quotes make the difference where > redirection is executed)
Code:
adb root
adb shell 'dd if=/dev/block/mmcblk0p57 bs=1m status=none' > data.img
open data.img file with HxD editor and have a look into first bytes. search for magic 53 ef at offset 0x438 to confirm it's ext4 image.
dd is useful in case no usb connection available (topic of thread). the result is same as adb pull. you can increase speed with block size (bs= default 512 bytes) up to 1 MB.
Note: on FDE encrypted phone one can't pull userdata directly. instead pull whatever is mounted /data (like /dev/block/dm-0)
Click to expand...
Click to collapse
Thanks for your reply.
What would be the differences between
adb shell 'dd if=/dev/block/mmcblk0p57 bs=1m status=none' > data.img
and
the method described in this message: https://stackoverflow.com/a/41214172 ?
Thanks.

streaming over netcat avoids unwanted characters using stty raw. on macOS probably result is no difference (after unpacking gzip).
you don't need this as you wrote adb pull worked (which is the easiest method)

aIecxs said:
streaming over netcat avoids unwanted characters using stty raw. on macOS probably result is no difference (after unpacking gzip).
you don't need this as you wrote adb pull worked (which is the easiest method)
Click to expand...
Click to collapse
Thanks.
I searched Hex in 57dd.img created by adb shell 'dd if=/dev/block/mmcblk0p57 bs=1m status=none' > 57dd.img.
It showed
Is the 53EF on line 1080 in the image above is the one you mentioned "at offset 0x438"?

right, that is ext4 magic at offset/byte hex (0x438)16 = (1080)10 dec

I have a slightly different but related question /problem. My apologies if this is not the right place to post.
On my Samsung A10e, TWRP (and other recoveries) gives me a tarfork 255 error when trying to backup userdata. Normally this should be 32GB in size from Samsung specs.
I have used two alternatives :
* adb pull /dev/block/by-name/userdata data.img which creates a 26G file on my linux PC, that I can mount and inspect. When I run filesystem check it throws out errors, probably due to some of the data being encrypted - I am running AOSP Android 11 gsi. Perhaps the same errors that prevents TWRP from working ?
* alternatively I have put in a clean 32GB SD card, then via adb shell run dd if=/dev/block/by-name/userdata of=/dev/block/mmcblk1p1 to copy the full userdata partition over to the SD card. Once removed from the phone and put in a card reader, again this can be inspected on my linux PC, and gives the same filesystem check errors. I also ran dd if=/dev/external_sd of=data2.img on my linux PC to create a similar image file as adb pull but it is now the full 32GB that I would have intially expected.
So why the size difference between adb pull and dd ?? Does adb pull actually get everything - in other words if I try and restore with adb push will the phone recover to previous state and boot ?
I was hoping to then reduce the size of my data copy to 16GB since on my phone I am only using 12GB of the 32GB, but file errors are preventing me at the moment.
I was thinking about wiping data and then with arm32 parted and adb shell creating a 16GB userdata partition and an additional 16GB user shadow partition - the latter only to be used locally via dd to do backup and restore and avoid TWRP errors.

that is very lightly due to encryption issues....esp Magisk is known to break encryption.
if you can decrypt at TWRP level and then proceed to backup user data via ADB shell to memory card that is your best bed and then wipe the partition and then restore your app data individually for apps that you need e.g. contacts db for contact an SMS. I strongly doubt if you will be able to restore that entire partition and boot to that original partition successfully.... it may have become what what we can call "encryption tainted"
excuse my typos

Related

How to boot UrukDroid from internal flash disk on Archos 70IT (Update: Uruk 0.6)

Install Uruk 0.3 on second internal flash disk of Archos
UPDATE
At the last end of this guide you will find the steps necessary to upgrade to Uruk 0.6 from Uruk 0.3 or 0.4.
Near the end of this guide you will find the steps necessary to upgrade to Uruk 0.4.2 from Uruk 0.3 or to install it for the first time.
Please note.
If you are upgrading from Uruck 0.3 to 0.4.2 and installed google market hack before upgrade, after upgrade the market will be broken. To solve the problem reed the last step of this guide.
I've manage to boot from the second partition of the second internal flash of 8GB (/dev/block/mmcblk1p2) of my Archos 70IT Urukdroid vers 03 prepared by $aur0n on this post.
Thanks $aur0n for your awesome work.
It may work for other archos generation 8 too, except Archos 70 IT 250GB (i think that model doesn't have a second internal flash disk to boot from for SDE, but the owners can do it creating the 2 needed partitions on the HDD).
I've done it because:
- my micro sdcard is slow compared to internal flash
- i can mount correctly micro sdcard and second internal flash disc in Windows and linux by connecting Archos via USB and
- my sdcard is free. I can boot without sdcard in, take off from archos every time i want and upload files from a card reader or connecting the archos 70 via usb.
If you want to try it, be sure on what you are doing (linux knowledge is needed).
Try it on your own risk.
I don't have any responsibility if you brick your device (actually is hard to brick it following the guide, but pay attention please).
So if you are sure, read carefully this post and ask before if something is not clear enough for you.
I will try to answer as soon as possible (I'm actually a bit busy :-()
First of all install SDE, if you haven't already done (you can get information about it and download the SDE firmware from archos web page archos web page
Attention: Doing that You void your warranty...
Here the Archos notes:
Important notices to be acknowledged before downloading and installing the SDE firmware:
Once the SDE firmware is installed on a device, this device will be watermarked and ARCHOS will be able to detect that this firmware has been installed once.
Installing the SDE firmware is considered by ARCHOS as a voiding of the warranty and ARCHOS declines all liability and responsibility for any issues resulting from the installation of this SDE firmware.
ARCHOS strongly advises that only experts in embedded software development should install this firmware.
This firmware is provided "as is" and is not supported by ARCHOS.
Before following the steps required to install Uruk 0.3 some clarifications:
What you need to have:
- Archos 70 IT with terminal and SDE installed.
- Linux machine (nativly, visualized or LiveCD)
- Optionally Windows PC
Storage map of Archos 70 IT:
a) The first internal flash disk is of approximately 500MB (device /dev/block/mmcblk0) which is used by stock archos firmware and not changed by this guide.
Pay great attention playing with it, you may brick forever your Archos.
This flash disk have 4 partition and the block devices, mountpoints, filesystems type and size are as the following:
The first devices is "/dev/block/mmcblk0p1", mountpoint "/mnt/rawfs", type of filesystem "rawfs", size 32MB
The second devices is "/dev/block/mmcblk0p2", mountpoint "/mnt/system", type of filesystem "ext3", size 119MB
The third devices is "/dev/block/mmcblk0p3", mountpoint "/cache", type of filesystem "ext3", size 30MB
The fourth devices is "/dev/block/mmcblk0p4", mountpoint "/data" (mountpoint only by archos firmware), type of filesystem "ext3", size 300MB
b) The second internal flash disk is of approximately 7,5GB (device /dev/block/mmcblk1) which is used by this guide to boot SDE from and to accommodate the /data mountpoint (not any more on the "/dev/block/mmcblk0p4").
By stock archos firmware it has 1 partition (device /dev/block/mmcblk1p1), mountpoint "/mnt/storage", type of filesystem "fat32", size 7,5GB
After Uruk 0.3 installation it will have 3 partitions and the block devices, mountpoints, filesystems type and size will be as the following:
The first devices will be "/dev/block/mmcblk1p1", mountpoint "/mnt/storage", type of filesystem "fat32", size 5,5GB
The second devices will be "/dev/block/mmcblk1p2", mountpoint root "/", type of filesystem "ext4", size 500MB
The third devices will be "/dev/block/mmcblk1p3", mountpoint "/data", type of filesystem "ext4", size 1GB
C) The sdcard on device /dev/block/mmcblk2. On my case it have 1 partition (device /dev/block/mmcblk2p1), mountpoint "/mnt/storage/sdcard", type of filesystem "fat32".
Let's go:
The first step to do is to backup everything from your second internal flash disk (as above, it has 1 partition formated in fat32, 7,5GB capacity), just for backup purpose.
The simplest way is to connect your archos via usb to your linux box and copy directly that directory to a new directory on your linux with the default graphical file explorer of your distribution.
In my case it mounts automatically to /media/A70S (device is /dev/sdb1):
/dev/sdb1 on /media/A70S type vfat (rw,nosuid,nodev,uhelper=hal,uid=1000,utf8,shortname=mixed,flush)
Click to expand...
Click to collapse
If doesn't mount automatically in your case, find it using "dmesg" command on a terminal after connection complete and mount it manually.
Or you can copy it on your Windows PC (connect Archos via usb, drive mount automatically to A70S).
After backup, don't disconnect your Archos from linux. You have to resize the mounted Archos disk form 7,5GB to 5,5GB.
The easiest way is to do it graphically with your distribution partition manager utility.
First umount it by right click->umount, then resize it letting on the right side of the disk 1,5GB free space.
Create other 2 partition on that free space, first of 500MB and the other with the remaining space approx. 960MB.
Then apply the changes on the partition manager and you will have now 3 partition on the second internal flash disk of your Archos.
The first one with 5,5GB and formated on fat32, the second one 500MB not formated and the third partition of 960MB not formated.
On my case the devices are respectively /dev/sdb1, /dev/sdb2 and /dev/sdb3.
The next step is to format the second and third partition with ext4 filesystems without huge option (as from $aur0n post) on a linux terminal as root:
mkfs.ext4 -O ^huge_file /dev/sdb2
mkfs.ext4 -O ^huge_file /dev/sdb3
Click to expand...
Click to collapse
When finished, just remove safely archos from your linux box.
From the archos open a terminal and just type:
ls /dev/block/mmcblk1*
Click to expand...
Click to collapse
The result will be:
/dev/block/mmcblk1 /dev/block/mmcblk1p1 /dev/block/mmcblk1p2 /dev/block/mmcblk1p3
Click to expand...
Click to collapse
The second partition (/dev/block/mmcblk1p2) will be your new rootfs
and the third one (/dev/block/mmcblk1p3) your new application area (/data).
On this step you are going to copy all the staff on /data (device /dev/block/mmcblk0p4 mounted on /data)
to the third partition of the second internal flash (/dev/block/mmcblk1p3).
Mount the third partition first:
mkdir /tmp/data
mount /dev/block/mmcblk1p3 /tmp/data
Click to expand...
Click to collapse
and copy:
cp -rp /data/* /tmp/data
sync
umount /tmp/data
Click to expand...
Click to collapse
If you get any problems on coping (permissions) then the only way to do it correctly is to use "tar" to make a archive of data to a file on the first partition of the second internal flash disk (/dev/block/mmcblk1p1 mounted on /mnt/storage) like:
tar -cfvz /mnt/storage/data_app.tar.gz /data/
Click to expand...
Click to collapse
and then connect archos via usb to your linux computer (your three partition of the internal flash now will mount in automatic, let say /media/A70S, /media/disk1 and /media/disk2 from the devices /dev/sdb1, /dev/sdb2 and /dev/sdb3)
Now you have to extract the previous tar file (data_app.tar.gz) to the /media/disk2 (the third partition of archos internal flash disk mounted supposedly at /media/disk2):
cd /media/disk2
tar -zvxf /media/disk1/data_app.tar.gz
sync
umount /media/disk2
Click to expand...
Click to collapse
The next step, download the Uruk 0.3 version of rootfs (rootfs.tar.gz) from this link, and kernel image (zImage) from from this link on the /tmp directory of your linux box. I want to remember that this files are prepared and postet from $aur0n on this post.
If you are still connected via usb with your archos (if not, connect it),extract the rootfs (rootfs.tar.gz) directly on the mount point of the second flash partition (as above in my case is /dev/sdb2 mounted on /media/disk1) on linux:
cd /media/disk1
tar -zvxf /tmp/rootfs.tar.gz
Click to expand...
Click to collapse
Change the following lines of the init.rc file (mount point of root filesystem):
mount ext3 /dev/block/mmcblk0p4 /data noatime nosuid
# Uncomment this
# mount ext4 /dev/block/mmcblk2p2 /data noatime
with those:
#mount ext3 /dev/block/mmcblk0p4 /data noatime nosuid
# Uncomment this
mount ext4 /dev/block/mmcblk1p3 /data noatime
Change the line on the file/media/disk1/syste/etc/vold.fsatb:
#dev_mount_lun volume_sdcard /mnt/storage/sdcard 3 /devices/platform/usb_mass_storage/lun1 /class/block/mmcblk2p3
with that:
dev_mount_lun volume_sdcard /mnt/storage/sdcard auto /devices/platform/usb_mass_storage/lun1 /class/block/mmcblk2
sync
umount /media/disk1
Click to expand...
Click to collapse
and remove safely archos from the linux box and shutdown Archos.
Download the initramfs.cpio.gz_Uruk_0.3.zip from here (or from the attachment on the end of this post) and unzip it on the /tmp folder of you linux box.
Flash the initramfs.cpio.gz and zImage (remember , you downloaded zImage on the step 4 and placed it already on /tmp) on SDE environment doing:
- While power on your archos, press the "Volume -" button
- Go to "Recovery System",then "Developer Edition Menu"
- Select "Flash kernel and Initramfs".
- Attach your Archos via USB to linux computer. Archos will automatically mount, in my case is A70S_REC mounted on /media/A70S_REC/. Copy the files (initramfs.cpio.gz and zImage) from /tmp folder.
cp initramfs.cpio.gz zImage /media/A70S_REC/
Click to expand...
Click to collapse
Disconnect safely archos, then push "Ok", power and the archos will reboot.
- Press the "Volume -" to boot to the ""Boot Menu" and choose "Developer Edition" or just while booting press both "Volume -" and "Volume +" to boot directly to the "Developer Edition".
You are done.
Enjoy booting from internal flash (SDE edition).
Update: Uruk 0.4.2
There are 2 possibilities:
- You want to upgrade from Uruk 0.3
- Install Uruk 0.4.2 for the first time (You are on stock archos firmware).
Let's begin with the upgrade from Uruk 0.3 to Uruk 0.4.2
First of all download the Uruk 0.4.2 rootfs prepared from $aur0n UrukDroid-0.4.2-rootfs.rar on your linux box.
Download also UrukDroid-0.4.2-kernel.rar from here (or from the attachment on the end of this guide).
It's is $aur0n's one with the modifications to boot and mount /data from second internal flash.
Copy the above 2 files on the folder /tmp/archos of your linux machine. In my case is the 2 downloaded files are
under /home/shklifo/Download folder:
mkdir /tmp/archos
cd /tmp/archos
cp /home/shklifo/Download/UrukDroid-0.4.2-kernel.rar /home/shklifo/Download/UrukDroid-0.4.2-rootfs.rar .
Click to expand...
Click to collapse
Unrar both of them (if you don't have rar utility, just install it), giving the command:
rar x UrukDroid-0.4.2-kernel.rar
rar x UrukDroid-0.4.2-rootfs.rar
Click to expand...
Click to collapse
When the unrar process goes ok you will see the following on terminal (example of UrukDroid-0.4.2-kernel.rar):
[email protected]:/tmp/archos# rar x UrukDroid-0.4.2-kernel.rar
RAR 3.90 beta 2 Copyright (c) 1993-2009 Alexander Roshal 3 Jun 2009
Shareware version Type RAR -? for help
Extracting from UrukDroid-0.4.2-kernel.rar
Extracting zImage OK
Extracting initramfs.cpio.gz OK
All OK
Click to expand...
Click to collapse
After that you will have the following files on /tmp/archos:
[email protected]:/tmp/archos# ls -lrt
totale 245668
-rw-r--r-- 1 root root 0 2011-01-17 12:10 UrukDroid-copy_data.cmd
-rw-r--r-- 1 root root 120854073 2011-01-21 17:34 UrukDroid-rootfs-upgrade.tgz
-rwxr-xr-x 1 root root 2255648 2011-01-21 17:57 zImage
-rw-r--r-- 1 root root 1733826 2011-01-22 10:26 initramfs.cpio.gz
-rw-r--r-- 1 root root 119128315 2011-01-22 10:26 UrukDroid-0.4.2-rootfs.rar
-rw-r--r-- 1 root root 3985013 2011-01-22 10:36 UrukDroid-0.4.2-kernel.rar
Click to expand...
Click to collapse
You are upgrading and you have all the applications on second internal flash disk already, so just remove the UrukDroid-copy_data.cmd, you don't need it:
rm UrukDroid-copy_data.cmd
Click to expand...
Click to collapse
Now you have to copy UrukDroid-rootfs-upgrade.tgz to the rootfs of the archos (second partition of the second internal flash disk mounted on / of type ext4 with 500MB space).
To do that just connect archos via usb to your linux box and all the tree partition of archos second internal flash will be mounted automatically.
To verify where those partition are mounted just type:
mount
Click to expand...
Click to collapse
on a linux terminal and on my case is as following:
[email protected]:/tmp/archos# mount
...
/dev/sdb1 on /media/A70S type vfat (rw,nosuid,nodev,uhelper=hal,uid=1000,utf8,shortname=mixed,flush)
/dev/sdb2 on /media/disk type ext4 (rw,nosuid,nodev,uhelper=hal)
/dev/sdb3 on /media/disk-1 type ext4 (rw,nosuid,nodev,uhelper=hal)
/dev/sdc1 on /media/disk-2 type vfat (rw,nosuid,nodev,uhelper=hal,uid=1000,utf8,shortname=mixed,flush)
Click to expand...
Click to collapse
and "df -m" like:
[email protected]:/tmp/archos# df -m
/dev/sdb1 5622 2897 2725 52% /media/A70S
/dev/sdb2 485 244 216 53% /media/disk
/dev/sdb3 973 268 656 29% /media/disk-1
/dev/sdc1 15266 1157 14110 8% /media/disk-2
Click to expand...
Click to collapse
So in my case the second partition of the second internal archos flash disk of 485MB is:
/dev/sdb2 485 244 216 53% /media/disk
Click to expand...
Click to collapse
mounted on /media/disk
Then just copy the UrukDroid-rootfs-upgrade.tgz file on the second partition of the second internal archos flash disk, like in my case:
cp /tmp/archos/UrukDroid-rootfs-upgrade.tgz /media/disk/
Click to expand...
Click to collapse
Safely disconect archos from the linux box and shutdown completely your archos.
Now you have to flash initramfs (initramfs.cpio.gz) and kernel (zImage) to your archos from "Recovery Menu" (you know already how to do it),
or if you forget it just do the following:
- While power on your archos, press the "Volume -" button
- Go to "Recovery System",then "Developer Edition Menu"
- Select "Flash kernel and Initramfs".
- Attach your Archos via USB to linux computer. Archos will automatically mount, in my case is A70S_REC mounted on /media/A70S_REC/. Copy the files (initramfs.cpio.gz and zImage) from /tmp/archos folder.
cp initramfs.cpio.gz zImage /media/A70S_REC/
Click to expand...
Click to collapse
Disconnect safely archos, then push "Ok", power and the archos will reboot.
- Press the "Volume -" to boot to the ""Boot Menu" and choose "Developer Edition" or just while booting press both "Volume -" and "Volume +" to boot directly to the "Developer Edition".
You will see the UruckDroid 0.4 screen with "Initramfs: Loading ...." than Rootfs: Loading .... and finally you will see the Uruck Desktop.
Enjoy
Install Uruk 0.4.2 for the first time
For those who whant to install Uruk 0.4.2 for the first time (now it's simplier that Uruk 0.3) will do:
a) First backup, create the partitions and filesystems on the second internal flash disk of archos (step 1
and step 2 of the Uruk 0.3).
You don't need anymore step 3 (copy of /data folder), because Uruk 0.4.2 do it automatically.
b) Then following step by step the guide Let begin with the upgrade from Uruk 0.3 to Uruk 0.4.2, except removing UrukDroid-copy_data.cmd file, because you need it to copy automatically /data files.
When you are on the step "copy the UrukDroid-rootfs-upgrade.tgz file on the second partition of the second internal archos flash disk", you need to copy additionaly UrukDroid-copy_data.cmd like:
cp /tmp/archos/UrukDroid-rootfs-upgrade.tgz /media/disk/
cp /tmp/archos/UrukDroid-copy_data.cmd /media/disk/
Click to expand...
Click to collapse
Than follow till the end the guide Let begin with the upgrade from Uruk 0.3 to Uruk 0.4.2.
Enjoy
OPTIONAL: Install google market.
If you have already istalled google market (using gAppsInstaller for example), you have to uninstall it (market/vending) first.
Then download UrukDroid-0.4.2-GoogleMarket.zip and copy it on the root (/) filesystem of archos (see above on the upgrade section an do the same steps of copying UrukDroid-rootfs-upgrade.tgz to archos rootfs).
Reboot archos.
NOTE
If you are upgrading from 0.3 version to 0.4.2 and installed before the google market from kenyu73 like i did, then the market will be broken and doesn't work any more.
To get it back, you have to remove all the google applications from SDE (Uruk 0.4.2) including the kenyu73's installer (gAppsInstaller).
Then install the market as on the previuos step OPTIONAL: Install google market downloading the file UrukDroid-0.4.2-GoogleMarket.zip and following the instructions.
After rebooting archos on SDE, you need to fix it, because you can't access the whole market (missing some "protected applications" like copilot etc).
To fix just do the following steps as kenyu73 explain on his post :
Go to Settings-->Manage Applications-->All-->Market (Clear Cache then 'Force Stop', DO NOT clear data).
Setting-->Manage Applications-->All-->Google Services Framework (Clear data then 'Force Stop').
Reboot.
Click to expand...
Click to collapse
I've done it twice the fix step, and after that no problem anymore. All the google applications (downloaded from the fresh working market) are working correctly as before.
Update: How to upgrade to Uruk 0.6 from Uruk 0.3 or 0.4.2
There are 2 possibilities:
a) The first one is the simplest one.
Just download the $auron Uruk 0.6 UrukDroid_0.6-EasyInstall.rar posted on this post, extract it on your computer and delete the file initramfs.cpio.gz, because we don't need it.
Then download the file initramfs.cpio_Uruk_0.6.gz.rar in attachment on the end of this post and extract it on the same directory of your computer (this is the initramfs that you will flash on SDE prepared from $auron and can be found on the /root/ directory of $auron new rootfs UrukDroid-install.tgz).
Then boot Archos on stock Android and connect it to your linux box via USB. The root filesystem of Archos (/dev/block/mmcblk1p2 on Archos) will be mounted on some directory on linux automatically, just find it or manually mount it (it's the filesystem with 500MB space, to be sure just type "df -h" on a terminal).
With root on a linux terminal go to that directory (in my case was /media/Disk-1) and remove all the files there:
Code:
rm -rf *
Then copy the UrukDroid-install.tgz extracted before from UrukDroid_0.6-EasyInstall.rar on the above directory.
So, you will have only the file UrukDroid-install.tgz on your rootfs directory of Uruk.
Then disconect safely Archos from your linux box and flash initramfs.cpio.gz and zImage files on SDE (you know how to do that ...) and boot to SDE.
That is
Uruk 0.6 will automatically copy everything needed as you will see on the boot time.
You have to do a last thing to be able to mount automatically the sdcard on Uruk 6. Uncomment the sdcard line on the file /system/etc/vold.fsatb like:
Code:
dev_mount_lun volume_sdcard /mnt/storage/sdcard auto /devices/platform/usb_mass_storage/lun1 /class/block/mmcblk2
This is needed on the second method too (the one below).
Who want to install Uruk (version 0.6 in this case) for the first time on internal, must create and format the 2 partitions of the second internal flash disk (like on the beginning of this post described) and follow step by step the above method and at the end copy everything from the data partiotion (last partition of the first internal flash /dev/block/mmcblk0p4) to the third partition of the second flash disk (/dev/block/mmcblk1p3).
b) The second method is more complicated, but works also good.
You just install Uruk 0.6 to a sdcard like on this $auron post, than shutdown Archos, put the microsd card on a card reader connected to a linux PC and with root make a tar archive of the entire rootfs (root filesystem) of Uruk 0.6 (the second partition of the sdcard with 500MB of space on ext4 filesystem) to a tar file that you can put to the first partition of the sdcard (the fat partition of the sdcard).
Eject the sdcard and put on Archos. Turn on Archos and from a terminal on Uruk as root mount the second partition of the flash disk (/dev/block/mmcblk1p2) on a directory and just delete ("rm -rf") everything on there and then extract the tar archive there.
So, you just put everything from rootfs of the sdcard to internal flash, with correct permissions, timestamp, ownership etc.
Now just shudown Archos, take off the sdcard and boot.
This time it will Uruk 0.6 will boot from internal flash
Enjoy it
I wish I could understand more clearly how to do this with a fresh install...
This is what I am looking to do, using it on internal... but this might be a little too complicated for me.
What about 101?
Does this method applicable to Archos 101 model too?
If someone already have been tried it on 101, please reply with details here, if any troubles you have after installation or any changes need to be done.
Also I am curious about does anyone have tried to connect USB thumb drive to the tablet with modified rom and root access? Do we still have any issues with USB drive recognition?
Is this applicable for UrukDroid 4.1 and The Archos IT 35?
well great work but i dont know if i get it to work and Im a little bit confused -
is it writable in windows per media player (mtp) or per explorer or both (with ext-x driver)?
yura-a said:
Does this method applicable to Archos 101 model too?
If someone already have been tried it on 101, please reply with details here, if any troubles you have after installation or any changes need to be done.
Click to expand...
Click to collapse
Why not. The 101 model have the second internal flash (8 or 16GB) as the 70 S model have. To be sure just type mount and df -m on a terminal in Archos device and you will see the flash drive (/dev/block/mmcblk1p1) formated in fat32 and mounted on /mnt/storage.
I only changed the mounting point on the file init, init.rc and /system/etc/vold.fstab from $aur0n files to be able to boot SDE from the second internal flash disk and doesn't change anything else, configuration file of specific model included.
yura-a said:
Also I am curious about does anyone have tried to connect USB thumb drive to the tablet with modified rom and root access? Do we still have any issues with USB drive recognition?
Click to expand...
Click to collapse
I'm still excpecting my host cable from Hong-Kong and can't try that, but i think will not be a problem.
good work
thanks
svennimann said:
Is this applicable for UrukDroid 4.1 and The Archos IT 35?
Click to expand...
Click to collapse
I do not own your device (it is a Archos 32 IT?), but if is that model, it got a 8GB internal flash like archos 70 IT. The firmware is the same for all archos generation 8 devices (with same configuration files change), but i haven't change them (and $aur0n too i think, but he can answer himself).
So just try it, if you have no problem of understanding all the steps on the first post. You can't break anything. And if it will not work (worse case) or have other problems you just have SDE installed (you can remove it if you want) and 2 more partition on the internal flash disk with some files on them.
You can just delete the partitions and risize (increment) the first partition as from stock. In all situation we are able to boot to stock firmware.
I only change the mountpoints as i wrote in the previous posts on the files init, init.rc and vold.fstab from uruk 0.3.
So mine and $auron solution changed only on the boot partition (mine is booting form the second partition of the internal flash disk, him from the second partition of sdcard) and the application data partition (mine on the third partition of the internal the flash, him on the third partition of the sdcard). All the other files are from him (thanks $aur0n).
I've not installed yet the 0.4.1, i got little free time actually and of the market problem (if i install the 0.4.1, i must uninstall the market on stock firmware and will be not able to access it from original/stock firmware).
But if i decide to install it, i will report here.
svennimann said:
well great work but i dont know if i get it to work and Im a little bit confused -
is it writable in windows per media player (mtp) or per explorer or both (with ext-x driver)?
Click to expand...
Click to collapse
Thanks, as i say above you don't loose anything trying to install it, only time
So, if i understand well your question, on my archos i'm able to access the first partition of the flash disk (it's a fat32 as from stock, only risezed in 5,5 GB) on my windows XP PC by usb connection to archos.
The second (boot partition 500MB) and the third (data application area of 1GB) partitions of internal flash disk are ext4 formated (stock ext3) and can't be mount on a windows PC, and for me have any sense mounting them on a PC.
The sdcard is accesible via usb connection (archos to PC) or via card reader. If you format it fat32 is in r/w mode (as i've done), ext3 or ext4 in readonly mode i think (not yet tried), because actually isn't out a driver to be able to write a linux partition on Windows.
From Ubuntu (connecting archos via usb) i can mount all in r/w mode (all the 3 partitions of the internal flash disk and sdcard too).
Later i will post some picture/command output (mount,ls) from Ubuntu.
In attachment a picture of the flash disk (A70S E: ) and sdcard (Disco rimovibile F: ) on my Windows XP macchine.
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Just a suggestion.. Please be consistent with your instructions, 1 step your instructions are for linux and the next step would be for archos.
It's really hard to follow what needs to be done or how it should be done properly, considering you're messing around with the internal storage there's bigger chance of bricking your device.
I appreciate all your hard work and contributions here, it's just that it's not that user friendly.
GrandStar said:
Just a suggestion.. Please be consistent with your instructions, 1 step your instructions are for linux and the next step would be for archos.
Click to expand...
Click to collapse
Just to be clear, from archos terminal you have to do only 1 thing, copy or tar the "/data" mountpoint/directory, because this is the 4-th partition of the first internal flash disk (/dev/block/mmcblk0p4) and it can't be mounted on linux via usb connection.
All the other steps are from linux (the first step, you can do it from Windows too).
It's really hard to follow what needs to be done or how it should be done properly, considering you're messing around with the internal storage there's bigger chance of bricking your device.
Click to expand...
Click to collapse
There are 2 internal flash disk in Archos, /dev/block/mmcblk0 of 500MB (used by archos architecture and nobody is touching this flash disk, it's dangerous and you may brick your device) and /dev/block/mmcblk1 of 8GB which is used by the this guide to boot SDE from. So, if you are able to understand what you are doing and don't touch the first flash disk, than nothing can happens.
I appreciate all your hard work and contributions here, it's just that it's not that user friendly.
Click to expand...
Click to collapse
With that i'm in line with your thoughs, thanks. I will try to do it more simple and understandable.
I've followed all the instructions exactly. I'm good with linux, so it wasn't very hard, but when I booted into the Developer Edition at the end, I was at the Initial Setup Screen, like it didn't mount the /data partition. Also, I can't get ES to show the file system, so it doesn't seem to be rooted. Any ideas what's going on?
EDIT: You have a typo in the init.rc the change should be to mmcblk1p3, not mmcblk1p2.
EDIT: Another typo: "dev_mount_lun volume_sdcard /mnt/storage/sdcard auto /devices/platform/usb_mass_storage/lun1 /class/block/mmcblk1" should be mmcblk2, not 1.
Now my data is there, and I can mount SD cards, but I still can't connect to a computer with a USB cable.
EDIT: All Fixed. I flashed a new kernel from http://forum.xda-developers.com/showthread.php?t=897877 and now have USB Storage working. I used the zImage from ardatdat's kernel with your initramfs.cpio.gz and the changes I listed above. Everything seems to work perfectly, and it's way faster than it was before. I was using Ardatdat's full kernel and booting from internal memory before. When I rotated the screen it used to take almost 10 seconds to update all the icons on the home screen. Now it takes less than 2-3 seconds to update. Great work on the EXT4 conversion! If you'll permit me, I'm going to write up a guide that incorporates my experience, and of course give you full credit.
Update: Just updated to UrukDroid 0.4.1. Needed a little more customization, but usb storage worked with the default 0.4.1 kernel instead of needing ardatdat's kernel. Currently testing to see which is better. Uruk says it's kernel has usb charging enabled, a very exciting possibility, but I kind of doubt it works on the A101IT.
msticninja said:
EDIT: You have a typo in the init.rc the change should be to mmcblk1p3, not mmcblk1p2.
EDIT: Another typo: "dev_mount_lun volume_sdcard /mnt/storage/sdcard auto /devices/platform/usb_mass_storage/lun1 /class/block/mmcblk1" should be mmcblk2, not 1.
Now my data is there, and I can mount SD cards, but I still can't connect to a computer with a USB cable.
EDIT: All Fixed. I flashed a new kernel from http://forum.xda-developers.com/showthread.php?t=897877 and now have USB Storage working. I used the zImage from ardatdat's kernel with your initramfs.cpio.gz and the changes I listed above. Everything seems to work perfectly, and it's way faster than it was before. I was using Ardatdat's full kernel and booting from internal memory before. When I rotated the screen it used to take almost 10 seconds to update all the icons on the home screen. Now it takes less than 2-3 seconds to update. Great work on the EXT4 conversion! If you'll permit me, I'm going to write up a guide that incorporates my experience, and of course give you full credit.
Update: Just updated to UrukDroid 0.4.1. Needed a little more customization, but usb storage worked with the default 0.4.1 kernel instead of needing ardatdat's kernel. Currently testing to see which is better. Uruk says it's kernel has usb charging enabled, a very exciting possibility, but I kind of doubt it works on the A101IT.
Click to expand...
Click to collapse
Thanks for the corrections (you pay the needed attention), but i just modified the first post radically (easier).
Sure, you can do your own thread with your experience on the installation.
I will install Uruk 0.4.1 too, and update the first post.
WORKING
I had to add a new line into the init.rc file, but afterwards I was able to get Uruk 0.4.1 to boot internal
***mount ext4 /dev/block/mmcblk1p2 / noatime*** - I don't htink you have this in your steps...
After I did this, it works. I also am able to see both the internal and external storage in windows.
I didn't know if you need that line or it was left out of your steps process. All I did to get this to work on an existing 0.4.1 was:
1. Move the data off the internal inside windows to a saved directory on my PC.
2. Partition the 3 partitions like you describe on the internal and formated as you describe...
3. Mount the partitions inside my VMplayer Ubuntu sdb2, sdb3, sdc2, and sdc3 (sdb was the internal formated like you describe and sdc was my 16 0.4.1 SD card fromatted using uruk already)
Su terminal CODE:
$su
***password
#
#cd
#cd /tmp
#mkdir sdb2
#mkdir sdb3
#mkdir sdc2
#mkdir sdc3
#mount /dev/sdb2 /tmp/sdb2
#mount /dev/sdb2 /tmp/sdb3
#mount /dev/sdb2 /tmp/sdc2
#mount /dev/sdb2 /tmp/sdc3
4. Copy through terminal everything from sdc2 --> sdb2 using below code and Copy through terminal everything from sdc3 --> sdb3 using below code
**CODE I used:
#cp -rp /tmp/sdc2/* /tmp/sdb2
#sync
#cp -rp /tmp/sdc3/* /tmp/sdb3
#sync
6. Add in the lines inti init.rc to mount the sdb2, and the sdb3 instead of sdc2 and sdc3
mount ext4 /dev/block/mmcblk1p2 / noatime
mount ext4 /dev/block/mmcblk1p3 /data noatime
7. Add the line into tmp/sdb2/system/etc/vold.fsatb (Which is where I mounted that..)
dev_mount_lun volume_sdcard /mnt/storage/sdcard auto /devices/platform/usb_mass_storage/lun1 /class/block/mmcblk2
**I believe in 0.4.1 it is already like this, so i really made no changes to vold.fsatb....***
Unmounted all 4 I had mounted into /tmp using terminal ubuntu
CODE (I was already inside cd /tmp/sdb2 and i had edited the init.rc and saved it):
#sync
#cd..
#umount /tmp/sdb2
#umount /tmp/sdb3
#umount /tmp/sdc2
#umount /tmp/sdc3
EDIT: after this step, you will need to mount the Archos back into Windows, and copy the files you saved into a folder on your windows PC back into the Internal Fat32 storage. This was why you backed it up in the first place.... You might have to reboot and boot into your stock OS to get the internal to mount back into Windows, i did...
Reboot and go into the developer menu
Reflashed your initramfs and Uruk 0.4.1 Zimage and booted to developers edition...
***Remember this will only work if you have a preexisting 0.4.1 on an SD card where it is formatted with #1 fat32 for dtorage #2 500Mb and #3 1G and it already has been working using $auron's method.
BIG thanks to $aron and shklifo and msticninja... I am very happy using my internal memory to boot with instead of the SD card. i will prob keep the SD card I have and use it whenever I need to boot to SD and just get a different one for Videos and Music.
JW
sublimejosh2000 said:
I had to add a new line into the init.rc file, but afterwards I was able to get Uruk 0.4.1 to boot internal
***mount ext4 /dev/block/mmcblk1p2 / noatime*** - I don't htink you have this in your steps...
After I did this, it works. I also am able to see both the internal and external storage in windows.
I didn't know if you need that line or it was left out of your steps process.
JW
Click to expand...
Click to collapse
I really appreciate your feedback.
But you don't need to add the line:
Code:
mount ext4 /dev/block/mmcblk1p2 / noatime
on the file init.rc, because it is present on the init file included on initramfs.cpio.gz.
If you extract the initramfs.cpio.gz attached on my first post with this command on a shell:
Code:
gunzip initramfs.cpio.gz && cpio -i -d -H newc -F initramfs.cpio --no-absolute-filename
You will find the following line:
Code:
$MOUNT -t ext4 -o noatime,errors=continue /dev/mmcblk1p2 /new-root
To upgrade to $aur0n 0.4.2 now it's really simple.
I'm preparing the new initramfs.cpio.gz. And putting the new rootfs of 0.4.2 on the rootfs of our archos (just to remember it is on the second partition of the second internal disk on device /dev/block/mmcblk1p2 mountet on /) and flashing the new initramfs.cpio.gz and zimage, when booting up on "Developer Edition" it will upgrade automatically.
Is there a reason why we want to be on 0.4.2?
I am not having problems with Market, is there other benifits of this update?
JW
BTW: Thanks for this halp on getting to internal.. I am not sure why we wanted to not do this in the first place.. I guess because some SD cards are faster, mine is working pretty fast and I think the internal is at least class 6
sublimejosh2000 said:
Is there a reason why we want to be on 0.4.2?
I am not having problems with Market, is there other benifits of this update?
JW
BTW: Thanks for this halp on getting to internal.. I am not sure why we wanted to not do this in the first place.. I guess because some SD cards are faster, mine is working pretty fast and I think the internal is at least class 6
Click to expand...
Click to collapse
Just see on the $aur0n post about the new version log change. We will have upgraded module, new wifi, more services like samba sshd etc.
I to havn't any speed problem with internal flash. It is fast enough (with dd copying speed test got till 16 mbit/s write speed) on the internal flash and it is way faster than my sdcard class 4.
0.4.2
Well.. I already reverted back to the origional wifi config file using terminal, and my Market is good to go.
I'm not sure that there are any major differences between 0.4.1 --> 0.4.2
If I am wrong, i think it requires to uninstall all google apps to make that upgrade, which I don't think I need to do.
Am I wrong?
sublimejosh2000 said:
Well.. I already reverted back to the origional wifi config file using terminal, and my Market is good to go.
I'm not sure that there are any major differences between 0.4.1 --> 0.4.2
If I am wrong, i think it requires to uninstall all google apps to make that upgrade, which I don't think I need to do.
Am I wrong?
Click to expand...
Click to collapse
From $auron post on Uruk doesn't seem to be difference between 0.4.1 and 0.4.2, except google applications. With the 0.4.2 you can install the google staff separatly with UrukDroid-0.4.2-GoogleMarket.rar. If you have those apps allready on your 0.4.1 than nothing change, you don't need to upgrade.
Thanks and no problem with your methods.
My 16GB microSD card isn't very good and boot / use of archos 101 is very slow with Uruk0.4.2 installed on external SD.
Now it's fast installed on internal SD...
Maybe this help:
if can't mount ext4 partition on your linux box, you can do:
tune2fs -E test_fs /dev/sdbx (sdb2 for instance)
and then:
mount -t ext4dev /dev/sdbx /mnt/sdcard
trouble with fresh install for 0.4.2 $auron....
I was able to create 3 partition internally (sdb1(vfat), sdb2(ext4), sdb3(ext4))
I was able to move rootfs and cmd script to sdb2
I was able to flash initramfs and zImage
But I'm stuck when rebooting into SDE (the screen is all messed up)
Any suggestion?
I didn't modify init.rc and vold.stab since this is a fresh install
yura-a said:
Does this method applicable to Archos 101 model too?
If someone already have been tried it on 101, please reply with details here, if any troubles you have after installation or any changes need to be done.
Also I am curious about does anyone have tried to connect USB thumb drive to the tablet with modified rom and root access? Do we still have any issues with USB drive recognition?
Click to expand...
Click to collapse
Yes this procedure works the same way on the A101. I have the 16GB version so I made the 1st partition a bit bigger but that was the only deviation.

[KERNEL][MOD][08-03-2012] I/O Boost - Data2SD

K, time to give this a proper OP, if anyone wants any of the info that was here before you can look here
_________________________________________________________________________________________________
So, the whole idea here started with me reading an article on how part of the whole I/O problem with the transformer is partially caused by the hardware used as internal storage. I wanted to find out if this had any merit and I figured the best way to do it would be to "replace" the internal storage. I did this by mounting the /data partition to the exteral SD (which according to my research, my specific SD Card is better at writing speeds - allegedly the main problem with the transformer's internal storage hardware wise). Then I ran a bunch of benchmarks and have been running it that way for about 24 hours and so far it feels great. Anyone is welcome to give it a try, and hopefully with help, suggestions and feedback from the community, we can all take as much advantage of this idea as possible.
Before I go any further I want to give credit to those who helped me so far, because without them I would still be completely clueless, and not only have they helped be accomplishing what I got so far, but thanks to them I've also learned a bunch of things I didn't know before. So here it goes:
Rayman - For suggesting the method for mounting /data to the external SD.
lilstevie - For helping me get the new kernel flashed right.
Turge - For showing me how to properly repack the kernel.
Parastie - For suggesting doing the same thing to /cache (working on that now).
dagrim1 - For SQL patch and for suggesting a temporary remount (even though it didn't work it was a good thing to try).
_motley - For all his work on his awesome kernel.
_________________________________________________________________________________________________
Updates:
Update 1 (08-01-2012 File boot-data+cache+internal-AOKP6.1base.zip) :
Now both /data and /cache are moved to the external SD card. This means you need a third partition mmcblk1p3 in order to use this modification.
It will also mount the internal storage (previously inaccessible) to /mnt/sdcard_internal
It also attempts to (fail at this point) to mount the internal sd partition (what used to be /sdcard) to /sdcard/Internal_SD (which is why you will always see that folder get created but stay empty). If anybody knows how to make it work please advise.
Modified Lines:
init.cardhu.rc
Code:
# TweakerL MOD > original mount = mmcblk0p8 /data | mmcblk0p3 /cache
mount ext4 /dev/block/mmcblk1p2 /data wait noatime nodiratime nosuid nodev nodelalloc,errors=panic
mount ext4 /dev/block/mmcblk1p3 /cache wait noatime nodiratime nosuid nodev nodelalloc,errors=panic
# TweakerL MOD > added mounts for internal storage
mkdir /mnt/sdcard_internal 0000 system system
mount ext4 /dev/block/mmcblk0p8 /mnt/sdcard_internal wait noatime nodiratime nosuid nodev nodelalloc,errors=panic
# TweakerL MOD > give access to internal SD from /sdcard
mkdir /data/media/Internal_SD 0755 media_rw media_rw
mount /mnt/sdcard_internal/media /data/media/Internal_SD wait noatime nodiratime nosuid nodev nodelalloc,errors=panic
Update 2 (08-01-2012 About backing up/restoring in recovery) : - READ UPDATE 5
One thing that worried me was that by using this mod people wouldn't be able to backup their data partition properly, but now I know that it's possible to do it. It will only work on TWRP though since it has basic terminal access and keyboard. To do it, go into Advanced > Terminal and in there type:
umount /dev/block/mmcblk0p8
mount /dev/block/mmcblk1p2 /data
And until you reboot, any backup/restore should use the external SD data partition instead of the internal. The same should be doable with the cache partition in case you want to backup/restore that.
Update 3 (08-02-2012 File flashme-kernel-motley305-aokp-data+cache2SD.zip) :
Put together a flashable zip that will install motley's 3.0.5 aokp kernel using this mod. Works like a charm so far though I only tried flashing on TWRP. Also, internal storage can be accessed in /data2 and internal sd can be accessed in /sdcardi . Current changes are as follow:
Code:
# TweakerL MOD > move /data and /cache to external SD card || original mount = mmcblk0p8 /data | mmcblk0p3 /cache
mount ext4 /dev/block/mmcblk1p2 /data wait noatime nodiratime nosuid nodev nodelalloc,errors=panic
mount ext4 /dev/block/mmcblk1p3 /cache wait noatime nodiratime nosuid nodev nodelalloc,errors=panic
# TweakerL MOD > create mount for internal storage
mkdir /data2 0000 system system
mount ext4 /dev/block/mmcblk0p8 /data2 wait noatime nodiratime nosuid nodev nodelalloc,errors=panic
# TweakerL MOD > symlink internal sd to a couple of easily accessible locations
symlink /data2/media /mnt/sdcard_internal
symlink /data2/media /sdcardi
Update 4 (08-03-2012 File boot-cm10-unofficial-data+internal.zip) :
Running the unofficial CM10 (no cherrypicks one) using this mod and so far it's pretty amazing. The rom itself is pretty stable and even snappier with /data mounted to external SD. Benchmarks are at the bottom. Current modifications:
fstab.cardhu:
Code:
#TweakerL MOD > Move /data to external SD and internal /data to /data2
/dev/block/mmcblk1p2 /data ext4 rw,nosuid,nodev,noatime,user_xattr,acl,barrier=1,journal_async_commit,nodelalloc,data=writeback wait
/dev/block/mmcblk0p8 /data2 ext4 rw,nosuid,nodev,noatime,user_xattr,acl,barrier=1,journal_async_commit,nodelalloc,data=writeback wait
init.cardhu.rc:
Code:
# TweakerL MOD > create mount for internal storage
mkdir /data2 0000 system system
mount_all /fstab.cardhu
# TweakerL MOD > symlink internal sd to a couple of easily accessible locations
symlink /data2/media /mnt/sdcard_internal
symlink /data2/media /sdcardi
Update 5 (08-03-2012 About backing up/restoring in recovery) :
So after doing some tests, and paying more attention to TWRP, I noticed something rather useful:
When you have this mod enabled, or whenever you have a mmcblk1p2 partiion, TWRP will have the sd-ext menu enabled. This means that to backup your data you can simply backup the sd-ext partition and to restore your data you can simply restore your sd-ext partition. No need to worry about manually switching the mount point for /data in recovery. I guess it was a whole lot easier than I thought.
Also congratulations and thanks to everyone who has contributed with this so far.
WE MADE IT TO FRONT PAGE ON XDA (08-03-2012)
_________________________________________________________________________________________________
Requirements:
There are a few things you will need to do in order for this to work right for you, and a couple of things you'll have to research before you even try it.
#1. Obviously, you have to be rooted/unlocked because you're not gonna be able to change much around otherwise.
#2. You MUST repartition your external SD. The kernel I've put together so far WILL ONLY mount /data to mmcblk1p2, which basically says "mount /data to the second partition in the external SD." also, the ramdisk expects that partition to be ext4, so essentially:
Make sure you have an external SD with at least two partitions and that the second partition is formatted to ext4. I personally use Gparted to repartition my stuff, but feel free to use whatever rocks your boat. Even if you're on windows you can still use gparted by using virtualbox, so I'm not gonna go look for a different windows solution.
#3. This is the research part... This will be beneficial or detrimental to each user depending on the SD card used. If you have a slow SD card this probably will do you no good. However, just because you have a class 10 SD card, that doesn't mean it will benefit you either. On my own research I have found that some class 6-10 SD Cards have extremely slow random write speeds, so if you happen to have one of those, even if it's a class 10, this might not be for you. This means that you're gonna have to do some research to find out if your SD Card will benefit you or not. You can always just give it a try, as far as I know this is entirely reversible, how easy or hard being just a matter of how bad you mess up on meeting the requirements and following the instructions.
#4. At this point (07-30-2012) I'm doing all this stuff using the AOKP milestone 6.1 kernel as base for my modified kernel, so if you're not using AOKP milestone 6.1, flashing my kernel might borke your system. You've been warned, feel free to proceed otherwise at your own peril.
_____________________________________________________________________________________________________________
Installation:
#1. Download attached file (boot-data2SD-AOKP6.1base.zip) and extract it to the root of your internal storage (/sdcard).
#2. Open a terminal.
#3. Type the following:
Code:
su
dd if=/sdcard/boot.blob of=dev/block/mmcblk0p4 bs=1
#4. Wait for it to complete.
#5. Reboot.
Upon rebooting you will know that it worked because it will look just as if you just flashed a new rom, that is, you'll get the device setup screen (assuming that the tablet booted at all lol). If you're planning to use TB to restore your apps, you'll probably want to copy the TB folder to your external SD's first partition so that you can copy it back once you're done with the device setup (at this point you will have no access - unless you manually mount it - to your internal storage).
_______________________________________________________________________________________
Reverting:
Follow the same exact steps for installation but use boot-default-AOKP6.1.zip instead.
_______________________________________________________________________________________
Optional:
#1. If you want to have access to everything you had on your data partition in the new data partition, you'll have to clone everything from one to the other. To do this, make sure that your new data partition (the one in your external SD) has enough storage space to fit everything you currently have in your data partition (the one in your internal storage). Then run the following command in your terminal.
Code:
dd if=dev/block/mmcblk0p8 of=dev/block/mmcblk1p2 bs=4096 conv=notrunc,noerror
BEWARE that if you have a lot of stuff this can take quite a while and even though I've read a way of getting the progress for this in Linux I'm not sure that you can check the progress on Android.
_______________________________________________________________________________________
Next steps in development:
#1. Move /cache as well.
#2. Find out what happens with recovery backups when the partitions are changed.
#3. Attempt to apply mod to motley's kernel.
#4. Create a script that is run on boot to eliminate need for replacing the kernel.
#5. With help from the community, find the best SD Card for this.
#6. Run the modified system for a while to have a good feel for performance benefits
#7. Come up with other interesting uses for this other than getting better I/O (maybe an easy - kinda easy - way to dual boot with ubuntu, maybe other stuff, dunno).
_______________________________________________________________________________________
How can I set my kernel to do this?
I didn't do a whole lot, and it's not like I want it to be a secret, so as I modify things I'll try to keep the steps listed here so that anyone modifying their own kernel who would like to try this modification can go ahead and do it.
You'll need to know how to unpack/repack a kernel. Turge has a SUPER EASY explanation here on how to do it on windows (I'll pack together the necessary binaries for linux later, maybe).
Mount /data to the second partition in your external SD (formatted as ext4 filesystem):
After unpacking the kernel navigate to the folder that has the ramdisk and open it
(DON'T USE ANY ASCII BASED TEXT EDITOR BECAUSE IT WILL PROBABLY MESS THINGS UP I USE NOTEPAD++)
Around line 26 change:
Code:
mount ext4 /dev/block/mmcblk0p8 /data wait noatime nodiratime nosuid nodev nodelalloc,errors=panic
to
Code:
mount ext4 /dev/block/mmcblk1p2 /data wait noatime nodiratime nosuid nodev nodelalloc,errors=panic
_______________________________________________________________________________________________________
SD Cards tested:
Samsung 32GB Class 10 MicroSDHC High Speed Memory Card - Very Good Results
SanDisk® microSDHCTM 8GB Memory Card - Very Good Results
"Either way, with this mod, the tablet feels like it should have right from the start. It's speedy and responsive, and apps being installed don't stall the system." - Turge - Post #59
_______________________________________________________________________________________________________
Benchmarks:
/data mounted to mmcblk0p8 (Internal Storage):
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
/data mounted to mmcblk1p2 (External SD):
RL Benchmark WITHOUT dagrim1's sql patch as per request:
/data mounted to mmcblk0p8 (Internal Storage):
/data mounted to mmcblk1p2 (External SD):
*Important thing to note: When running the benchmark with data in the internal SD it was about 220 seconds in the first run, then about 180, then about 130 and finally 118; whereas running it from the external SD was consistenly between 63 and 65 seconds every time. I think this more than proves that A) Asus used a cheap I/O storage, B) No matter what software changes are made, more than likely running the rw partitions from a better I/O storage, i.e. an external SD is a good idea.
As promised here are benchmarks on a JB rom (Unofficial CM10). Also sorry it took me a while to get these, I was going to use eos3 but I started getting random reboots. Then I decided to try cm10, and I messed up a flash and had to redo a bunch of things. Anyway, the only change here is the mod itself (no custom kernel or anything). Though one thing to note is that I moved /cache back to the internal partition after some thought that this allows /data and /cache to be written at the same time to different locations thus lowering the bottleneck.
/data mounted to mmcblk0p8 (internal storage):
/data mounted to mmcblk1p2 (external storage):
Now, as you can see, JB did bring a major improvement to I/O, bringing the benchmark down from about 115sec to 68 (almost reaching the modded ICS at 60 seconds). But as I expected, better software works better on better hardware and now the modded JB is running at 50 seconds instead of 60. Next I'm going to put dagrim1's sql patch and see how low the benchmark goes. Also will be posting the modded blob in just a little bit for anyone who wants to use it on CM10.
We don't have sd-ext it's an old trick when phones had very little /data partitions, you have the possibility to create a sd-ext partition on an external sdcard and mounting it as a secondary data. (like opt partition on Linux).
To see what block device is data just run 'mount' command in terminal emulator. I don't have my device here.
sdcard cache is already set to 2048 if I'm correct.
Your script would mean creating a sd-ext partition on an external sdcard, modify fstab to have it correctly mounted then applying the script.
Not really easy for common users.
I would rather look at kernel drivers (not I/O schedulers but drivers handling with file system format) but it's quite a hard work.
Hmmm...
Was talking to Rayman and it doesn't actually seem that hard to do... Just gotta change the init.cardhu.rc in the ramdisk to mount /data to /dev/block/mmcblk1p2 instead of /dev/block/mmcblk0p8
The thing is, that while I know every step that I have to take to get it done, I haven't used linux in forever and quite honestly I couldn't even compile blobtools right now if I wanted to to extract the ramdisk from the boot blob to make the necessary change... so yea anyone who knows how to edit a kernel should be able to do it, and then just repack it as a blob... I'll probably look into it later, but if anyone wants to type the terminal commands for to to get/compile blobtools I'll appreciate it...
As in just a mount of data to mmcblk1p2?
Would a temp solution (just to check if it works) be to remount data manually? (Tried it, to mmcblk1p1 btw since 1p2 didn't seem to exist for me, but it still mounts to mmcblk0p8.
Using:
mount -o remount,rw -t ext4 /dev/block/mmcblk1p1 /data
(as su in terminal)
dagrim1 said:
As in just a mount of data to mmcblk1p2?
Would a temp solution (just to check if it works) be to remount data manually? (Tried it, to mmcblk1p1 btw since 1p2 didn't seem to exist for me, but it still mounts to mmcblk0p8.
Using:
mount -o remount,rw -t ext4 /dev/block/mmcblk1p1 /data
(as su in terminal)
Click to expand...
Click to collapse
Reason why mmcblk1p2 didn't work is because you have to repartition the sd card to have an ext4 partition... personally what I did was take my 32gb sd card and have the first partition as a fat32 partition for storage and set the rest to an ext4 partition... also, you have to do that because the /data partition is already expected to be an ext4 partition on most of the current ROMs... Trying to set it without doing that most likely won't work.
Also, another thing that's important is that for this to be beneficial you have to have an SD Card with higher random write speed than your internal storage speed... my internal storage speed is about .25 mb/s and my sdcard is about 1.5mb/s so there should be a big difference... Oh and if you happen to have a class 10 sdcard that doesn't necessary mean that it has high random write speed... you actually have to go look up the specs or run benchmarks on it.
TweakerL said:
Reason why mmcblk1p2 didn't work is because you have to repartition the sd card to have an ext4 partition... personally what I did was take my 32gb sd card and have the first partition as a fat32 partition for storage and set the rest to an ext4 partition... also, you have to do that because the /data partition is already expected to be an ext4 partition on most of the current ROMs... Trying to set it without doing that most likely won't work.
Also, another thing that's important is that for this to be beneficial you have to have an SD Card with higher random write speed than your internal storage speed... my internal storage speed is about .25 mb/s and my sdcard is about 1.5mb/s so there should be a big difference... Oh and if you happen to have a class 10 sdcard that doesn't necessary mean that it has high random write speed... you actually have to go look up the specs or run benchmarks on it.
Click to expand...
Click to collapse
Thanks, makes sense yeah... will have to check if it's worth the hassle for now. Not at this moment anyway, but interesting concept...
Stuck... again...
So I figured how to unpack the boot.blob, then unpack the boot.blob.LNX, then decompress the ramdisk... made the necessary change to init.cardhu.rc... compressed the ramdisk to the same format it was before, repacked the boot.blob.LNX, repacked the boot.blob... dd if=blob of=dev/block/mmcblk0p4 seek=28 bs=1 ... and ... nothing... reboot and where you're supposed to get the quick progress bar nothing seems to happen... I'm assuming I messed up on the recompressing ramdisk/packing the boot.blob... but I'm not sure how...
Anyway... I'll post exactly how I did it tomorrow so maybe someone with more experience can help me figure out where I messed up...
But so far, I wanna say thanks to rayman and lilstevie for all the help they've given me so far with this idea.
TweakerL said:
... compressed the ramdisk to the same format it was before, repacked the boot.blob.LNX, repacked the boot.blob... dd if=blob of=dev/block/mmcblk0p4 seek=28 bs=1 ...
Click to expand...
Click to collapse
Just wondering, why did you choose to use seek=28?
I believe the TFP will need the first 28 header signature to be there in order to flash through the staging paritition (p4).
Your other option would be to flash using fastboot:
1. If you've installed the AndroidRoot.mobi bootloader (if you have nvflash), then you can directly flash the boot.blob.LNX file, as this is a raw image.
fastboot -i 0x0b05 flash boot boot.blob.LNX
2. If you don't have AndroidRoot.mobi bootloader, then I suggest you get NVFlash working first and get a backup... if not, you can use the following to flash the blob:
fastboot -i 0x0b05 flash boot blobfileyou'vecreated
3. Use fastboot to flash to the staging partition:
fastboot -i 0x0b05 flash staging blobfileyou'vecreated
TweakerL said:
So I figured how to unpack the boot.blob, then unpack the boot.blob.LNX, then decompress the ramdisk... made the necessary change to init.cardhu.rc... compressed the ramdisk to the same format it was before, repacked the boot.blob.LNX, repacked the boot.blob... dd if=blob of=dev/block/mmcblk0p4 seek=28 bs=1 ... and ... nothing... reboot and where you're supposed to get the quick progress bar nothing seems to happen... I'm assuming I messed up on the recompressing ramdisk/packing the boot.blob... but I'm not sure how...
Anyway... I'll post exactly how I did it tomorrow so maybe someone with more experience can help me figure out where I messed up...
But so far, I wanna say thanks to rayman and lilstevie for all the help they've given me so far with this idea.
Click to expand...
Click to collapse
I've repacked the boot.img for the Prime before to add init.d support so I'll post my method and the files needed in a few minutes once I get to work. It'll involve getting cygwin installed (with Perl support I believe) if you're on Windows.
Would it be better to move cache and maybe dalvik cache (assuming the SD random read/write is faster then internal memory) ? Since you're only moving data and leaving cache on internal, that'll still hit the issues of having bad IO. Moving cache (which I believe would have more random access) I think would be better.
Thoughts?
dagrim1 said:
As in just a mount of data to mmcblk1p2?
Would a temp solution (just to check if it works) be to remount data manually? (Tried it, to mmcblk1p1 btw since 1p2 didn't seem to exist for me, but it still mounts to mmcblk0p8.
Using:
mount -o remount,rw -t ext4 /dev/block/mmcblk1p1 /data
(as su in terminal)
Click to expand...
Click to collapse
Thanks for the idea, I tried to do that but nothing seemed to happen (checking on file manager /data partition is still taking the same amount of space as it did before). It would've been a really good way of testing this whole thing though
kokopuphz said:
Just wondering, why did you choose to use seek=28?
I believe the TFP will need the first 28 header signature to be there in order to flash through the staging paritition (p4).
Your other option would be to flash using fastboot:
1. If you've installed the AndroidRoot.mobi bootloader (if you have nvflash), then you can directly flash the boot.blob.LNX file, as this is a raw image.
fastboot -i 0x0b05 flash boot boot.blob.LNX
2. If you don't have AndroidRoot.mobi bootloader, then I suggest you get NVFlash working first and get a backup... if not, you can use the following to flash the blob:
fastboot -i 0x0b05 flash boot blobfileyou'vecreated
3. Use fastboot to flash to the staging partition:
fastboot -i 0x0b05 flash staging blobfileyou'vecreated
Click to expand...
Click to collapse
I used seek=28 out of despair and by lilstevie's suggestions... dd with or without seek had the same exact result, the staging just ignoring the whole thing lol...
Sounds like a plan (flashing with fastboot)... I've got one dumb question though before I do that (and yea i've got nvflash setup and all the backups and stuff). How do I actually go about restoring the system with NVFLASH if I go and borke the system ? XD
Turge said:
I've repacked the boot.img for the Prime before to add init.d support so I'll post my method and the files needed in a few minutes once I get to work. It'll involve getting cygwin installed (with Perl support I believe) if you're on Windows.
Click to expand...
Click to collapse
That would be much appreciated, I don't mind steps for windows or linux, I'll go either way
Parastie said:
Would it be better to move cache and maybe dalvik cache (assuming the SD random read/write is faster then internal memory) ? Since you're only moving data and leaving cache on internal, that'll still hit the issues of having bad IO. Moving cache (which I believe would have more random access) I think would be better.
Thoughts?
Click to expand...
Click to collapse
I agree that moving the cache is a good idea, one of the main reasons why I'm testing with /data though is that it will be much easier to have solid evidence of whether this works or not that way since all the benchmark apps seem to benchmark on the /data partition. I know benchmarks aren't real world results, but if I can run benchmarks on the same partition and it's 5 times faster on the SD card than on the internal memory, I think it should mean something. After that, if there are positive results, I'm thinking of moving both /data and /cache partitions and run that way for a while to see how well it performs, and then to run with just the /cache moved and see how that performs.
Turge said:
I've repacked the boot.img for the Prime before to add init.d support so I'll post my method and the files needed in a few minutes once I get to work. It'll involve getting cygwin installed (with Perl support I believe) if you're on Windows.
Click to expand...
Click to collapse
Here are the steps for repacking the boot.img. Some involve running the commands via cygwin, others involve running them via the Windows Command Prompt.
The instructions for installing cygwin, extracting and repacking the boot.img were found here: http://www.freeyourandroid.com/guide/extract-edit-repack-boot-img-windows
Once you have setup cygwin, extract the attached files in a folder under your "home" folder in cygwin.
copy boot.blob to the same folder and run the following via the Windows Command Prompt to extract the boot.img from the boot.blob:
Code:
BlobUnpack.exe boot.blob
ren boot.blob.LNX boot.img
From the cygwin bash terminal window, switch to the same folder and run the following to extract the ramdisk from the boot.img:
Code:
./extractboot boot.img
You now have an out/ramdisk folder that contains the files you want to edit.
Once done, repack the ramdisk and kernel into boot_new.img with the following command (via cygwin once again):
Code:
./packboot
then from the Command Prompt repack boot_new.img into boot2.blob using the following:
Code:
blobpack -s boot2.blob LNX boot_new.img
You can now flash the boot.blob to the staging partition via a command in updater-script:
Code:
package_extract_file("/boot.blob", "/dev/block/mmcblk0p4");
or by using adb while in recovery/android:
Code:
dd if=/sdcard/boot2.blob of=/dev/block/mmcblk0p4
Did anyone think of running iotop? If we know what part of /data is contributing to the stalls, maybe an interesting idea would be to just mount that part of the tree on SD?
tyvm will get on it now, will report back any results
Sent from my Transformer Prime TF201 using Xparent SkyBlue Tapatalk 2
what's iotop?
Though regardless, the problem I'm trying to deal with is the fact that apparently, the storage hardware in the Prime has limited I/O capabilities, namely random write speeds, regardless of software. Because of this the stalls are at least partially caused by the "where" the /data is rather than the "content" in the /data.
Sent from my Transformer Prime TF201 using Xparent SkyBlue Tapatalk 2
TweakerL said:
what's iotop?
Click to expand...
Click to collapse
ffs. Why do I bother?
tshoulihane said:
ffs. Why do I bother?
Click to expand...
Click to collapse
You know, I can just google it, but the fact that you care enough to post your opinion but not enough to explain it is the kind of mentality that keeps people who could potentially contribute to the community from doing so because they have to go research all over the internet, possibly going through bad information, for something that might be very simple. Read a few posts up and you'll see the right kind of mindset. Turge could've just*given some halfassed response and sent me on a wild goose chase but instead he took the time to explain in a way that anyone with any amount of knowledge could understand...
And I hope that since you can't bother to give an useful response, that you can't bother wasting you "precious time" justifying and complaining about how people ask questions that they could just look for elsewhere...

[Q] Can one mount an Android file system image?

So after a failed attempt to upgrade from CyanogenMod 10.1.3 to 10.2, I was unable to access /data or /sdcard because both systems were encrypted. I ended up having to factory reset my phone because it refused to co-operate or let me access my files. However, before I did that, I was able to run
Code:
adb shell "dd if=/dev/block/mmcblk0p2" > data.img
and
Code:
adb shell "dd if=/dev/block/mmcblk0p3" > sdcard.img
, which appears to have copied the raw partition images from the phone (at least, they're the right sizes).
According to my reading, Android (and, I'm inferring, CyanogenMod) encrypts filesystems using dm-crypt, with a AES-CBC ESSIV:SHA256 cipher, with the key being derived from the password using PBKDF2. Knowing the precious little I do about encrypted file systems, my guess is that if I configure the image in cryptsetup to create a drive mapping, I can mount the mapped drive and recover the data from the images.
According to /fstab.herring on my ahem, fresh, install of Android, the /data partition is in ext4 format whereas the /sdcard partition is vFAT. So, once I've gotten through the encryption on the partition images, they should mount normally, right?
I know that dm-crypt accepts plain, LUKS, LoopAES and TrueCrypt device formats. I'm inferring from the PBKDF2 extension that Android goes the LUKS route for encrypting. Is this conclusion correct?
Could someone explain whether it's possible to decrypt a dumped android image? I'm really hoping that the cypher information is stored on the file system and not on some key file that I nuked in the factory reset. If it can, in theory, be decrypted, am I using the right tools to approach the matter? If so, I'll continue fiddling with cryptsetup and mount, but no sense in wasting time if it's an impossible task.
Never did get a response to this question, so I'll try it again, but start with a simpler question:
If someone dds an Android (specifically Cyanogenmod 10.x) partition to an img file, is there any way to read that image from, say a Linux laptop? I dumped the contents of the /system partition using
Code:
adb shell "dd if=/dev/block/mmcblk0p1" > system.img
I expected system.img to be a normal ext4 partition. However, attempting to loopback mount it with
Code:
sudo mount -t ext4 -o loop,ro system.img ~/android/system
Gave me errors about corrupt group descriptors, bad magic numbers and other maladies indicative of a thoroughly corrupted file system. I'm assuming that:
/data has the same ext4 partition structure as /system; and
The process to mount /storage would be no different to mounting /system with the exception that the former uses vFAT as its file system
However, as my Android is currently working normally (well, as well as one can hope for Android to work), I know I don't have a corrupted file system.
So what's going on? Does Android use a special version of ext4 that other Linuxes don't recognise? Am I not dd-ing correctly? Is there a block-size issue I ignored to my peril?
Borden Rhodes said:
So after a failed attempt to upgrade from CyanogenMod 10.1.3 to 10.2, I was unable to access /data or /sdcard because both systems were encrypted. I ended up having to factory reset my phone because it refused to co-operate or let me access my files. However, before I did that, I was able to run
Code:
adb shell "dd if=/dev/block/mmcblk0p2" > data.img
and
Code:
adb shell "dd if=/dev/block/mmcblk0p3" > sdcard.img
, which appears to have copied the raw partition images from the phone (at least, they're the right sizes).
According to my reading, Android (and, I'm inferring, CyanogenMod) encrypts filesystems using dm-crypt, with a AES-CBC ESSIV:SHA256 cipher, with the key being derived from the password using PBKDF2. Knowing the precious little I do about encrypted file systems, my guess is that if I configure the image in cryptsetup to create a drive mapping, I can mount the mapped drive and recover the data from the images.
According to /fstab.herring on my ahem, fresh, install of Android, the /data partition is in ext4 format whereas the /sdcard partition is vFAT. So, once I've gotten through the encryption on the partition images, they should mount normally, right?
I know that dm-crypt accepts plain, LUKS, LoopAES and TrueCrypt device formats. I'm inferring from the PBKDF2 extension that Android goes the LUKS route for encrypting. Is this conclusion correct?
Could someone explain whether it's possible to decrypt a dumped android image? I'm really hoping that the cypher information is stored on the file system and not on some key file that I nuked in the factory reset. If it can, in theory, be decrypted, am I using the right tools to approach the matter? If so, I'll continue fiddling with cryptsetup and mount, but no sense in wasting time if it's an impossible task.
Click to expand...
Click to collapse
Can you give the result of the "file sdcard.img" and "file data.img" commands?
You are quite right. With regular LUKS container/partition, you would do (being root) the following. With the following commands, you can create a container named "safe", setup it, then format its content in ext3 and mount the partition:
Code:
dd if=/dev/zero bs=1M count=50 of=safe
losetup /dev/loop0 safe
cryptsetup luksFormat -c aes -h sha256 /dev/loop0
cryptsetup luksOpen /dev/loop0 safe
mkfs.ext3 /dev/mapper/safe
(losetup /dev/loop0 safe)
(cryptsetup luksOpen /dev/loop0 safe)
mkdir mnt
mount -t ext3 /dev/mapper/safe mnt
//HERE: do whatever you want in your mounted encrypted filesystem
umount mnt
cryptsetup luksClose safe
losetup -d /dev/loop0
For details, you can go there: http://blog.theglu.org/index.php/20...-couteau-suisse-du-chiffrement-de-partitions/
Sorry, the article is in French but you can translate it if you need to.
Here, using "hexdump", you can see the "safe" file has a LUKS magic at the beginning. And doing a "file safe" command, you can check it detects it as a "LUKS encrypted file".
If doing "file" on your .img files does not give you the same result, you may not be able to directly use the "cryptsetup" command and need to adapt it.
Finally: usually in Android the header containing the key is stored on another partition so you may have lost it when wiping your phone, sorry.
---------- Post added at 02:44 PM ---------- Previous post was at 02:41 PM ----------
Borden Rhodes said:
Never did get a response to this question, so I'll try it again, but start with a simpler question:
If someone dds an Android (specifically Cyanogenmod 10.x) partition to an img file, is there any way to read that image from, say a Linux laptop? I dumped the contents of the /system partition using
Code:
adb shell "dd if=/dev/block/mmcblk0p1" > system.img
I expected system.img to be a normal ext4 partition. However, attempting to loopback mount it with
Code:
sudo mount -t ext4 -o loop,ro system.img ~/android/system
Gave me errors about corrupt group descriptors, bad magic numbers and other maladies indicative of a thoroughly corrupted file system. I'm assuming that:
/data has the same ext4 partition structure as /system; and
The process to mount /storage would be no different to mounting /system with the exception that the former uses vFAT as its file system
However, as my Android is currently working normally (well, as well as one can hope for Android to work), I know I don't have a corrupted file system.
So what's going on? Does Android use a special version of ext4 that other Linuxes don't recognise? Am I not dd-ing correctly? Is there a block-size issue I ignored to my peril?
Click to expand...
Click to collapse
Can you give the result of the "file system.img" command?
Thanks, saidlike, for your reply:
saidelike said:
Can you give the result of the "file sdcard.img"...
Click to expand...
Click to collapse
sdcardPartitionDump.img: data
saidelike said:
... and "file data.img" commands?
Click to expand...
Click to collapse
data.img: data
saidelike said:
Can you give the result of the "file system.img" command?
Click to expand...
Click to collapse
system.img: Linux rev 1.0 ext4 filesystem data, UUID=57f8f4bc-abf4-655f-bf67-946fc0f9f25b (needs journal recovery) (extents) (large files)
Again, attempting to run
Code:
mount -t ext4 -o loop systemimg mountpoint/
yields
mount: wrong fs type, bad option, bad superblock on /dev/loop0,
missing codepage or helper program, or other error
In some cases useful info is found in syslog - try
dmesg | tail or so
Click to expand...
Click to collapse
Ignoring the results of data.img and sdcard.img for the time being, the fresh dump of the system partition shows that it's an EXT4 filesystem, but that it's heavily corrupted. fsck.ext4 on that partition basically asks me to fix every single inode, so it's not a simple unclean journal issue. Therefore, is it fair to conclude that CyanogenMod (and maybe AOSP too) have modified the ext4 partiiton type?
@Borden Rhodes
Maybe, my reply is too late, but you could try to make the same experiment with backup of your current data.
If you get the same results as with the old pre-wipe backup, then you still have a hope.

TWRP , extracttarfork() process ended with error=255, How to Fix.. ?

Hello ..
Someone help me.
i Took Backup from Official TWRP but when i am trying to restore it giving me error=255 . How i fix this.
it happens when i am trying to restore FIRMWARE partition.
any solution . anyone facing this issue.. ?
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
FurqanHanif said:
Hello ..
Someone help me.
i Took Backup from Official TWRP but when i am trying to restore it giving me error=255 . How i fix this.
it happens when i am trying to restore FIRMWARE partition.
any solution . anyone facing this issue.. ?
Click to expand...
Click to collapse
Answered you in the TWRP thread. Check again.
FurqanHanif said:
Hello ..
Someone help me.
i Took Backup from Official TWRP but when i am trying to restore it giving me error=255 . How i fix this.
it happens when i am trying to restore FIRMWARE partition.
any solution . anyone facing this issue.. ?
Click to expand...
Click to collapse
Just restore system, data,and boot , don't forget flash frimware..Done , solved.
sachin n said:
Answered you in the TWRP thread. Check again.
Click to expand...
Click to collapse
I am stuck with the same problem. Can you link me to your answer to him or just again tell me what's the solution?
Firmware was 90MB before, after trying to restore it, TWRP wiped it and now it's 23MB.
nilanko said:
I am stuck with the same problem. Can you link me to your answer to him or just again tell me what's the solution?
Firmware was 90MB before, after trying to restore it, TWRP wiped it and now it's 23MB.
Click to expand...
Click to collapse
The answer is to just restore system, data and boot. That's the way to go.
Sent from my mido using XDA Labs
I just restore system and data, but problem was occur like that. Any solution?
From my experience, i think it is because of miui rom??
After trying many time, I used this method .....
1. first wipe everything
2. flash original zip rom
3.then flash your backup
4. Flash lazyflasher
It will show error though but you will get radio working
Firmware Problem "extractTarFork process ended with ERROR 255"
In My case Firmware is not restoring
shoiwing error "extractTarFork process ended with ERROR 255"
so to solve it
1.Wipe data dalvik cache and system
2.Just flash the new rom which u had earlier.
for exp. i had lineage 14.1
3.After installing it ask for wipe dalvik and cache do it then dont wipe it from the main menu.
4.just restore the backuped file without ticking the firmware
Note-Firmware must be untick while restoring
5.done Problem of fingerprint scanner and network problem also solved by this
Note-Dont restart in between
if it helps you
Subscribe to My Youtube Channel youtube.com/AnonymAb
AmanBhagat said:
In My case Firmware is not restoring
shoiwing error "extractTarFork process ended with ERROR 255"
so to solve it
1.Wipe data dalvik cache and system
2.Just flash the new rom which u had earlier.
for exp. i had lineage 14.1
3.After installing it ask for wipe dalvik and cache do it then dont wipe it from the main menu.
4.just restore the backuped file without ticking the firmware
Note-Firmware must be untick while restoring
5.done Problem of fingerprint scanner and network problem also solved by this
Note-Dont restart in between
if it helps you
Subscribe to My Youtube Channel youtube.com/AnonymAb
Click to expand...
Click to collapse
does not work for me. do you have any other method?
FurqanHanif said:
Hello ..
Someone help me.
i Took Backup from Official TWRP but when i am trying to restore it giving me error=255 . How i fix this.
it happens when i am trying to restore FIRMWARE partition.
any solution . anyone facing this issue.. ?
Click to expand...
Click to collapse
sohanaw said:
does not work for me. do you have any other method?
Click to expand...
Click to collapse
That happened to me twice, loosing the imei.
To fix it, just restore or flash any rom you want, and follow this steps:
Extract NON-HLOS.bin file from official ROM.
Copy extracted NON-HLOS.bin to the adb/fastboot folder.
Boot your device into fastboot mode.
Connect your device to PC
In the folder with adb/fastboot tools press “Shift” key + right mouse button and select “Open command window here”.
Enter these commands in order:
Code:
Fastboot devices
Fastboot.exe erase modem
Fastboot.exe flash modem NON-HLOS.bin
Fastboot.exe reboot
Check your IMEI. It should be restored now.
ramping said:
That happened to me twice, loosing the imei.
To fix it, just restore or flash any rom you want, and follow this steps:
Extract NON-HLOS.bin file from official ROM.
Copy extracted NON-HLOS.bin to the adb/fastboot folder.
Boot your device into fastboot mode.
Connect your device to PC
In the folder with adb/fastboot tools press “Shift” key + right mouse button and select “Open command window here”.
Enter these commands in order:
Code:
Fastboot devices
Fastboot.exe erase modem
Fastboot.exe flash modem NON-HLOS.bin
Fastboot.exe reboot
Check your IMEI. It should be restored now.
Click to expand...
Click to collapse
modem is okay i am able to flash that.
but for me persist is showing 0mb in twrp and i am unable to flash persist i have tried fastboot miflash none worked for me .
please if you have any other method then share.
Go back to StockROM with the help of Xiaomi's tools
Had the same problem. The methods above didn't work for me, either.
I went back to StockROM with the tools provided on the Xiaomi website, the process will re-flash the firmware, too and all described problems will be solved. Make sure you'll untick "firmware" on the next time when trying a restore
ramping said:
That happened to me twice, loosing the imei.
To fix it, just restore or flash any rom you want, and follow this steps:
Extract NON-HLOS.bin file from official ROM.
Copy extracted NON-HLOS.bin to the adb/fastboot folder.
Boot your device into fastboot mode.
Connect your device to PC
In the folder with adb/fastboot tools press “Shift” key + right mouse button and select “Open command window here”.
Enter these commands in order:
Check your IMEI. It should be restored now.
Click to expand...
Click to collapse
Well what can i said??u really save my poor soul last night!!been 2 days searching for solution after error 255 on my redmi 5 plus,ur solution work perfectly n thank you brooooo!!!???
Sent from my Redmi 5 Plus using XDA Labs
well this is weird.
I'm having error 255 on firmware partition restore, no matter what I do (redmi note4x snapdragon global, nandroid backups from stock miui8.5-9.2 and LAOS15.1)
However using (at least some of) my backups with firmware unticked and then installing firmware from TWRP package does the trick, like this one below:
https://forum.xda-developers.com/re...irmware-firmware-miui-9-china-stable-t3697976
I had this problem on a Redmi Note 3 Pro/Qualcomm recently. It seems to me to be loosely correlated to the /data backup size, and seems to manifest just below 4GB, looks suspiciously like some 32bit counter/offset ... but .... in my case this seems to happen only in the first tar/win file which much < 2GB uncompressed anyway.
Interestingly, not all tar binaries are equal. The binary from LineageOS 14.1 crashes reading win000 files often if I try to test this from a terminal session when the phone is booted normally, however tar from TWRP does work and doesn't crash. Using tar from ubuntu 18.04 I can see all the files, however there are numerous reports of
Code:
tar: Malformed extended header: missing equal sign
Maybe this tar crash is also what is happening for the TWRP GUI using it's internal tar? Although this seems to be crashing when the recovery is nearing 4GB, however my tar crash seems to happen on the first segmented win000 file? Maybe it is related in some way to pigz which seems to be used by the TWRP GUI to compress/uncompress and it does multi-threading. I haven't looked at TWRP code.
I tried TWRP 3.1.1-0, and downloaded the latest 3.2.3-0 from twrp.me. Both failed in the same way.
I inspected some of the backups I had, finding decrypted /data space usage less /data/media:
Code:
$ ls -1
2018-09-06--12-41-18_lineage_kenzo-userdebug_7.1.2_NJH47F_02865f
2018-11-10--11-08-53_lineage_kenzo-userdebug_7.1.2_NJH47F_02865f
2019-01-10--10-01-22_lineage_kenzo-userdebug_7.1.2_NJH47F_02865f
2019-01-26--16-04-54_lineage_kenzo-userdebug_7.1.2_NJH47F_02865f
$ grep Data.backup.size */recovery.log|uniq|sed 's/\// /;s/--[^ ]* / /;s/:/ /'
2018-09-06 recovery.log I:Data backup size is 3464MB, free: 14062MB.
2018-09-06 recovery.log I:Data backup size is 3464MB, free: 11552MB.
2018-11-10 recovery.log I:Data backup size is 4622MB, free: 11065MB.
2018-11-10 recovery.log I:Data backup size is 4622MB, free: 7576MB.
2019-01-10 recovery.log I:Data backup size is 4041MB, free: 11284MB.
2019-01-10 recovery.log I:Data backup size is 4041MB, free: 8192MB.
2019-01-26 recovery.log I:Data backup size is 652MB, free: 24414MB.
$
I could restore 2018-09-06 and 2019-01-26 using TWRP GUI while the other 2 failed with error=255. Of the backups I could restore with the TWRP GUI, both backups are easily < 4GB. 2019-01-10 is just below, still no idea if it is related to 4GB. In each case I formatted /data before hand, so /data/media was empty, so there was 24GB of free space, so there was always at least 2 times, sometimes 5 times, the actual space required for the recovery available.
Irrespective of the actual failure mode, I was able to restore the other backups manually.
Interestingly when I examine the .win and .win000 files with
Code:
tar tvf file | sed 5q
I find that the single .win file backups need to be restored while current directory is /data whereas the multipart backups need to be restored while current directory is /.
Manual restore process from TWRP recovery shell :
Backup everything to storage external the phone, and then backup the backup.
Wipe /data. I prefer to format /data while also wipes /data/media = /sdcard as this guarantees /data is clean, however if your backups are stored in /sdcard/TWRP then you are going to need to either not format /data or restore them from your PC, or not store them in /sdcard/TWRP and store them on an external sdcard or external USB OTG drive. Actual location may vary depending on TWRP build. Determine the b= lines below appropriately.
Connect using adb shell. You could type this in using the TWRP Advanced Terminal, but error prone.
Make sure you have enough free space on /data to do the restore. You should have, but this is the manual process so cross check.
Restore the .win0?? files with tar.
Code:
... # PS1="# " # optional
# cd /location/TWRP/BACKUPS/serialnumber/2019-01-10* # location: sdcard sdcard1 usb-otg
# pwd # verify backup directory
/location/TWRP/BACKUPS/.../2019-01-10--10-01-22_...
# b=$(pwd) # remeber backup folder location
# ls -l data.*.win000 # verify backup file exists
-rw-rw---- 1 root sdcard_rw 1109681843 2019-01-26 11:02 data.ext4.win000
# for m in data*md5; do md5sum -c $m; done # verify md5 checksums of each tar/win file.
data.ext4.win000: OK
data.ext4.win001: OK
data.ext4.win002: OK
# cd /
# for w in $b/data*win0??; do echo recover $w; tar xpvf $w > $w.rec; echo; done
recover /.../data...win000
tar: removing leading '/' from member names
recover /.../data...win001
tar: removing leading '/' from member names
recover /.../data...win002
tar: removing leading '/' from member names
# cd $b
# wc -l data*rec # verify recovery of reasonable number of files
29346 data.ext4.win000.rec
343 data.ext4.win001.rec
1831 data.ext4.win002.rec
31520 total
# df /data
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/block/dm-0 25667344 15051056 10599904 59% /data
#
Reboot
Download latest mido firmware and flash through twrp.
If you are on mido here is the solution i used
I flashed the last rom i had ( for my case :miui.eu 10.3 oreo port )
Then wipe data
The flashed the miui 10.1.1.0 for mido
And wait for it to boot up and you will be fine
You can update after to 10.2.3.0
The good fix!!!
TWRP always skip data/media in backup or restore. This is a problem!
Restoring procedure "automatic format" skipped data/media folder, only delete other folders. "Wiping data without wiping data/media ..."
To delete data partition completly:
1. Go to Wipe menu
2. Wipe Data
3. Yes (all data, audio, video, etc deleted)
4. Go to Restore menu
5. Restore Data partition
Restore completed without error!
samarium said:
I had this problem on a Redmi Note 3 Pro/Qualcomm recently. It seems to me to be loosely correlated to the /data backup size, and seems to manifest just below 4GB, looks suspiciously like some 32bit counter/offset ... but .... in my case this seems to happen only in the first tar/win file which much < 2GB uncompressed anyway.
Interestingly, not all tar binaries are equal. The binary from LineageOS 14.1 crashes reading win000 files often if I try to test this from a terminal session when the phone is booted normally, however tar from TWRP does work and doesn't crash. Using tar from ubuntu 18.04 I can see all the files, however there are numerous reports of
Code:
tar: Malformed extended header: missing equal sign
Maybe this tar crash is also what is happening for the TWRP GUI using it's internal tar? Although this seems to be crashing when the recovery is nearing 4GB, however my tar crash seems to happen on the first segmented win000 file? Maybe it is related in some way to pigz which seems to be used by the TWRP GUI to compress/uncompress and it does multi-threading. I haven't looked at TWRP code.
I tried TWRP 3.1.1-0, and downloaded the latest 3.2.3-0 from twrp.me. Both failed in the same way.
I inspected some of the backups I had, finding decrypted /data space usage less /data/media:
Code:
$ ls -1
2018-09-06--12-41-18_lineage_kenzo-userdebug_7.1.2_NJH47F_02865f
2018-11-10--11-08-53_lineage_kenzo-userdebug_7.1.2_NJH47F_02865f
2019-01-10--10-01-22_lineage_kenzo-userdebug_7.1.2_NJH47F_02865f
2019-01-26--16-04-54_lineage_kenzo-userdebug_7.1.2_NJH47F_02865f
$ grep Data.backup.size */recovery.log|uniq|sed 's/\// /;s/--[^ ]* / /;s/:/ /'
2018-09-06 recovery.log I:Data backup size is 3464MB, free: 14062MB.
2018-09-06 recovery.log I:Data backup size is 3464MB, free: 11552MB.
2018-11-10 recovery.log I:Data backup size is 4622MB, free: 11065MB.
2018-11-10 recovery.log I:Data backup size is 4622MB, free: 7576MB.
2019-01-10 recovery.log I:Data backup size is 4041MB, free: 11284MB.
2019-01-10 recovery.log I:Data backup size is 4041MB, free: 8192MB.
2019-01-26 recovery.log I:Data backup size is 652MB, free: 24414MB.
$
I could restore 2018-09-06 and 2019-01-26 using TWRP GUI while the other 2 failed with error=255. Of the backups I could restore with the TWRP GUI, both backups are easily < 4GB. 2019-01-10 is just below, still no idea if it is related to 4GB. In each case I formatted /data before hand, so /data/media was empty, so there was 24GB of free space, so there was always at least 2 times, sometimes 5 times, the actual space required for the recovery available.
Irrespective of the actual failure mode, I was able to restore the other backups manually.
Interestingly when I examine the .win and .win000 files with
Code:
tar tvf file | sed 5q
I find that the single .win file backups need to be restored while current directory is /data whereas the multipart backups need to be restored while current directory is /.
Manual restore process from TWRP recovery shell :
Backup everything to storage external the phone, and then backup the backup.
Wipe /data. I prefer to format /data while also wipes /data/media = /sdcard as this guarantees /data is clean, however if your backups are stored in /sdcard/TWRP then you are going to need to either not format /data or restore them from your PC, or not store them in /sdcard/TWRP and store them on an external sdcard or external USB OTG drive. Actual location may vary depending on TWRP build. Determine the b= lines below appropriately.
Connect using adb shell. You could type this in using the TWRP Advanced Terminal, but error prone.
Make sure you have enough free space on /data to do the restore. You should have, but this is the manual process so cross check.
Restore the .win0?? files with tar.
Code:
... # PS1="# " # optional
# cd /location/TWRP/BACKUPS/serialnumber/2019-01-10* # location: sdcard sdcard1 usb-otg
# pwd # verify backup directory
/location/TWRP/BACKUPS/.../2019-01-10--10-01-22_...
# b=$(pwd) # remeber backup folder location
# ls -l data.*.win000 # verify backup file exists
-rw-rw---- 1 root sdcard_rw 1109681843 2019-01-26 11:02 data.ext4.win000
# for m in data*md5; do md5sum -c $m; done # verify md5 checksums of each tar/win file.
data.ext4.win000: OK
data.ext4.win001: OK
data.ext4.win002: OK
# cd /
# for w in $b/data*win0??; do echo recover $w; tar xpvf $w > $w.rec; echo; done
recover /.../data...win000
tar: removing leading '/' from member names
recover /.../data...win001
tar: removing leading '/' from member names
recover /.../data...win002
tar: removing leading '/' from member names
# cd $b
# wc -l data*rec # verify recovery of reasonable number of files
29346 data.ext4.win000.rec
343 data.ext4.win001.rec
1831 data.ext4.win002.rec
31520 total
# df /data
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/block/dm-0 25667344 15051056 10599904 59% /data
#
Reboot
Click to expand...
Click to collapse
Did your instructions. When running the recover command, I have some errors: Cannot remove file: Is a directory / Or "File exists"
When I am finished, I run "df" and 30% of disk is used which seems ok. But when I check /sdcard folder, nothing appears there... It is like it was recovered but somewhere else.
Do you have any clue?
Sorry,
today for the first time i must restore a nandroid backup (recovery 3.2.1.2) in my xiaomi mi a1: i meet the exact error of this thread, "extractTarFork process ended with ERROR 255".
How can i restore all my backup without problem?
tnx

[Guide]Resizing Partitions on Android (Redmi device)

4 this kind of guys x)
{
"lightbox_close": "Close",
"lightbox_next": "Next",
"lightbox_previous": "Previous",
"lightbox_error": "The requested content cannot be loaded. Please try again later.",
"lightbox_start_slideshow": "Start slideshow",
"lightbox_stop_slideshow": "Stop slideshow",
"lightbox_full_screen": "Full screen",
"lightbox_thumbnails": "Thumbnails",
"lightbox_download": "Download",
"lightbox_share": "Share",
"lightbox_zoom": "Zoom",
"lightbox_new_window": "New window",
"lightbox_toggle_sidebar": "Toggle sidebar"
}
Code:
Warning:
Your device will never boot :D
Does this enough?
Ok jk but consider its possible
So don't blame me,
not responsible for anything
Trick:
Read 2nd Post First
(if u think necessary)(i would)
Why ?? :
Cuz u want to increase/decrease size on internal storage/internal sd card/nand/emmc.
So u can save Avengers 1080p in dual audio
I.e. default internal storage will increase from 24.x GB to 26.x GB
Sounds cool ?
Go ahead
Tools required:
0. Nandorid Backup ,
back up everything every way you can/know
1. Rooted Phone
2. Custom Recovery with ADB Sideload
3. Minimal ADB and Fastboot Tools(for Computer)
4 parted utilities.zip (download from below)
5. Computer should recognise device for that install necessary drive
6. brain, commen sense, patients,calm etc.
---> PROCEDURE/STEPS
(will add screen shot, Rewrite again )
1.
Extract 'parted' from zip copy to "/system/bin"
(if can't Open Es File explorer app>find & tape Root explorer option>mount r/w option> mount system to r/w (read/write allow)
2.
Put phone in TWRP Recovery
3.
Connect to computer
On command line interface
(Windows>Run>CMD>enter)
#commands:
adb shell
su
parted /dev/block/mmcblk0
you will see the following screen
4.
Now to see the partitions and their partition numer use the following command
print
It will output a screen like follows
From the list above we can see partition number, the start position, the end position and the type of partition
Now from the List we need to figure out what partitions we need to remove and remake, and since we are majorly concerned about the Userdata and system partition, we will be playing around with those partitions only. But from the screenshot above you can see that Between the system and the userdata partition there is the cache partition.
To avoid any problems further. i would suggest you take a screenshot of this list .
5
Now Enlisting the partitions that we would have to remove inorder to resize them, they are:-
partition no. 27 i.e. system
partition no. 28 i.e cache
partition no. 29 i.e. userdata
In case you are using a device that has 2 system partitions (For eg. MI3) and you wanna reduce system2 and increase system1 you will need to delete only those 2 partitions
So now going further we will now remove the partitions using the following commands
rm 27
The above command will remove the partition no. 27 i.e the system partition
rm 28
This will remove the partition no. 28 i.e cache
rm 29
This will remove the partition no. 29 i.e. userdata
At this point of time you have lost all the data on your internal storage, system and cache partition. that means your device wont boot anymore except in recovery (which we are already in )
6.
Now that we have removed the partitions, we have raw space with us, which we would allocate to the three partitions that we removed, as per our choice.
To do that, we use the following commands
mkpartfs primary ext2 336 1250
mkpartfs primary ext2 1250 1653
mkpartfs primary ext2 1653 7818
336 is the start position of the partition and 1250 is the end position of the paritition.
since the partitions we removed started at 336 and ended at 7818, for my device, we would be able to play around only between these two numbers. i.e 336 and 7818
The first parition we made here is numbered 27 by default and will be of the size (1250-336 = 914) MBs
The second partition we made is numbered 28 and will be of the size 403 MB. (This is the cache partition and since I did not want to change the size i kept it the same)
The third partition we made is numbered 29 and will be of the size (7818-1653 = 6165) MB
The Important thing we need to note here is that the partition Number should not change as this could cause problems later on. i.e., considering my case the system parition should be 27, cache should be 28 and userdata should be 29.
7.
Now we will name these partitions using the following commands
name 27 system
name 28 cache
name 29 userdata
8.
Now punch the following command
quit
This will make you come out of parted utility. so that we can perform the next set of commands
Now we need to convert the partitions from ext2 to ext4 using the following commands
**// For System Partition //**
tune2fs -j /dev/block/mmcblk0p27
e2fsck -fDp /dev/block/mmcblk0p27
tune2fs -O extents,uninit_bg,dir_index /dev/block/mmcblk0p27
e2fsck -fDp /dev/block/mmcblk0p27
**// **
**// For cache Partition //**
tune2fs -j /dev/block/mmcblk0p28
e2fsck -fDp /dev/block/mmcblk0p28
tune2fs -O extents,uninit_bg,dir_index /dev/block/mmcblk0p28
e2fsck -fDp /dev/block/mmcblk0p28
**// **
**// For userdata Partition //**
tune2fs -j /dev/block/mmcblk0p29
e2fsck -fDp /dev/block/mmcblk0p29
tune2fs -O extents,uninit_bg,dir_index /dev/block/mmcblk0p29
e2fsck -fDp /dev/block/mmcblk0p29
**// **
9.
Now we have changed the type of the 3 partitions that we created from ext2 to ext4 and we are ready to go
Now we will enter the parted utility again and check to see if the partitions are made properly or not.
parted /dev/block/mmcblk0
print
As we can see in the screenshot. The system partition is now 914 MB and the userdata partition is no 6165 MB
Now punch the command
quit
exit
exit
Yes you need to exit two times.. first to come out of super user and second to come out of ADB shell
10.
Now Once the repartitioning is done
you need to flash your ROM
(MIUI /Lineage/RR/Viper/Mokee etc)
Now exit sideload in the TWRP and goto Install and select the Rom package and flash it.
Reboot and you should be done!
CREDITS, Thanks :
https://iwf1.com/how-to-re-partition-your-android-tablet-or-smartphone-all-options-included-change-size-fs-type-etc
https://forum.xda-developers.com/crossdevice-dev/android-one-general/guide-repartition-internal-storage-to-t3292159
http://en.miui.com/thread-183258-1-1.html
Reserved
sry for being so direct
here explanation for things that might didn't understood
->
Note: as much as I’d like to, I do not currently possess the resources to grant readers technical support. The guide itself, in the vast majority of cases should be sufficient help. For any individual issue please refer to online forums which are meant for that purpose.
Why Re-Partition?
If you’re here out of curiosity or any other reason than necessity, you may wonder: “why would anyone want to repartition a smartphone / tablet?”.
To answer, each person probably has their own reason, a couple of such I can think of are:
In the case of an upgrade, when there’s not enough space on one partition but others has aplenty.
When you don’t have enough space to install more apps – since your data partition is full – so you want to resize that partition.
Of course, some cases can be resolved via a more simple solution, however, if you want to deal with the problem directly and not just bypassing it – repartition is perhaps the best way to go.
In order to re-partition your device, basically, these are the steps you’ll need to make:
1. Connect your device to your PC.
2. Open up a command shell, on Windows you’d probably use CMD / PowerShell, on Mac / Linux – Terminal.
2-a. Reboot into recovery mode. (Optional, depends on the partition you plan to modify)
3. Use ADB to connect to your device.
4. Launch a partitioning software.
5. Start partitioning.
6. Reinstall any required system file in case you’ve deleted those and afterwards you may exit the shell and reboot your device.
Explaining The Steps
1. We use another machine, in this case our PC, in order to re-partition Android, because we want to have access to our Android system just in case something goes wrong during the partitioning, and also, since Android system cannot be run and resized at the same time.
2. This step is rather self explanatory. We must use a flexible tool that will assist us re-partitioning.
2-a. If you wish to modify any partition other than the recovery partition, I recommend booting into recovery mode in order to do so.
Being inside recovery mode wouldn’t interfere with the process as you may delete the system partition and its files. Furthermore, it might become handy in case you’ll need to reinstall Android system.
3. ADB is an official Android developers tool and it also happens to be the most suitable tool for the job at the moment.
5.
Since this step depends on what you’re actually intending to do with your device – it doesn’t say much, it is an open step, open for your decisions that is.
By typing the help command of your partitioning tool you’ll get a list of the options available to you. For example, these are a few of the options you’ll see in parted:
rm NUMBER – will delete a partition
mkpart – will create a partition
unit UNIT – will set unit type, for example “unit b” will set parted to use bytes, “unit gb” for Giga bytes, etc… (Tip: use bytes for maximum accuracy).
name NUMBER NAME – lets you name the partition (upon making any changes, don’t forget to name the partitions properly).
q – quit parted.
Important Things To Note:
fdisk executes your commands only when changes are saved whereas Parted executes them instantly.
fdisk may not fully support GPT partition table, thus in case yours is GPT, it’s recommended to use Parted instead.
6.
* Tip: If you’re unsure about your device partition names, you can use a command that shows them: cat /proc/partitions.
As you can see, there’s mmcblk0 – which is the main block where all the partitions are stored.
And there are 12 partitions in total which uses the name format “mmcblk0” plus “p” and a number that represent them, such as: mmcblk0p1, mmcblk0p2, etc…
Blocks lie inside /dev directory in Linux (yes, Android is a variation of Linux). We will use the block we’ve found in order to re-partition the device.
A short explanation regarding the relevant partitions:
Partition number 9 labeled FACTORYFS – is the “system” partition where all the operating system files are stored in.
Number 10 – DATAFS – is the “data” partition where all applications usually save their data.
Number 11 – UMS (USB Mass Storage) – is the internal storage partition where all the stuff such as: pictures, videos, etc, are stored in.
To resize those, you’ll have to delete them all and then assign different sizes – this is where a backup might become handy (I recommend copying all the files to your computer prior to erasing any partition).
After erasing and re-partitioning the available space, you should re-label the partitions with the same names (for compatibility sake) and create file systems (I prefer using ext4, however, if your device came with other specific file systems, it might be a good idea to stick to those).
So, how do we do it?
Here’s the sequence of commands with a following explanation:
(parted) rm 9
(parted) rm 10
(parted) rm 11
Will delete FACTORYFS, DATAFS and UMS respectively.
************
From another thread different info
By default, Parted uses MB as the storage unit. To prevent possible unused space after repartitioning, we’ll use sectors as a unit instead.
Type
unit s
This’ll change to sectors.
Type
print
It’ll give a warning, just type
i
Then:
print free
At the top, you’ll see that the sector size is written. Write this number down somewhere. For my Android One 4GB, the sector size is 512 bytes.
Now, you need to understand what the list means. Each horizontal row shows the details of a partition.
The 1st column shows the partition number.
The 2nd column shows the start offset of that partition. That means that the partition starts at the location mentioned.
The 3rd column shows where the partition ends. Notice that each partition starts exactly 1 sector after the previous one ends.
The 4th column is obviously the size of the partition.
The 5th column is the file system used by the partition. If nothing is written in this column, that means that it’s a binary partition.
The 6th column is the partition name.
You’ll see that the sizes in that list are weird. They’re not in any standard unit you might know. That’s because we used sectors instead of megabytes. The ‘s’ after each number indicates that it’s in sectors. (You can use the default MB unit (1MB=1000 KB. 1KB=1000bytes), or the MiB unit (1MiB=1024 KiB), but that just might leave 1 or 2 MB of space unused. So, I’m using sectors).
Remember that 1 sector = 512 bytes for my phone.
There’s some free space at the top and bottom of the list. Leave that free space there. Do not make partitions using those.
To convert sectors to MiB or KiB:
1s = 512bytes (Use the sector size you wrote down previously for this step, it might not be 512 bytes for you)
1024 bytes = 1 KiB
1024 KiB = 1 MiB
1024 MiB = 1GiB
So, 4833280s = (4833280 x 512) B = 2474639360 B
= (2474639360 / 1024) KiB = 2416640 KiB
= (2416640 /1024) MiB = 2360 MiB
= (2360 / 1024) GiB = 2.30 GiB
We’ll use another terminal window with sizes in MiB now. So open another Parted prompt in a new terminal / command prompt window, but instead of
unit s,
this time, write
unit MiB
Type “print”, “i”, and “print free” again
Look at my 11th partition. Its size is 8MiB. I know that this logo partition doesn’t need more than 2 MiB. So, I’ll make it smaller.
When you make partitions smaller, all the data inside will be lost. So, we need to back up the partitions first.
Open a 3rd terminal window. Type
adb shell dd if=/dev/block/mmcblk0p11 of=/microSD/p11
The “dd” command copies bytes from the “if=” location, to the “of=” location. The internal storage is /dev/block/mmcblk0. The “p11” after that refers to the partition we are backing up. Notice that in the Parted list, “logo” has a partition number of “11”. So the general command to back up partitions is
adb shell dd if=/dev/block/mmcblk0p<partition_number> of=/microSD/p<partition_number>
From recovery, unmount all partitions except microSD and oem. Then back up partitions 11, and 13 from PC. We will copy the files from OEM instead of using dd. So type
adb shell mkdir /microSD/oem
adb shell cp –a /oem/ /microSD/oem
Go to /microSD/oem/oem/app with TWRP’s file manager, and delete everything there.
Open the 1st terminal with sizes in sectors.
Type
rm 11
This will delete the oem partition. Type
print free
.
Abhijeet Rajgor said:
sry for being so direct
here explanation for things that might didn't understood
->
Note: as much as I’d like to, I do not currently possess the resources to grant readers technical support. The guide itself, in the vast majority of cases should be sufficient help. For any individual issue please refer to online forums which are meant for that purpose.
Why Re-Partition?
If you’re here out of curiosity or any other reason than necessity, you may wonder: “why would anyone want to repartition a smartphone / tablet?”.
To answer, each person probably has their own reason, a couple of such I can think of are:
In the case of an upgrade, when there’s not enough space on one partition but others has aplenty.
When you don’t have enough space to install more apps – since your data partition is full – so you want to resize that partition.
Of course, some cases can be resolved via a more simple solution, however, if you want to deal with the problem directly and not just bypassing it – repartition is perhaps the best way to go.
Click to expand...
Click to collapse
Hey, Can you tell me the partition sizes for different partitions i.e. system, data, cache.... for the attached zip file.
incomplete guide
Bro go to link in the post guide is yet incomplete , I'll rewrite again with more specific n Direct to point
Thanks
Abhijeet Rajgor said:
Bro go to link in the post guide is yet incomplete , I'll rewrite again with more specific n Direct to point
Thanks
Click to expand...
Click to collapse
Do you know how we can delete the /cust partition and include it into the system?
I don't know
bekcicandrej said:
Do you know how we can delete the /cust partition and include it into the system?
Click to expand...
Click to collapse
Am yet working on my device itself yet didn't tried on Redmi 3s,
Cwm recovery for my Alcatel

Categories

Resources