recover photos on wiped Internal Storage - OnePlus 2 Q&A, Help & Troubleshooting

i accidentally wiped my Internal Storage, and with that all my photos that were in the DCIM folder. I tried some Google Play file undelete software, but unfortunately my photos were not recovered.
i've found some site with a tutorial here https://www.dflund.se/~jokke/androidfilerecovery/ , on how to extract the Internal Storage partition to a raw file, and then with testdisk it should be possible to analyse the image and find for recoverable files.
The command to extract the Internal Storage should be
Code:
/adb shell su -c "cat /dev/block/mmcblk0" | pv > mmcblk0.raw
and i've done all the steps in the tutorial.
at some point i get a message that the reported size of the partition is not correct and i can't get to the point where i should be able to see deleted files.
is there any other way to find and restore my wiped photos? (directly via ADB or any other way )

using the DF command in an ADB shell gives
Code:
Filesystem 1K-blocks Used Available Use% Mounted on
tmpfs 1878584 692 1877892 1% /dev
tmpfs 1878584 0 1878584 0% /mnt
/dev/block/mmcblk0p42 2539312 1373916 1149012 55% /system
/dev/block/mmcblk0p43 56627428 21661152 34949892 39% /data
/dev/block/mmcblk0p41 253920 184 248496 1% /cache
/dev/block/mmcblk0p37 28144 4256 23236 16% /persist
/dev/block/mmcblk0p1 81872 77360 4512 95% /firmware
/dev/block/mmcblk0p2 1048288 176 1048112 1% /bt_firmware
/data/media 56627428 21661152 34949892 39% /storage/emulated

is there a video tutorial that i can watch?

And so did it work i kinda have the same situation as you

Related

cannot mount \cache

Hey all.
Firstly please forgive me it this seems pretty basic however i seem to have lost the ability to mount the cache partition on my JF1.5 Dev Phone.
The upgrade process went fine, had been using it for a week, then i installed an animated splash screen made for non-cupcake builds and it bricked my phone. i got the black screen of wait in place of an animated load screen. luckily, anticipating such problems, i had just done a full nandroid backup.
now here's the problem. while backing up from nandroid, i was informed that the cache partition does not exist.
looking in the filesystem, there is a /cache folder but nothing in it and i have lost the ability to install apps via the market.
running mount shows:
rootfs on / type rootfs (ro)
tmpfs on /dev type tmpfs (rw,mode=755)
devpts on /dev/pts type devpts (rw,mode=600)
proc on /proc type proc (rw)
sysfs on /sys type sysfs (rw)
tmpfs on /sqlite_stmt_journals type tmpfs (rw,size=4096k)
/dev/block/mtdblock3 on /system type yaffs2 (ro)
/dev/block/loop0 on /system/modules type cramfs (ro)
/dev/block/loop1 on /system/xbin type cramfs (ro)
/dev/block/mtdblock5 on /data type yaffs2 (rw,nosuid,nodev)
/dev/block/mmcblk0p2 on /system/sd type ext2 (rw,errors=continue)
/dev/block//vold/179:1 on /sdcard type vfat (rw,dirsync,nosuid,nodev,noexec,uid=
1000,gid=1000,fmask=0711,dmask=0700,allow_utime=0022,codepage=cp437,iocharset=is
o8859-1,shortname=mixed,utf8)
and the partitions table shows:
major minor #blocks name
7 0 204 loop0
7 1 1936 loop1
31 0 256 mtdblock0
31 1 5120 mtdblock1
31 2 2560 mtdblock2
31 3 69120 mtdblock3
31 4 69120 mtdblock4
31 5 76544 mtdblock5
179 0 3872256 mmcblk0
179 1 3349521 mmcblk0p1
179 2 522112 mmcblk0p2
please help, i have tried mounting it manually to mtdblock4 with the command:
# mount -o remount,rw -t yaffs2 /dev/block/mtdblock4 /cache
mount: mounting /dev/block/mtdblock4 on /cache failed: Invalid argument
If any more information than this is needed i can supply logcat file etc...
twoolie said:
Hey all.
...
please help, i have tried mounting it manually to mtdblock4 with the command:
# mount -o remount,rw -t yaffs2 /dev/block/mtdblock4 /cache
mount: mounting /dev/block/mtdblock4 on /cache failed: Invalid argument
Click to expand...
Click to collapse
wouldn't the command be:
mount -o rw,remount -t yaffs2 /dev/block/mtdblock4 /cache
??
but I fail to see why you are doing this, care to explain so i can understand?
ok maybe i should explain better. there are 3 major blocks set aside for the use of the filesystem. mtdblock3 is set aside for the /system partition, mtdblock4 is set aside for /cache and mtdblock5 is set aside for /data. cache is important because it caches objects for the dalvic VM, web pages for the browser and most importantly, it stores apks from the market while downloading. now the first two are not so bad because the dalvic vm will run, just a little slower and the browser will browse, ablight will not be able to cache pages and will only have access to what is in ram. but because the market will wait to be able to place a file in /cache before downloading it, this effectively means i will never be able to download/install from the market.
Now what happened was when i created my nandroid backup it backed up system.img, cache.img and data.img
i then bricked the system and wanted to restore from nandroid backups. first i put back the system, then data but the phone wouldnt accept a cache image. fastboot is unable to mount it, jf recovery is unable to mount it, and the android OS is unable to mount it.
also i tried your suggestion but mount -o rw,remount -t yaffs2 /dev/block/mtdblock4 /cache returns the same error message:
mount: mounting /dev/block/mtdblock4 on /cache failed: Invalid argument
also, mount -a returns:
mount: mounting /dev/block/mtdblock4 on /cache failed: Invalid argument
mount: mounting /system/modules/modules.cramfs on /system/modules failed: No such file or directory
mount: mounting /system/xbin/xbin.cramfs on /system/xbin failed: No such file or directory
i'm hoping that this means something to somebody. does this just mean i am missing cramfs modules i need?
any help would be GREATLY appreciated.
It would be a roundabout way, but DREAIMG.NBH will restore partitions. Of course you'd have to then do the rooting process all over again.
Wait... but to do nandroid, don't you want to just restore
system.img
data.img
boot.img
so the commands would be
fastboot flash system system.img
fastboot flash userdata data.img
fastboot flash boot boot.img
I guess I'm failing to see why cache needs to be restored. won't the OS just clear it out an write over it eventually anyways?
Or am I missing something?

[Q] Need to extract data from broken tablet

I have a nexus 7 16 GB tablet with a busted screen. There's some files I want to get off it but I can't figure out how to do it. I have several clockworkmod backups on the device that I was trying to get off it through adb but couldn't do it.
I tried adb pull /data/media/clockworkmod/backup but it says the folder doesn't exist
I also tried adb pull /sdcard/clockworkmod/backup and same result.
I also tried using holo backup but it requires me to unlock the device but since the screen is broken I can't do this without using an otg cable which I don't have.
What I'm really after are some songs I created using the autorap app by Smule. If there's another way I can retrieve these files I would greatly appreciate it.
Did you not have it set to connect to your computer as an mtp media device? If so, just pull what you want from there.
This seems overly obvious to me, so clearly there is something that I am missing, and I don't want to make it sound like I am being a complete tool or anything.
Sent from my Nexus 7 using Tapatalk
jma9454 said:
Did you not have it set to connect to your computer as an mtp media device? If so, just pull what you want from there.
This seems overly obvious to me, so clearly there is something that I am missing, and I don't want to make it sound like I am being a complete tool or anything.
Sent from my Nexus 7 using Tapatalk
Click to expand...
Click to collapse
It connects as a media device and it's rooted and has usb debugging enabled. When I go into the tablet on the computer there's no backup folder under clockworkmod. I can enter recovery mode and all my backups show up but I can't access the backups when it's connected to the computer. I read somewhere that clockworkmod puts their backups in /data/media to prevent people from messing things up I guess but the adb pull method gives me that error. I don't know what else to do besides buying an otg cable and hooking up a usb mouse.
OK, yeah, I can't think of anything. When you're in recovery mode, is there a way to push files to the computer within recovery? I have never dealt with CWM, as I used TWRP on my kindle fire, and haven't added a bootloader to my nexus 7 yet.
Sent from my Nexus 7 using Tapatalk
jma9454 said:
OK, yeah, I can't think of anything. When you're in recovery mode, is there a way to push files to the computer within recovery? I have never dealt with CWM, as I used TWRP on my kindle fire, and haven't added a bootloader to my nexus 7 yet.
Sent from my Nexus 7 using Tapatalk
Click to expand...
Click to collapse
Not that I know of. When the tablet is in recovery mode it won't connect to the computer.
You can use adb in cwm recovery so no problem to download everything to computer.
One more thing I can try to recommend, and I'll get more information on this, is that there was an "app" called terminal, and you might be able to push the files you want into your computer from that. Give me a few hours while I contact someone that knows about that app to see if it would work on the nexus 7 and where to find it.
--EDIT--
Never mind, that would require keyboard input from you. I don't know what I was thinking. If there isn't a way to mount everything from CWM then I don't know what else I can do for you. Sorry.
Sent from my Nexus 7 using Tapatalk
jkkk88 said:
You can use adb in cwm recovery so no problem to download everything to computer.
Click to expand...
Click to collapse
So you're saying even though the adb pull method won't work when the tablet's on it will mysteriously work when in recovery? I don't see why that would make a difference. I feel the files I'm looking for might be in a different folder than /data/media/clockworkmod/backup or /sdcard/clockworkmod/backup.
Boot into CWM recovery mode, connect n7 to computer with USB cable and do what do you need. Adb daemon is started in CWM recovery automatically without any user interaction and n7 setting. I didn't tried it yet but there is command "adb backup <switches>" you can try to put content of n7 to computer or use standard adb commands. As I don't use nandroid backups I can't say where they are located but when you issue
Code:
adb pull /sdcard
and
Code:
adb pull /data
you will find them in you computer.
On n7 GSM here is output of some commands in recovery mode (in my case twrp but cwm will be the same):
Code:
[[email protected] ~]$ adb shell
~ # mount
rootfs on / type rootfs (rw)
tmpfs on /dev type tmpfs (rw,nosuid,relatime,mode=755)
devpts on /dev/pts type devpts (rw,relatime,mode=600)
proc on /proc type proc (rw,relatime)~ # mount /dev/block/mmcblk0p3 /system
sysfs on /sys type sysfs (rw,relatime)
/dev/block/mmcblk0p10 on /data type ext4 (rw,relatime,user_xattr,acl,barrier=1,data=ordered)
/dev/block/mmcblk0p10 on /sdcard type ext4 (rw,relatime,user_xattr,acl,barrier=1,data=ordered)
/dev/block/mmcblk0p5 on /cache type ext4 (rw,relatime,user_xattr,acl,barrier=1,data=ordered)
# mount point fstype device
#/sdcard datamedia /dev/null
/system ext4 /dev/block/platform/sdhci-tegra.3/by-name/APP
/cache ext4 /dev/block/platform/sdhci-tegra.3/by-name/CAC
/data ext4 /dev/block/platform/sdhci-tegra.3/by-name/UDA length=-32768
/misc emmc /dev/block/platform/sdhci-tegra.3/by-name/MSC
/boot emmc /dev/block/platform/sdhci-tegra.3/by-name/LNX
/recovery emmc /dev/block/platform/sdhci-tegra.3/by-name/SOS
/staging emmc /dev/block/platform/sdhci-tegra.3/by-name/USP
/radio ext4 /dev/block/platform/sdhci-tegra.3/by-name/RDO
/usb-otg vfat /dev/block/sda1 /dev/block/sda flags=display="USB-OTG";storage;wipeingui;removable
~ # ls -l /dev/block/platform/sdhci-tegra.3/by-name/APP
lrwxrwxrwx 1 root root 20 Nov 1 08:36 /dev/block/platform/sdhci-tegra.3/by-name/APP -> /dev/block/mmcblk0p3
~ # mount /dev/block/mmcblk0p3 /system
jkkk88 said:
Boot into CWM recovery mode, connect n7 to computer with USB cable and do what do you need. Adb daemon is started in CWM recovery automatically without any user interaction and n7 setting. I didn't tried it yet but there is command "adb backup <switches>" you can try to put content of n7 to computer or use standard adb commands. As I don't use nandroid backups I can't say where they are located but when you issue
Code:
adb pull /sdcard
and
Code:
adb pull /data
you will find them in you computer.
On n7 GSM here is output of some commands in recovery mode (in my case twrp but cwm will be the same):
Code:
[[email protected] ~]$ adb shell
~ # mount
rootfs on / type rootfs (rw)
tmpfs on /dev type tmpfs (rw,nosuid,relatime,mode=755)
devpts on /dev/pts type devpts (rw,relatime,mode=600)
proc on /proc type proc (rw,relatime)~ # mount /dev/block/mmcblk0p3 /system
sysfs on /sys type sysfs (rw,relatime)
/dev/block/mmcblk0p10 on /data type ext4 (rw,relatime,user_xattr,acl,barrier=1,data=ordered)
/dev/block/mmcblk0p10 on /sdcard type ext4 (rw,relatime,user_xattr,acl,barrier=1,data=ordered)
/dev/block/mmcblk0p5 on /cache type ext4 (rw,relatime,user_xattr,acl,barrier=1,data=ordered)
# mount point fstype device
#/sdcard datamedia /dev/null
/system ext4 /dev/block/platform/sdhci-tegra.3/by-name/APP
/cache ext4 /dev/block/platform/sdhci-tegra.3/by-name/CAC
/data ext4 /dev/block/platform/sdhci-tegra.3/by-name/UDA length=-32768
/misc emmc /dev/block/platform/sdhci-tegra.3/by-name/MSC
/boot emmc /dev/block/platform/sdhci-tegra.3/by-name/LNX
/recovery emmc /dev/block/platform/sdhci-tegra.3/by-name/SOS
/staging emmc /dev/block/platform/sdhci-tegra.3/by-name/USP
/radio ext4 /dev/block/platform/sdhci-tegra.3/by-name/RDO
/usb-otg vfat /dev/block/sda1 /dev/block/sda flags=display="USB-OTG";storage;wipeingui;removable
~ # ls -l /dev/block/platform/sdhci-tegra.3/by-name/APP
lrwxrwxrwx 1 root root 20 Nov 1 08:36 /dev/block/platform/sdhci-tegra.3/by-name/APP -> /dev/block/mmcblk0p3
~ # mount /dev/block/mmcblk0p3 /system
Click to expand...
Click to collapse
Ok I figured it out. The folder I was trying to pull really didn't exist. I just did adb shell to find what files were in there but I can't find the autorap files I was looking for. They may have gotten deleted.

v20 stuck at login screen h918

v20 stuck at login screen h918
please help!!!!
I tried to update with tmobile. Tried to reboot but kept rebooting directly to twrp. I tried to mount the system and went to advanced and changed system type to fat32 or something.
I tried mounting it. It was taking to long so i rebooted. Now stuck on twrp boot screen.
However, I have access to adb. still recognizes device but cant do anything with TWRP.
#ls
boot property_contexts
cache recovery
charger res
data root
default.prop sbin
dev sdcard
etc seapp_contexts
external_sd selinux_version
file_contexts sepolicy
fstab.elsa service_contexts
init sideload
init.rc sys
init.recovery.elsa.rc system
init.recovery.usb.rc tmp
license twres
oem ueventd.elsa.rc
prebuilt_file_contexts ueventd.rc
prebuilt_file_contexts.bin usb-otg
proc vendor
#adb shell
/sdcard # df
Filesystem 1K-blocks Used Available Use% Mounted on
tmpfs 1937588 20 1937568 0% /dev
tmpfs 1937588 4 1937584 0% /tmp
/dev/block/sda20 53789164 18491520 35240300 34% /data
/dev/block/sda20 53789164 18491520 35240300 34% /sdcard
/dev/block/sda19 1222008 10904 1194720 1% /cache
fdisk -l /dev/block/sda20
Note: sector size is 4096 (not 512)
Disk /dev/block/sda20: 56.0 GB, 56094621696 bytes
64 heads, 32 sectors/track, 6687 cylinders
Units = cylinders of 2048 * 4096 = 8388608 bytes
Disk /dev/block/sda20 doesn't contain a valid partition table
nellatl said:
v20 stuck at login screen h918
please help!!!!
Click to expand...
Click to collapse
Details please.
Zacharee1 said:
Details please.
Click to expand...
Click to collapse
I tried to update with tmobile. Tried to reboot but kept rebooting directly to twrp. I tried to mount the system and went to advanced and changed system type to fat32 or something.
I tried mounting it. It was taking to long so i rebooted. Now stuck on twrp boot screen.
However, I have access to adb. still recognizes device but cant do anything with TWRP.
#ls
boot property_contexts
cache recovery
charger res
data root
default.prop sbin
dev sdcard
etc seapp_contexts
external_sd selinux_version
file_contexts sepolicy
fstab.elsa service_contexts
init sideload
init.rc sys
init.recovery.elsa.rc system
init.recovery.usb.rc tmp
license twres
oem ueventd.elsa.rc
prebuilt_file_contexts ueventd.rc
prebuilt_file_contexts.bin usb-otg
proc vendor
/sdcard # df
Filesystem 1K-blocks Used Available Use% Mounted on
tmpfs 1937588 20 1937568 0% /dev
tmpfs 1937588 4 1937584 0% /tmp
/dev/block/sda20 53789164 18491520 35240300 34% /data
/dev/block/sda20 53789164 18491520 35240300 34% /sdcard
/dev/block/sda19 1222008 10904 1194720 1% /cache
Have you tried power on and volume down to go through the factory reset screens.
A bunch of us had this problem and it was because an update downloaded on it's own and the bootloader snoops it out and forces recovery to boot.
Just do the volume down + power button - as soon as you see the lg logo release power only then immediately re-press power and continue holding power and volume down until the factory reset screen pops up. Select yes and yes, (don't worry - if you have twrp recovery it can't reset). It will boot you into TWRP and I'm pretty sure it will delete the update files in fota folder.
In TWRP select reboot - system and it should boot normally like nothing happened.
try this perhaps https://forum.xda-developers.com/v20/help/lg-v20-access-to-fastboot-t3557328

[GUIDE][WORK IN PROGRESS]Oneplus one - resize system partition and maybe even more

WARNING!!!​Everyone is responsible for the proper functioning of their device. This guide is the result of personal experiments and I'm not responsible for any damage caused to your device as a result of improper use of its contents.
Introduction
Stock partitions layout has a 1.3Gb /system partition that is too small for users that flash modern custom roms + some kinds of google apps.
This is a step by step guide to change the layout of the partitions table with a bigger /system partition.
How
On OnePlus One, stock partition table looks like the following
Code:
... ... ...
/dev/block/mmcblk0p14 : start= 294912, name="system"
/dev/block/mmcblk0p15 : start= 3006464, name="persist"
/dev/block/mmcblk0p16 : start= 3072000, name="cache"
... ... ...
/dev/block/mmcblk0p28 : start= 4521984, name="userdata"
/dev/block/mmcblk0p29 : start= 121552896, name="grow"
With this layout, resizing the /system partition may seem difficult because it's close to other very important partitions.
So I've experimented with another approach. By resizing userdata partition, and relocate the /system partition at the beginning of the resulting free space, other partitions are left untouched.
There are mainly two (little) issues
almost all custom roms out of there assume that /system partition is 1.3gb of size
on internal storage the old area of /system partition are unused.
For the first point, the solution is to resize the filesystem when you first flash a custom rom. To automatically resize filesystem at every update there is an addon.d script.
For the second point the new free space available (the old 1.3G /system partition) can be used as a new /cache partition.
And, again, the new free space available (the old /cache partition) can be the famous /vendor partition (that is out of the scope of this guide).
This guide uses the sfdisk tool from util-linux. In my opinion, it's more powerful than parted and it's easy to use via script.
IMPORTANT - Before you start
Obviously, this method is destructive regarding userdata partition, so make a full backup of your data.
Manually resizing filesystem of /system partition is needed only once because the addon.d script will ensure that everything works as expected. The only exception is when you wipe /system and flash a new rom
Prerequisites
a working TWRP recovery installed on device
knowledge of adb tools
a statically cross compiled sfdisk tool (you can self compile, or use the one attached below)
this addon.d script (thanks to @osmosis)
flashable zip of a custom rom (and optionally gapps, magisk etc etc etc)
flashable zip bacon-resize-system.zip (attached on this post)
Let's go
enter TWRP recovery and connect phone on a PC
push sfdisk into a temporary dir and ensure is executable
Code:
adb push sfdisk-arm /tmp
adb shell
cd /tmp
chmod 755 sfdisk-arm
make and pull a backup of your partition table (there is also the 64Gb stock layout in attachments)
Code:
./sfdisk-arm -d /dev/block/mmcblk0 > bacon.gpt
exit
adb pull /tmp/bacon.gpt
looking into the partition table you see that userdata partition starts at sector 4521984.
So in order to resize partition (for example 53G instead of 55,8G).
Code:
adb shell
cd /tmp
umount /data
umount /sdcard
echo "4521984,53G" | ./sfdisk-arm --no-reread -N 28 /dev/block/mmcblk0
. Scrolling down the output of this command the new userdata partition is
Code:
Device Start End Sectors Size Type
/dev/block/mmcblk0p28 4521984 115671039 111149056 53G unknown
so the start sector of /system partition will be 115671040 (115671039+1)
relocating system partition at the end of the new userdata partition(size now will be 2,8G)
Code:
echo "115671040,+" | ./sfdisk-arm --no-reread -N 14 /dev/block/mmcblk0
reboot recovery (kernel need to reload partition table)
Code:
reboot recovery
format userdata with TWRP(no wipe... full format)
push custom rom with adb and flash with TWRP (without rebooting)
flash bacon-resize-system.zip
finish.. you can now reboot or continue with flashing gapps, magisk etc etc (but now with a bigger system partition)
Rollback
TODO
Nice to have
flashable zip for addon.d script (WIP)(DONE)
[*] looking into the partition table you see that userdata partition starts at sector 4521984.
So in order to resize partition (for example 53G instead of 55,8G).
Code:
adb shell
cd /tmp
umount /data
umount /sdcard
echo "4521984,53G" | ./sfdisk-arm --no-reread -N 28 /dev/block/mmcblk0
Click to expand...
Click to collapse
If I understand correctly, the system partition will now be 2.8 GB larger. So it will have a total of about 4.1 GB. Is that so?
BTW this is very good work. :good::good::good::good:
BoquinhaSK said:
If I understand correctly, the system partition will now be 2.8 GB larger. So it will have a total of about 4.1 GB. Is that so?
Click to expand...
Click to collapse
the /system partition are 'moved' at the end of the resized userdata partition.. so it's only 2.8G
I've made this decision for two reasons
no needs to move critical partitions
the unused space (the old /system partition) can be used in another way(for example a larger cache partition or a vendor partition)
BoquinhaSK said:
BTW this is very good work.
Click to expand...
Click to collapse
Thanks a lot
Michele
EDIT: another reason for this method is that almost all custom roms works
I have one small problem. Internal storage (/sdcard) I haven't defined. Is it defined as "Invalid partition selection." Full storage is for /data.
How I can mount /sdcard?
Edit: I mean this: /sdcard, /storage/emulated/0, /data/media/0
I changed partition system to ext2 in TWRP.
And system partition si bigger. This works.
Edit2:
I have problem with flash new ROM. Flashing change filesystem from ext2 to ext4 always with smaller previous value. I have problem maybe with script. But I try it again tomorrow.
BoquinhaSK said:
I have one small problem. Internal storage (/sdcard) I haven't defined. Is it defined as "Invalid partition selection." Full storage is for /data.
How I can mount /sdcard?
Edit: I mean this: /sdcard, /storage/emulated/0, /data/media/0
Click to expand...
Click to collapse
after formatting /data the filesystem is empty.. these directories are created when you first start android(if not found)
BoquinhaSK said:
Edit2:
I have problem with flash new ROM. Flashing change filesystem from ext2 to ext4 always with smaller previous value.
Click to expand...
Click to collapse
This is normal. Starting from nougat/oreo the building process of an android system creates a block-based flashable zip.
This means that the system partition is preformatted in ext4 and (for Oneplus One) with a size of 1.3G (the original /system partition). So you cannot change the type of filesystem.
BoquinhaSK said:
I have problem maybe with script. But I try it again tomorrow.
Click to expand...
Click to collapse
Check if the script has the right permission (I'll update the guide).
Also keep in mind that, like others addon.d scrips, it works only with the OTA updater.
If you flash directly from recovery (changing rom, or dirty flash) you need to manually repeat the steps described for resizing partition and installing the script.
I've planned to create a flashable zip to automate these steps.
Thanks
Michele
little update... I've uploaded a simple flashable zip that resize filesystem of /system partition and install the addon.d script.
The procedure now is more simpler.
ilmich said:
little update... I've uploaded a simple flashable zip that resize filesystem of /system partition and install the addon.d script.
The procedure now is more simpler.
Click to expand...
Click to collapse
Hi ilmich, I followed your guide while flashing LOS 17.1 on my OPO and this allowed me to have a /system partition large enough to be able to have a large GApps installation, so cheers for that! However, I installed an OTA update on LOS 17.1 today (29/10 update) and that rebooted to TWRP which seemed to have installed the zip, but then entered a boot loop with several "Could not find x for ctl.interface_start" on the dmesg log. I can see the resizesystem script in the addon.d folder but something must've gone wrong because the partitions seem to have been restored to its default and /system seems to be 1.3GB again in TWRP. I will pull the partition table and post it here.
Update:
I was wrong, /system seems to be the same size on running sfdisk. The cause of the update fail must be somewhere else. Here's the /system partition from sfdisk:
Code:
/dev/block/mmcblk0p14 : start= 115671040, size= 5881856, type=EBD0A0A2-B9E5-4433-87C0-68B6B72699C7, uuid=B17FA16F-3B1D-8D12-329D-88B49B096554, name="system", attrs="GUID:60"
I still don't understand why TWRP displays /system as 1303MB again though. Any idea?
Still working...?
Are you still working on this guide?
I'ld love to try it, but I'm a little frightened since there seem to be issues about future udates of Lineage (see previous post).
Zyndstoff said:
Are you still working on this guide?
I'ld love to try it, but I'm a little frightened since there seem to be issues about future udates of Lineage (see previous post).
Click to expand...
Click to collapse
Sorry for the late reply. For sure, but for now, I don't have with me my opo.
But if I understand correctly
BoquinhaSK said:
Update:
I was wrong, /system seems to be the same size on running sfdisk. The cause of the update fail must be somewhere else.
Click to expand...
Click to collapse
update problems are not the repartition procedure.
BoquinhaSK said:
I still don't understand why TWRP displays /system as 1303MB again though. Any idea?
Click to expand...
Click to collapse
I suppose that TWRP is built with 1.3Gb size limit (like everything that is based on opo device tree) and without mounting the filesystem show this static value.
But the power of this procedure (and the resize script) is that you can safely install your preferred rom. The filesystem is expanded in order to fill the 'new' partition size.
During my experiments, I've updated a lineage os (also simulating OTA by pushing a recovery command into the /cache partition), with and without GAPPS.
This guide, if executed step by step, should be safe.
I'm testing again my procedure. This is my situation
Code:
bacon:/ $ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/block/mmcblk0p14 2.7G 1.0G 1.7G 38% /
/dev/block/mmcblk0p28 52G 15G 37G 30% /data
I've latest official lineageos with some Gapps.
Now I'm waiting for an official OTA to see if anything goes wrong.
Hi all,
I've uploaded a new bacon-resize-system.zip that fixes the issue with OTA (wrong escape sequence when creating survival script in the updater binary).
Thanks all for the bug report.
Cheers
Michele
ilmich said:
Hi all,
I've uploaded a new bacon-resize-system.zip that fixes the issue with OTA (wrong escape sequence when creating survival script in the updater binary).
Thanks all for the bug report.
Cheers
Michele
Click to expand...
Click to collapse
Hello sir,
I am still using OPO in 2021 and i want 5gb system partition.. What will be start and end sectors for that changes? I am really confused so can you please recreate your post for 5gb and will you post it in reply?
Another one question if i flashed stock rom via fastboot then it will restore partition size to default or changes still remain which we did?
Thank You.
pbankar7 said:
Hello sir,
I am still using OPO in 2021 and i want 5gb system partition.. What will be start and end sectors for that changes? I am really confused so can you please recreate your post for 5gb and will you post it in reply?
Another one question if i flashed stock rom via fastboot then it will restore partition size to default or changes still remain which we did?
Thank You.
Click to expand...
Click to collapse
Code:
adb shell
cd /tmp
umount /data
umount /sdcard
echo "4521984,51G" | ./sfdisk-arm --no-reread -N 28 /dev/block/mmcblk0
After that
Code:
Device Start End Sectors Size Type
/dev/block/mmcblk0p28 4521984 111476735 106954752 51G unknown
After this
Code:
echo "111476736,+" | ./sfdisk-arm --no-reread -N 14 /dev/block/mmcblk0
Am I right for 4.8gb??
Please answer of this 2 questions
1. If i flashed stock rom via fastboot then it will restore partition size to default or changes still remains which we did?
2. It is necessary to flash bacon-resize-system.zip everytime whenever we flash new custom rom or after ota updates?
Thank You.
ilmich said:
WARNING!!!​Everyone is responsible for the proper functioning of their device. This guide is the result of personal experiments and I'm not responsible for any damage caused to your device as a result of improper use of its contents.
Introduction
Stock partitions layout has a 1.3Gb /system partition that is too small for users that flash modern custom roms + some kinds of google apps.
This is a step by step guide to change the layout of the partitions table with a bigger /system partition.
How
On OnePlus One, stock partition table looks like the following
Code:
... ... ...
/dev/block/mmcblk0p14 : start= 294912, name="system"
/dev/block/mmcblk0p15 : start= 3006464, name="persist"
/dev/block/mmcblk0p16 : start= 3072000, name="cache"
... ... ...
/dev/block/mmcblk0p28 : start= 4521984, name="userdata"
/dev/block/mmcblk0p29 : start= 121552896, name="grow"
With this layout, resizing the /system partition may seem difficult because it's close to other very important partitions.
So I've experimented with another approach. By resizing userdata partition, and relocate the /system partition at the beginning of the resulting free space, other partitions are left untouched.
There are mainly two (little) issues
almost all custom roms out of there assume that /system partition is 1.3gb of size
on internal storage the old area of /system partition are unused.
For the first point, the solution is to resize the filesystem when you first flash a custom rom. To automatically resize filesystem at every update there is an addon.d script.
For the second point the new free space available (the old 1.3G /system partition) can be used as a new /cache partition.
And, again, the new free space available (the old /cache partition) can be the famous /vendor partition (that is out of the scope of this guide).
This guide uses the sfdisk tool from util-linux. In my opinion, it's more powerful than parted and it's easy to use via script.
IMPORTANT - Before you start
Obviously, this method is destructive regarding userdata partition, so make a full backup of your data.
Manually resizing filesystem of /system partition is needed only once because the addon.d script will ensure that everything works as expected. The only exception is when you wipe /system and flash a new rom
Prerequisites
a working TWRP recovery installed on device
knowledge of adb tools
a statically cross compiled sfdisk tool (you can self compile, or use the one attached below)
this addon.d script (thanks to @osmosis)
flashable zip of a custom rom (and optionally gapps, magisk etc etc etc)
flashable zip bacon-resize-system.zip (attached on this post)
Let's go
enter TWRP recovery and connect phone on a PC
push sfdisk into a temporary dir and ensure is executable
Code:
adb push sfdisk-arm /tmp
adb shell
cd /tmp
chmod 755 sfdisk-arm
make and pull a backup of your partition table (there is also the 64Gb stock layout in attachments)
Code:
./sfdisk-arm -d /dev/block/mmcblk0 > bacon.gpt
exit
adb pull /tmp/bacon.gpt
looking into the partition table you see that userdata partition starts at sector 4521984.
So in order to resize partition (for example 53G instead of 55,8G).
Code:
adb shell
cd /tmp
umount /data
umount /sdcard
echo "4521984,53G" | ./sfdisk-arm --no-reread -N 28 /dev/block/mmcblk0
. Scrolling down the output of this command the new userdata partition is
Code:
Device Start End Sectors Size Type
/dev/block/mmcblk0p28 4521984 115671039 111149056 53G unknown
so the start sector of /system partition will be 115671040 (115671039+1)
relocating system partition at the end of the new userdata partition(size now will be 2,8G)
Code:
echo "115671040,+" | ./sfdisk-arm --no-reread -N 14 /dev/block/mmcblk0
reboot recovery (kernel need to reload partition table)
Code:
reboot recovery
format userdata with TWRP(no wipe... full format)
push custom rom with adb and flash with TWRP (without rebooting)
flash bacon-resize-system.zip
finish.. you can now reboot or continue with flashing gapps, magisk etc etc (but now with a bigger system partition)
Rollback
TODO
Nice to have
flashable zip for addon.d script (WIP)(DONE)
Click to expand...
Click to collapse
I'm interested in installing Ubuntu touch on my OnePlus One but since I used this guide successfully to resize my system partition I don't think I can install it without restoring the partition tables. How can I restore the partitions properly without bricking my phone?
Hi all. Please help.
I ruined my OPO phone.
iI followed the steps correctly.
After reboot the system partition cannot mount.
I see in the log:
Failed to mount '/system' (invalid argument)
My GPT after the change:
/tmp # fdisk -l /dev/block/mmcblk0
Found valid GPT with protective MBR; using GPT
Disk /dev/block/mmcblk0: 122142720 sectors, 2296M
Logical sector size: 512
Disk identifier (GUID): 98101b32-bbe2-4bf2-a06e-2bb33d000c20
Partition table holds up to 32 entries
First usable sector is 34, last usable sector is 122142686
Number Start (sector) End (sector) Size Code Name
1 16384 147455 64.0M 0700 modem
2 147456 148479 512K 0700 sbl1
3 148480 148543 32768 0700 dbi
4 163840 163903 32768 0700 DDR
5 180224 182271 1024K 0700 aboot
6 182272 183271 500K 0700 rpm
7 196608 229375 16.0M 0700 boot
8 229376 230375 500K 0700 tz
9 230376 232423 1024K 0700 pad
10 232424 235495 1536K 0700 modemst1
11 235496 238567 1536K 0700 modemst2
12 238568 259047 10.0M 0700 oppodycnvbk
13 259048 279527 10.0M 0700 oppostanvbk
14 115671040 121552895 2872M 0700 system
15 3006464 3071999 32.0M 0700 persist
16 3072000 4120575 512M 0700 cache
17 4120576 4153343 16.0M 0700 recovery
18 4153344 4156415 1536K 0700 fsg
19 4161536 4161537 1024 0700 fsc
20 4161538 4161553 8192 0700 ssd
21 4161554 4163601 1024K 0700 misc
22 4163602 4196369 16.0M 0700 LOGO
23 4196370 4261905 32.0M 0700 DRIVER
24 4261906 4327441 32.0M 0700 reserve1
25 4327442 4360209 16.0M 0700 reserve2
26 4360210 4376593 8192K 0700 reserve3
27 4376594 4507665 64.0M 0700 reserve4
28 4521984 115671039 53.0G 0700 userdata
29 121552896 122142686 287M 0700 grow
/tmp # cat /etc/fstab
/dev/block/mmcblk0p1 /firmware vfat rw 0 0
/dev/block/mmcblk0p14 /system ext4 rw 0 0
/dev/block/mmcblk0p28 /data ext4 rw 0 0
/dev/block/mmcblk0p16 /cache ext4 rw 0 0
/tmp # df -h
Filesystem Size Used Available Use% Mounted on
tmpfs 1.4G 32.0K 1.4G 0% /dev
tmpfs 1.4G 28.0K 1.4G 0% /tmp
/dev/block/mmcblk0p16
503.9M 8.4M 495.5M 2% /cache
/dev/block/mmcblk0p28
52.2G 180.0M 52.0G 0% /data
/dev/block/mmcblk0p28
52.2G 180.0M 52.0G 0% /sdcard
dimitrios5000 said:
Hi all. Please help.
I ruined my OPO phone.
iI followed the steps correctly.
After reboot the system partition cannot mount.
I see in the log:
Failed to mount '/system' (invalid argument)
My GPT after the change:
/tmp # fdisk -l /dev/block/mmcblk0
Found valid GPT with protective MBR; using GPT
Disk /dev/block/mmcblk0: 122142720 sectors, 2296M
Logical sector size: 512
Disk identifier (GUID): 98101b32-bbe2-4bf2-a06e-2bb33d000c20
Partition table holds up to 32 entries
First usable sector is 34, last usable sector is 122142686
Number Start (sector) End (sector) Size Code Name
1 16384 147455 64.0M 0700 modem
2 147456 148479 512K 0700 sbl1
3 148480 148543 32768 0700 dbi
4 163840 163903 32768 0700 DDR
5 180224 182271 1024K 0700 aboot
6 182272 183271 500K 0700 rpm
7 196608 229375 16.0M 0700 boot
8 229376 230375 500K 0700 tz
9 230376 232423 1024K 0700 pad
10 232424 235495 1536K 0700 modemst1
11 235496 238567 1536K 0700 modemst2
12 238568 259047 10.0M 0700 oppodycnvbk
13 259048 279527 10.0M 0700 oppostanvbk
14 115671040 121552895 2872M 0700 system
15 3006464 3071999 32.0M 0700 persist
16 3072000 4120575 512M 0700 cache
17 4120576 4153343 16.0M 0700 recovery
18 4153344 4156415 1536K 0700 fsg
19 4161536 4161537 1024 0700 fsc
20 4161538 4161553 8192 0700 ssd
21 4161554 4163601 1024K 0700 misc
22 4163602 4196369 16.0M 0700 LOGO
23 4196370 4261905 32.0M 0700 DRIVER
24 4261906 4327441 32.0M 0700 reserve1
25 4327442 4360209 16.0M 0700 reserve2
26 4360210 4376593 8192K 0700 reserve3
27 4376594 4507665 64.0M 0700 reserve4
28 4521984 115671039 53.0G 0700 userdata
29 121552896 122142686 287M 0700 grow
/tmp # cat /etc/fstab
/dev/block/mmcblk0p1 /firmware vfat rw 0 0
/dev/block/mmcblk0p14 /system ext4 rw 0 0
/dev/block/mmcblk0p28 /data ext4 rw 0 0
/dev/block/mmcblk0p16 /cache ext4 rw 0 0
/tmp # df -h
Filesystem Size Used Available Use% Mounted on
tmpfs 1.4G 32.0K 1.4G 0% /dev
tmpfs 1.4G 28.0K 1.4G 0% /tmp
/dev/block/mmcblk0p16
503.9M 8.4M 495.5M 2% /cache
/dev/block/mmcblk0p28
52.2G 180.0M 52.0G 0% /data
/dev/block/mmcblk0p28
52.2G 180.0M 52.0G 0% /sdcard
Click to expand...
Click to collapse
have you figured it out?
i was succeeded, through
Failed to mount '/system' (invalid argument)
i have seen also.
i was able to sideload lineage and boot it.
After rebooting into recovery the error message was away.
After that i sideloaded lienage again, then bacon-resize-system.zip.
After that i was able to sideload Gapps Nano, the required size check was successful
Oh wait, you have OPO Phone, not OnePlus One
you can try to restore your partiotion table from backup created earlier
Bash:
./sfdisk-arm -f /dev/block/mmcblk0 < bacon.gpt
OnePlus One (Bacon) 3/64
twrp-3.6.0_9-0-bacon.img
lineage-18.1-20211223-nightly-bacon-signed.zip
open_gapps-arm-11.0-nano-20220112.zip

A20e Data Recovery without root?

Hi,
Samsung Galaxy A20e SM-A202F/DS Android 11
My intention is to delete some photos that have been accidentally deleted.
All Windows Trial Applications I tried require root to be able to execute deep scan.
Is it possible to execute deep scan without root?
For example using download or recovery mode or copy the data partition to PC and scan using testdisk?
And if not is it possible to undo root / reset the knox counter?
Thank you in advance.
How to recover a deleted file from /data partition?
I factory reset my rooted Android M phone but now I realize that there was a file in the /data directory which I need. Is it possible to create an image (.img or something similar) of the /data
android.stackexchange.com
Code:
C:\Program Files (x86)\Minimal ADB and Fastboot>adb shell
a20e:/ $ mount | grep 'on /data'
/dev/block/mmcblk0p32 on /data type ext4 (rw,seclabel,nosuid,nodev,noatime,journal_checksum,noauto_da_alloc,resgid=5678,i_version)
/dev/block/mmcblk0p32 on /data/user/0 type ext4 (rw,seclabel,nosuid,nodev,noatime,journal_checksum,noauto_da_alloc,resgid=5678,i_version)
tmpfs on /data_mirror type tmpfs (rw,seclabel,nosuid,nodev,noexec,relatime,size=1394256k,nr_inodes=348564,mode=700,gid=1000)
/dev/block/mmcblk0p32 on /data_mirror/data_ce/null type ext4 (rw,seclabel,nosuid,nodev,noatime,journal_checksum,noauto_da_alloc,resgid=5678,i_version)
/dev/block/mmcblk0p32 on /data_mirror/data_ce/null/0 type ext4 (rw,seclabel,nosuid,nodev,noatime,journal_checksum,noauto_da_alloc,resgid=5678,i_version)
/dev/block/mmcblk0p32 on /data_mirror/data_de/null type ext4 (rw,seclabel,nosuid,nodev,noatime,journal_checksum,noauto_da_alloc,resgid=5678,i_version)
/dev/block/mmcblk0p32 on /data_mirror/cur_profiles type ext4 (rw,seclabel,nosuid,nodev,noatime,journal_checksum,noauto_da_alloc,resgid=5678,i_version)
a20e:/ $ df -h
Filesystem Size Used Avail Use% Mounted on
/dev/root 3.9G 3.8G 126M 97% /
tmpfs 1.3G 1.3M 1.3G 1% /dev
tmpfs 1.3G 0 1.3G 0% /mnt
/dev/block/dm-1 542M 467M 76M 87% /product
/dev/block/dm-2 504M 316M 188M 63% /vendor
tmpfs 1.3G 0 1.3G 0% /apex
/dev/block/mmcblk0p29 45M 24K 45M 1% /omr
/dev/block/mmcblk0p28 390M 17M 373M 5% /cache
tmpfs 1.3G 0 1.3G 0% /mnt/sde
/dev/block/mmcblk0p32 23G 11G 11G 51% /data
/dev/block/mmcblk0p4 16M 432K 15M 3% /efs
/dev/fuse 23G 12G 11G 51% /storage/emulated

Categories

Resources