[Q?] Problem with /efs partition (can't mount but IMEI OK) - Galaxy S 4 Q&A, Help & Troubleshooting

Problem with /efs partition (can't mount but IMEI OK)
Hi guys,
I've been searching for two days before posting this.. I'm completely mad on how to repair this problem.
I tried to flash a custom recovery on my GT-9505 doing this in terminal (of course my phone was rooted):
su
dd if=/sdcard/recovery.img of=/dev/block/mmcblk0p10
The problem is that I flashed the recovery on the wrong partition, as /mmcblk0p10 is for /efs (right?)
I was on stock firmware I9505XXUDMH8.
When I reboot, phone went on factory mode and I couldn't make calls. Wifi was working right.
I flashed CM 10.1.3 last night and now I can make calls. IMEI and wifi mac are shown ok in status, but bt is not not available and I think serial number is wrong (3403a6f2??)
I suppose that if I go back to stock the problem will be the same with factory mode and no calls because flashing this won't write on /efs.
I have a backup of efs (efs_19700508_054443.img) (~13MB) done in philz touch recovery, but this was made after I corrupted the /efs.
So the problem is I can't mount /efs in recovery neither in File Manager or terminal.
Any ideas on what can I do to repair it?? Thanks in advance and sorry if I have posted in wrong place

Update:
I've made another backup but with EFS Professional: GT-I9505_20131026_190930.tar.gz -> efs.img.ext4
If it holds for something...

Edit: BT address is showing correctly when BT is ON (sorry for that mistake!)
So the only thing is showing wrong (i think) is serial number.
i still cannot mount /efs nor access it via root explorer...:crying:

If I'm on Windows 7, is there any way to mount the efs.img file to edit files into it? (I.e. Like in daemon tools)
If I can format /efs then I'll only hace to edit the files in efs.img to edit my serial number for the good one and copy these files into /efs.
Then my /efs partition won't be corrupted and I will be able to mount it
Someone can give any idea?

Up!

Up!

Uuuup..!

If I restore the .img backup that I have of /efs in recovery it doesn't change anything... Maybe cause it's corrupted?

fran41 said:
If I restore the .img backup that I have of /efs in recovery it doesn't change anything... Maybe cause it's corrupted?
Click to expand...
Click to collapse
try these commands in terminal emulator:
Code:
su
mount -o remount,rw -t ext4 /dev/block/mmcblk0p10 /efs
echo -n ON > /efs/FactoryApp/keystr
echo -n ON > /efs/FactoryApp/factorymode
sync
reboot

samersh72 said:
try these commands in terminal emulator:
Code:
su
mount -o remount,rw -t ext4 /dev/block/mmcblk0p10 /efs
echo -n ON > /efs/FactoryApp/keystr
echo -n ON > /efs/FactoryApp/factorymode
sync
reboot
Click to expand...
Click to collapse
Thanks for reply.
First line (mount -o remount,rw -t ext4 /dev/block/mmcblk0p10 /efs) Mount: invalid argument
Something spelled wrong?

fran41 said:
Thanks for reply.
First line (mount -o remount,rw -t ext4 /dev/block/mmcblk0p10 /efs) Mount: invalid argument
Something spelled wrong?
Click to expand...
Click to collapse
Ok, try without first command (mount....)
if not try this
Code:
mount -w -t ext4 /dev/block/mmcblk0p10

samersh72 said:
Ok, try without first command (mount....)
if not try this
Code:
mount -w -t ext4 /dev/block/mmcblk0p10
Click to expand...
Click to collapse
[email protected]:/ # echo -n ON > /efs/FactoryApp/keystr
sh: can't create /efs/FactoryApp/keystr: No such file or directory
[email protected]:/ # mount -w -t ext4 /dev/block/mmcblk0p10
Usage: mount [-r] [-w] [-o options] [-t type] device directory
Should be like this??:
[email protected]:/ # mount -w -t ext4 /dev/block/mmcblk0p10 /efs
mount: Invalid argument

fran41 said:
[email protected]:/ # echo -n ON > /efs/FactoryApp/keystr
sh: can't create /efs/FactoryApp/keystr: No such file or directory
[email protected]:/ # mount -w -t ext4 /dev/block/mmcblk0p10
Usage: mount [-r] [-w] [-o options] [-t type] device directory
Should be like this??:
[email protected]:/ # mount -w -t ext4 /dev/block/mmcblk0p10 /efs
mount: Invalid argument
Click to expand...
Click to collapse
it is weird! try:
Code:
mount -r -w -o remount,rw -t ext4 /dev/block/mmcblk0p10
or
Code:
mount -r -w -o remount,rw -t ext4 /dev/block/mmcblk0p10 /efs

samersh72 said:
it is weird! try:
Code:
mount -r -w -o remount,rw -t ext4 /dev/block/mmcblk0p10
or
Code:
mount -r -w -o remount,rw -t ext4 /dev/block/mmcblk0p10 /efs
Click to expand...
Click to collapse
[email protected]:/ # mount -r -w -o remount,rw -t ext4 /dev/block/mmcblk0p10
mount -r -w -o remount,rw -t ext4 /dev/block/mmcblk0p10
Usage: mount [-r] [-w] [-o options] [-t type] device directory
1|[email protected]:/ # mount -r -w -o remount,rw -t ext4 /dev/block/mmcblk0p10 /efs
mount: Invalid argument

fran41 said:
[email protected]:/ # mount -r -w -o remount,rw -t ext4 /dev/block/mmcblk0p10
mount -r -w -o remount,rw -t ext4 /dev/block/mmcblk0p10
Usage: mount [-r] [-w] [-o options] [-t type] device directory
1|[email protected]:/ # mount -r -w -o remount,rw -t ext4 /dev/block/mmcblk0p10 /efs
ext4 /dev/block/mmcblk0p10 /efs <
mount: Invalid argument
Click to expand...
Click to collapse
this command work for me (mount -o remount,rw -t ext4 /dev/block/mmcblk0p10)
i dont know what is the matter with your efs partition!
by the way, install busybox then do the commands

samersh72 said:
this command work for me (mount -o remount,rw -t ext4 /dev/block/mmcblk0p10)
i dont know what is the matter with your efs partition!
by the way, install busybox then do the commands
Click to expand...
Click to collapse
I have busybox installed! I'm getting mad with this Nothing seems to work...

fran41 said:
I have busybox installed! I'm getting mad with this Nothing seems to work...
Click to expand...
Click to collapse
try to re-partition the phone partitions using pit file with the firmware, it may help

samersh72 said:
try to re-partition the phone partition using pit file with the firmware, it may help
Click to expand...
Click to collapse
I did that once flashing it with stock and nothing...

fran41 said:
I did that once flashing it with stock and nothing...
Click to expand...
Click to collapse
my last commands to mount efs (make sure that busybox binaries are installed from the application)
Code:
mke2fs /dev/block/mmcblk0p10
mount -w -t ext4 /dev/block/mmcblk0p10 /efs
or
Code:
busybox mount -w -t ext4 /dev/block/mmcblk0p10 /efs
you can try also to flash the modem twice in odin as "phone"
if not, i guess you have the service center option

samersh72 said:
my last commands to mount efs (make sure that busybox binaries are installed from the application)
Code:
mke2fs /dev/block/mmcblk0p10
mount -w -t ext4 /dev/block/mmcblk0p10 /efs
or
Code:
busybox mount -w -t ext4 /dev/block/mmcblk0p10 /efs
you can try also to flash the modem twice in odin as "phone"
if not, i guess you have the service center option
Click to expand...
Click to collapse
This doesn't work:
[email protected]:/ # busybox mount -w -t ext4 /dev/block/mmcblk0p10 /efs
busybox mount -w -t ext4 /dev/block/mmcblk0p10 /efs
mount: mounting /dev/block/mmcblk0p10 on /efs failed: Invalid argument
This works:
255|[email protected]:/ # mke2fs /dev/block/mmcblk0p10
mke2fs /dev/block/mmcblk0p10
mke2fs 1.41.14 (22-Dec-2010)
Filesystem label=
OS type: Linux
Block size=1024 (log=0)
Fragment size=1024 (log=0)
Stride=0 blocks, Stripe width=0 blocks
3488 inodes, 13952 blocks
697 blocks (5.00%) reserved for the super user
First data block=1
Maximum filesystem blocks=14417920
2 block groups
8192 blocks per group, 8192 fragments per group
1744 inodes per group
Superblock backups stored on blocks:
8193
Writing inode tables: done
Writing superblocks and filesystem accounting information: done
This filesystem will be automatically checked every 27 mounts or
180 days, whichever comes first. Use tune2fs -c or -i to override.
[email protected]:/ #
[email protected]:/ # mount -w -t ext4 /dev/block/mmcblk0p10 /efs
mount -w -t ext4 /dev/block/mmcblk0p10 /efs
[email protected]:/ #
Now I go to /efs in root explorer and there's a folder lost+found

Related

About data2loop to increase stability

My English is poor, so I only give the code, without more explanation.
code modiy from ownhere's data2ext
create 3rd ext4 partion for loopback device.
Please note '-o sync,commit=5',This will enhance the stability.
Code:
$BUSYBOX mknod /dev/loop0 b 7 0
$BUSYBOX losetup /dev/loop0 /dev/block/mmcblk3p3
$BUSYBOX mount -t ext4 -o sync,commit=5,barrier=1,nouser_xattr,errors=continue,noatime,nodiratime,nosuid,nodev /dev/loop0 /mnt/asec/extdata
you can turn off journal for speed:
Code:
/system/bin/tune2fs -O ^has_journal /dev/block/mmcblk3p3
Code:
busybox ls -lL /dev/loop*
brw------- 1 0 0 7, 0 Jan 9 19:17 /dev/loop0
brw------- 1 0 0 7, 1 Jan 9 19:17 /dev/loop1
brw------- 1 0 0 7, 2 Jan 9 19:17 /dev/loop2
brw------- 1 0 0 7, 3 Jan 9 19:17 /dev/loop3
brw------- 1 0 0 7, 4 Jan 9 19:17 /dev/loop4
brw------- 1 0 0 7, 5 Jan 9 19:17 /dev/loop5
brw------- 1 0 0 7, 6 Jan 9 19:17 /dev/loop6
brw------- 1 0 0 7, 7 Jan 9 19:17 /dev/loop7
Scoring won't be so high, but stability will increase a lot
Hi Chenglu, I've actually already tried to modify your original data2loop script to use ext4 and run it with a kernel with ext4 built in. It actually benchmarks great on first boot, somewhat better than the original ext2 data2loop version, but the tablet won't boot again, it crashes sometime during boot and I have to wipe data and restart.
Not sure if the sync,commit=5 options will make a difference - maybe I'll give that a try and see if it helps...
EDIT: No, it still pukes out on reboot, those options don't make a difference. I've attached my inandop.sh file here. If you diff this with yours, there are only a few changes, and I'm just not sure why it doesn't work. Any ideas?
Chenglu...
Thanks... this should help... but I am still very concerned with this approach..
Even though you are performing a sync you still can not guarantee that the data has been flushed out.. Flushing will depend on what other operations are in queue within the I/O sub system. In addition, right now you have a commit of every 5 seconds which honestly again leaves room for possible corruption. Again should help as this setting is meant for removable storage...
Lastly DO NOT turn off the Journal. yes it will speed up the file system BUT at a HUUGE risk of data loss in the event of unclean shutdown. This is your only fail safe that ensures filesystem consistency even across unclean shutdown.
Generally I agree with this approach for many situations but NOT your entire system partition or critical data partitions...
These devices are too portable with unreliable power sources (not the battery but the ability for it to reboot on its own and the ability for you to accidentally power it off)..
I for one am against this performance boost...
Chenglu said:
My English is poor, so I only give the code, without more explanation.
code modiy from ownhere's data2ext
create 3rd ext4 partion for loopback device.
Please note '-o sync,commit=5',This will enhance the stability.
Code:
$BUSYBOX mknod /dev/loop0 b 7 0
$BUSYBOX losetup /dev/loop0 /dev/block/mmcblk3p3
$BUSYBOX mount -t ext4 -o sync,commit=5,barrier=1,nouser_xattr,errors=continue,noatime,nodiratime,nosuid,nodev /dev/loop0 /mnt/asec/extdata
you can turn off journal for speed:
Code:
/system/bin/tune2fs -O ^has_journal /dev/block/mmcblk3p3
Code:
busybox ls -lL /dev/loop*
brw------- 1 0 0 7, 0 Jan 9 19:17 /dev/loop0
brw------- 1 0 0 7, 1 Jan 9 19:17 /dev/loop1
brw------- 1 0 0 7, 2 Jan 9 19:17 /dev/loop2
brw------- 1 0 0 7, 3 Jan 9 19:17 /dev/loop3
brw------- 1 0 0 7, 4 Jan 9 19:17 /dev/loop4
brw------- 1 0 0 7, 5 Jan 9 19:17 /dev/loop5
brw------- 1 0 0 7, 6 Jan 9 19:17 /dev/loop6
brw------- 1 0 0 7, 7 Jan 9 19:17 /dev/loop7
Click to expand...
Click to collapse
Fast internal storage and ext4 partion is the fundamental solution.
loopback device In some respects have an advantage.
I dont dispute the performance gain... but at a risk. Everyone should be aware of this and accept the risk... If you do then thats fine...
I guess I'm more conservative when it comes to my data.
Chenglu said:
Fast internal storage and ext4 partion is the fundamental solution.
loopback device In some respects have an advantage.
Click to expand...
Click to collapse
rcgabriel said:
Hi Chenglu, I've actually already tried to modify your original data2loop script to use ext4 and run it with a kernel with ext4 built in. It actually benchmarks great on first boot, somewhat better than the original ext2 data2loop version, but the tablet won't boot again, it crashes sometime during boot and I have to wipe data and restart.
Not sure if the sync,commit=5 options will make a difference - maybe I'll give that a try and see if it helps...
EDIT: No, it still pukes out on reboot, those options don't make a difference. I've attached my inandop.sh file here. If you diff this with yours, there are only a few changes, and I'm just not sure why it doesn't work. Any ideas?
Click to expand...
Click to collapse
your busybox support ext4?
Chenglu said:
your busybox support ext4?
Click to expand...
Click to collapse
good point, that was a mistake. I am now using a statically compiled version of mkfs.ext4 that seems to work. Mount doesn't need explicit ext4 support in busybox, should just work. And I think I'm using a version of fsck that supports ext4.
EDIT: Okay, I'm using mkfs.ext4 which I've tested from the command line and it is clearly making a real ext4 filesystem. Also using a version of es2fsck that ought to work with ext4. These are both from the Desire forums, but seem to be generic ARM binaries so they seem to run on our G Tablet.
Still same result - works on first boot, not thereafter.
Maybe I need to use a version of busybox that explicitly supports ext4? Trying that next.
BTW, I got the binaries I'm using from the data2ext.zip file here: http://forum.xda-developers.com/showthread.php?t=859419
Also - ownhere's script looks pretty badass. We should consider using something based on that.
EDIT2: I am using busybox, mkfs.ext4 and e2fsck from the Desire forums, so it should support ext4 fully. Nonetheless, the exact same screen flicker followed by screen shutting off occurs with this. Attached is my updated inandop.sh. This is just baffling.
rcgabriel said:
good point, that was a mistake. I am now using a statically compiled version of mkfs.ext4 that seems to work. Mount doesn't need explicit ext4 support in busybox, should just work. And I think I'm using a version of fsck that supports ext4.
EDIT: Okay, I'm using mkfs.ext4 which I've tested from the command line and it is clearly making a real ext4 filesystem. Also using a version of es2fsck that ought to work with ext4. These are both from the Desire forums, but seem to be generic ARM binaries so they seem to run on our G Tablet.
Still same result - works on first boot, not thereafter.
Maybe I need to use a version of busybox that explicitly supports ext4? Trying that next.
BTW, I got the binaries I'm using from the data2ext.zip file here: http://forum.xda-developers.com/showthread.php?t=859419
Also - ownhere's script looks pretty badass. We should consider using something based on that.
EDIT2: I am using busybox, mkfs.ext4 and e2fsck from the Desire forums, so it should support ext4 fully. Nonetheless, the exact same screen flicker followed by screen shutting off occurs with this. Attached is my updated inandop.sh. This is just baffling.
Click to expand...
Click to collapse
I'm working on this as well...
Took a look at your script. It looks like you've put everything (including busybox) into /system/bin instead of /system/xbin? Your environment variable for busybox shows /system/bin...
Just wanted to confirm...
rcgabriel said:
EDIT2: I am using busybox, mkfs.ext4 and e2fsck from the Desire forums, so it should support ext4 fully. Nonetheless, the exact same screen flicker followed by screen shutting off occurs with this. Attached is my updated inandop.sh. This is just baffling.
Click to expand...
Click to collapse
I'm unable to get the loop file to mount as ext4 with ADB after it fails...
I'm not sure if/why it actually mounted in the first place, but I'm thinking this is a kernel issue. Are you positive that your kernel supports ext4? Also, I'm thinking ext4 might need to be compiled into the kernel instead of a module.
I could be wrong, though....
Also check which mount binary you are using. Busybox has one, but there is also a "mount" sometimes linked to the "toolbox" binary in /system/bin.
Ok so I (sort of) got it working.
After getting a kernel that is known working with ext4, the system was able to mount the partition again. I was getting the vegan "loop", so I went in with ADB and saw that the partition was mounted but all of the files were gone.
I then booted into CW and mounted USB, and at the same time on my PC I extracted my /data/data folder from a recent clockwork backup and copied it to /sdcard. I then unmounted USB and mounted /system and /sdcard from CW. Then from ADB I copied the data folder over to /mnt/asec/extdata and fixed the perms. I created empty folders for app-private and anr because they were empty on my backup (other than a traces.txt file in anr).
After bouncing the tab it booted up, but some of my settings were blown away. No big deal. Quadrant crashes at the I/O test part, but it might be because I don't have an Internet connection. The wifi is broken with the kernel I'm using.
Let me know if you still can't get things mounted. I'll test this more tomorrow when I get a fixed kernel.
I'm going to start working on the alternate approach of adding a 3rd partition...
anlog said:
Ok so I (sort of) got it working.
After getting a kernel that is known working with ext4, the system was able to mount the partition again. I was getting the vegan "loop", so I went in with ADB and saw that the partition was mounted but all of the files were gone.
I then booted into CW and mounted USB, and at the same time on my PC I extracted my /data/data folder from a recent clockwork backup and copied it to /sdcard. I then unmounted USB and mounted /system and /sdcard from CW. Then from ADB I copied the data folder over to /mnt/asec/extdata and fixed the perms. I created empty folders for app-private and anr because they were empty on my backup (other than a traces.txt file in anr).
After bouncing the tab it booted up, but some of my settings were blown away. No big deal. Quadrant crashes at the I/O test part, but it might be because I don't have an Internet connection. The wifi is broken with the kernel I'm using.
Let me know if you still can't get things mounted. I'll test this more tomorrow when I get a fixed kernel.
I'm going to start working on the alternate approach of adding a 3rd partition...
Click to expand...
Click to collapse
The kernel should support ext4, I built it myself with ext4 enabled in the config file. And yeah, I put the busybox executable in /system/bin so it wouldn't conflict with the one in /system/xbin that Vegan already has. I also dumped mkfs.ext4 in /system/bin.
What I realized is that busybox has a nasty habit of failing partially at doing things - I keep assuming that it's exactly like the stock Linux command line tools, and it's not always identical. I ended up tearing out the important stuff and running it as a standalone test script from the command line to see what was happening.
Mkfs.ext4 runs with no obvious issues (I see it creates a journal at the end, so I know it's creating an ext4 filesystem now).
But then I got an error:
Code:
mount: mounting /dev/loop0 on /mnt/asec/extdata failed: Invalid argument
followed by:
Code:
umount: can't umount /mnt/asec/extdata: Invalid argument
e2fsck 1.41.6 (30-May-2009)
ext2fs_check_if_mount: Can't check if filesystem is mounted due to missing mtab file while determining whether /data/ext4 is mounted.
/system/bin/e2fsck: Superblock invalid, trying backup blocks...
/system/bin/e2fsck: Bad magic number in super-block while trying to open /data/ext4
The superblock could not be read or does not describe a correct ext2
filesystem. If the device is valid and it really contains an ext2
filesystem (and not swap or ufs or something else), then the superblock
is corrupt, and you might try running e2fsck with an alternate superblock:
e2fsck -b 8193 <device>
mount: mounting /dev/loop0 on /mnt/asec/extdata failed: Invalid argument
So mount failed to mount the file device that was created - that would seem to be a big issue. And then e2fsck failed to fsck it that one I'm baffled by.
I don't really understand how this "partially works" when it runs from inandop.sh but seems to fail entirely when I run it from the command line, but I sense that it "works once" because something it's getting sometimes written as ext4 sometimes as ext2/3 and that's leading obviously to corruption. Will figure more out later when I have time. I may just try adapting ownhere's script directly, he's obviously put a ton of thought into filesystem stuff and I'm not an expert in that area at all.
rcgabriel said:
The kernel should support ext4, I built it myself with ext4 enabled in the config file. And yeah, I put the busybox executable in /system/bin so it wouldn't conflict with the one in /system/xbin that Vegan already has. I also dumped mkfs.ext4 in /system/bin.
What I realized is that busybox has a nasty habit of failing partially at doing things - I keep assuming that it's exactly like the stock Linux command line tools, and it's not always identical. I ended up tearing out the important stuff and running it as a standalone test script from the command line to see what was happening.
Mkfs.ext4 runs with no obvious issues (I see it creates a journal at the end, so I know it's creating an ext4 filesystem now).
But then I got an error:
Code:
mount: mounting /dev/loop0 on /mnt/asec/extdata failed: Invalid argument
followed by:
Code:
umount: can't umount /mnt/asec/extdata: Invalid argument
e2fsck 1.41.6 (30-May-2009)
ext2fs_check_if_mount: Can't check if filesystem is mounted due to missing mtab file while determining whether /data/ext4 is mounted.
/system/bin/e2fsck: Superblock invalid, trying backup blocks...
/system/bin/e2fsck: Bad magic number in super-block while trying to open /data/ext4
The superblock could not be read or does not describe a correct ext2
filesystem. If the device is valid and it really contains an ext2
filesystem (and not swap or ufs or something else), then the superblock
is corrupt, and you might try running e2fsck with an alternate superblock:
e2fsck -b 8193 <device>
mount: mounting /dev/loop0 on /mnt/asec/extdata failed: Invalid argument
So mount failed to mount the file device that was created - that would seem to be a big issue. And then e2fsck failed to fsck it that one I'm baffled by.
I don't really understand how this "partially works" when it runs from inandop.sh but seems to fail entirely when I run it from the command line, but I sense that it "works once" because something it's getting sometimes written as ext4 sometimes as ext2/3 and that's leading obviously to corruption. Will figure more out later when I have time. I may just try adapting ownhere's script directly, he's obviously put a ton of thought into filesystem stuff and I'm not an expert in that area at all.
Click to expand...
Click to collapse
I was able to reboot 5 times and it kept the settings for me. I just couldnt test all apps because wifi was broken with the kernel I was using. I can test more today.
Are you sure that your ext4 format is completing? I got an mtab error when first trying to create the journal, so I just changed the script to format it with the -O ^has_journal option and it competed.
Vegan runs fine for me with latest busybox...
modify init.rc for mount ext4 /data
you must have tune2fs mkfs.ext4 e2fsck binary file.
Code:
#!/system/bin/sh
##get highest priority
/system/bin/renice -20 -r -g $$
ECHO_TARGET=/misc/inandop.log
BUSYBOX="/system/bin/busybox"
#data2loop by xiaolu
echo "try data2loop" >> $ECHO_TARGET
if [ "`$BUSYBOX df /dev/loop0 | grep loop`" != "" } ; then
exit 0
fi
$BUSYBOX ln -s /dev/block/loop0 /dev/loop0
$BUSYBOX ln -s /dev/block/loop1 /dev/loop1
$BUSYBOX ln -s /dev/block/loop2 /dev/loop2
$BUSYBOX ln -s /dev/block/loop3 /dev/loop3
$BUSYBOX ln -s /dev/block/loop4 /dev/loop4
$BUSYBOX ln -s /dev/block/loop5 /dev/loop5
$BUSYBOX ln -s /dev/block/loop6 /dev/loop6
$BUSYBOX ln -s /dev/block/loop7 /dev/loop7
if [ ! -e /data/system.firstrun.finish ];
then
# first run data not create do nothing, data2loop after reboot
#/system/bin/mkfs.ext4 -b 4096 -m 0 -F -L userdata /dev/block/mmcblk3p2
#/system/bin/tune2fs -o journal_data_writeback /dev/block/mmcblk3p2
#/system/bin/e2fsck /dev/block/mmcblk3p2
#/system/bin/tune2fs -O ^has_journal /dev/block/mmcblk3p2
$BUSYBOX mkdir /data/anr
$BUSYBOX touch /data/system.firstrun.finish
exit 0;
fi
$BUSYBOX umount /cache
echo "0" > /data/misc/screen_lock_status
$BUSYBOX chown 1000.1000 /data/misc/screen_lock_status
$BUSYBOX chmod 644 /data/misc/screen_lock_status
$BUSYBOX mkdir /mnt/asec/extdata
/system/bin/tune2fs -o journal_data_writeback /dev/block/mmcblk3p2
$BUSYBOX mount -t ext4 -o remount,barrier=0,nobh,nouser_xattr,errors=continue,noatime,nodiratime,nosuid,nodev /dev/block/mmcblk3p2 /data
result=$?
echo "mount mmcblk3p2:$result" >> $ECHO_TARGET
$BUSYBOX chown 1000.1000 /data
$BUSYBOX chmod 771 /data
echo "+++Need create loopback device for data, please wait... " >> $ECHO_TARGET
if [ ! -e /data/data2loop.finish ];
then
if [ -e /dev/block/mmcblk3p3 ];
then
echo "+++Found mmcblk3p3, will use it for /data/data, create ext4 fs on it now..." >> $ECHO_TARGET
/system/bin/mkfs.ext4 -b 4096 -m 0 -F -L extdata /dev/block/mmcblk3p3
/system/bin/tune2fs -o journal_data_ordered /dev/block/mmcblk3p3
/system/bin/e2fsck -y -v -f /dev/block/mmcblk3p3
#/system/bin/tune2fs -O has_journal /dev/block/mmcblk3p3
/system/bin/tune2fs -O ^has_journal /dev/block/mmcblk3p3
$BUSYBOX mount -t ext4 -o loop,commit=5,barrier=1,nouser_xattr,errors=continue,noatime,nodiratime,nosuid,nodev /dev/block/mmcblk3p3 /mnt/asec/extdata
result=$?
echo "mount /dev/block/mmcblk3p3:$result" >> $ECHO_TARGET
else
echo "+++Need create 512M ext2 loopback device for data, please wait... " >> $ECHO_TARGET
$BUSYBOX dd if=/dev/zero of=/data/ext2 bs=1048576 count=512
$BUSYBOX mke2fs -m 0 -F -L datadata /data/ext2
echo "+++Loopback device create done... " >> $ECHO_TARGET
$BUSYBOX mount -o loop,errors=continue,noatime,nodiratime,nosuid,nodev /data/ext2 /mnt/asec/extdata
fi
$BUSYBOX chown 1000.1000 /mnt/asec/extdata
$BUSYBOX chmod 771 /mnt/asec/extdata
for i in data app-private anr ; do
if [ ! -d /mnt/asec/extdata/$i ] ; then
$BUSYBOX mkdir /mnt/asec/extdata/$i;
fi
$BUSYBOX chown 1000.1000 /mnt/asec/extdata/$i;
$BUSYBOX chmod 771 /mnt/asec/extdata/$i;
#if [ ! -h /data/$i ] ; then
$BUSYBOX cp -a /data/$i /mnt/asec/extdata/;
$BUSYBOX rm -rf /data/$i;
$BUSYBOX ln -s /mnt/asec/extdata/$i /data/$i;
result=$?
echo "ln -s:$result" >> $ECHO_TARGET
#fi
done
$BUSYBOX umount /mnt/asec/extdata
$BUSYBOX touch /data/data2loop.finish
fi
if [ -e /dev/block/mmcblk3p3 ];
then
/system/bin/e2fsck -y -v -f /dev/block/mmcblk3p3
#/system/bin/tune2fs -O ^has_journal /dev/block/mmcblk3p3
/system/bin/tune2fs -o journal_data_writeback /dev/block/mmcblk3p3
$BUSYBOX mknod /dev/loop0 b 7 0
$BUSYBOX losetup /dev/loop0 /dev/block/mmcblk3p3
#$BUSYBOX mount -t ext4 -o sync,commit=5,barrier=1,nouser_xattr,errors=continue,noatime,nodiratime,nosuid,nodev /dev/loop0 /mnt/asec/extdata
$BUSYBOX mount -t ext4 -o barrier=1,nouser_xattr,errors=continue,noatime,nodiratime,nosuid,nodev /dev/loop0 /mnt/asec/extdata
result=$?
echo "mount /dev/loop1:$result" >> $ECHO_TARGET
else
/system/bin/e2fsck -y -v -f /data/ext2
$BUSYBOX mount -o loop,errors=continue,noatime,nodiratime,nosuid,nodev /data/ext2 /mnt/asec/extdata
fi
$BUSYBOX chown 1000.1000 /mnt/asec/extdata
$BUSYBOX chmod 771 /mnt/asec/extdata
$BUSYBOX mkdir /data/cache
$BUSYBOX mount -o bind /data/cache /cache
$BUSYBOX chmod 777 /cache
sync;
exit 0;
Code:
rootfs / rootfs rw,relatime 0 0
tmpfs /dev tmpfs rw,relatime,mode=755 0 0
devpts /dev/pts devpts rw,relatime,mode=600 0 0
proc /proc proc rw,relatime 0 0
sysfs /sys sysfs rw,relatime 0 0
none /acct cgroup rw,relatime,cpuacct 0 0
tmpfs /mnt/asec tmpfs rw,relatime,mode=755,gid=1000 0 0
none /dev/cpuctl cgroup rw,relatime,cpu 0 0
/dev/block/mtdblock3 /system yaffs2 ro,relatime 0 0
/dev/block/mtdblock6 /logodata yaffs2 rw,nosuid,nodev,relatime 0 0
/dev/block/mmcblk3p2 /data ext4 rw,nosuid,nodev,noatime,nodiratime,barrier=0,nobh,data=writeback 0 0
/dev/block/mtdblock0 /misc yaffs2 rw,nosuid,nodev,relatime 0 0
/dev/loop0 /mnt/asec/extdata ext4 rw,nosuid,nodev,noatime,nodiratime,barrier=0,data=writeback 0 0
/dev/block/mmcblk3p2 /cache ext4 rw,nosuid,nodev,noatime,nodiratime,barrier=0,nobh,data=writeback 0 0
/dev/block/vold/179:17 /mnt/sdcard2 vfat rw,dirsync,nosuid,nodev,noexec,relatime,uid=1000,gid=1015,fmask=0702,dmask=07
02,allow_utime=0020,codepage=cp437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro 0 0
/dev/block/vold/179:17 /mnt/secure/asec vfat rw,dirsync,nosuid,nodev,noexec,relatime,uid=1000,gid=1015,fmask=0702,dmas
k=0702,allow_utime=0020,codepage=cp437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro 0 0
tmpfs /mnt/sdcard2/.android_secure tmpfs ro,relatime,size=0k,mode=000 0 0
/dev/block/vold/179:25 /mnt/sdcard vfat rw,dirsync,nosuid,nodev,noexec,relatime,uid=1000,gid=1015,fmask=0702,dmask=070
2,allow_utime=0020,codepage=cp437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro 0 0
/dev/block/vold/179:25 /mnt/secure/asec vfat rw,dirsync,nosuid,nodev,noexec,relatime,uid=1000,gid=1015,fmask=0702,dmas
k=0702,allow_utime=0020,codepage=cp437,iocharset=iso8859-1,shortname=mixed,utf8,errors=remount-ro 0 0
tmpfs /mnt/sdcard/.android_secure tmpfs ro,relatime,size=0k,mode=000 0 0
chenglu can you post the instructions on how to create a third partition and mount that instead of creating a loop file? I want to test that today.
Thanks,
anlog said:
chenglu can you post the instructions on how to create a third partition and mount that instead of creating a loop file? I want to test that today.
Thanks,
Click to expand...
Click to collapse
Code:
busybox fdisk /dev/block/mmcblk3 -l
Disk /dev/block/mmcblk3: 16.0 GB, 16097738752 bytes
4 heads, 16 sectors/track, 491264 cylinders
Units = cylinders of 64 * 512 = 32768 bytes
Device Boot Start End Blocks Id System
/dev/block/mmcblk3p1 1 397087 12706776 83 Linux
/dev/block/mmcblk3p2 397088 458497 1965120 83 Linux
/dev/block/mmcblk3p3 458498 491264 1048544 83 Linux
reboot into recovery mode
Code:
busybox fdisk /dev/block/mmcblk3
The number of cylinders for this disk is set to 491264.
There is nothing wrong with that, but this is larger than 1024,
and could in certain setups cause problems with:
1) software that runs at boot time (e.g., old versions of LILO)
2) booting and partitioning software from other OSs
(e.g., DOS FDISK, OS/2 FDISK)
Command (m for help): m
m
Command Action
a toggle a bootable flag
b edit bsd disklabel
c toggle the dos compatibility flag
d delete a partition
l list known partition types
n add a new partition
o create a new empty DOS partition table
p print the partition table
q quit without saving changes
s create a new empty Sun disklabel
t change a partition's system id
u change display/entry units
v verify the partition table
w write table to disk and exit
x extra functionality (experts only)
"d" delete a partition 1 and 2
"n" create primary partition 1 2 3
busybox mkdosfs /dev/block/mmcblk3p1
mkfs.ext4 -b 4096 -m 0 -F -L userdata /dev/block/mmcblk3p2
In your instructions it looks like partition 3 isn't referenced, but instead you're formatting /data as ext4 instead of ext3? Or am I missing something???
Add the -O ^huge_file file option to your mkfs.ext4 when formating the partition. (it won't work with this feature since it requires special kernel option that brakes compatibility with existing modules)
mkfs.ext4 -O ^huge_file ........
Report back...
anlog said:
I was able to reboot 5 times and it kept the settings for me. I just couldnt test all apps because wifi was broken with the kernel I was using. I can test more today.
Are you sure that your ext4 format is completing? I got an mtab error when first trying to create the journal, so I just changed the script to format it with the -O ^has_journal option and it competed.
Vegan runs fine for me with latest busybox...
Click to expand...
Click to collapse

mount /system with adb shell in recovery

hello, i need to restore my framework-res.apk from backup on my phone. i googled around and found some ways but they arent working. i can adb shell in while in recovery but i cant boot to android and /system isnt mounted.
i tried mount -o rw,remount /dev/block/mtdblock3 /system and mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system in adb shell and get "mount: mounting /dev/block/mtdblock3 on /system failed: Invalid argument"
also tried doing adb remount but get "remount failed: Unknown error: 0"
anyone know whats going on? i have 318 rom and streakmod recovery. sorry if this is considered android development. i dont think it is so its in streak general.
I believe /system shound be /dev/block/mtdblock6, so you should be able to use: mount -t yaffs2 /dev/block/mtdblock6 /system
yeah i just got the answer in freenode irc #dellstreak too and this did work. thank you.
[11:18pm] meralias: mount /dev/block/mtdblock6 /system
[11:21pm] meralias: actually: mount -t yaffs2 /dev/block/mtdblock6 /system
edit: [11:24pm] • meralias also goes as 'kantras'
sly.

[GUIDE] How To Backup and Restore using tar on adb shell - Fastest recovery

If you are like me, and try out things alot that leave you with an unusable system and you want to recover as fast as possible, I made a small Listing, that shows what you have to enter on adb shell while booted in recovery.
Prequisites:
Tested on FuguMod >= 2.0 only
Be sure you have enough space free on internal SD
all these commands are issued in adb shell while booted into Recovery Mode
It restores to JFS on all partitions
One-liners for copy paste while root on adb shell in Recovery Mode:
Backup:
Code:
mount /dev/block/mmcblk0p1 /mnt/sdcard; mount /dev/block/mmcblk0p2 /data; mount /dev/block/stl10 /dbdata; rm /mnt/sdcard/system.tar /mnt/sdcard/data.tar /mnt/sdcard/dbdata.tar && cd / && tar cvf /mnt/sdcard/system.tar /system && tar cvf /mnt/sdcard/data.tar /data && tar cvf /mnt/sdcard/dbdata.tar /dbdata
Restore:
Code:
umount /system; umount /data; umount /mnt/sdcard; umount /dbdata; umount /cache; /sbin/jfs_mkfs -q /dev/block/stl9 && /sbin/jfs_mkfs -q /dev/block/mmcblk0p2 && /sbin/jfs_mkfs -q /dev/block/stl10 && /sbin/jfs_mkfs -q /dev/block/stl11 && mount /dev/block/mmcblk0p1 /mnt/sdcard; mount /dev/block/mmcblk0p2 /data; mount /dev/block/stl9 /system; mount /dev/block/stl10 /dbdata; mount /dev/block/stl11 /cache; cd / && tar xvf /mnt/sdcard/system.tar && tar xvf /mnt/sdcard/data.tar && tar xvf /mnt/sdcard/dbdata.tar
In detail:
Backup:
Code:
# backup - in adb shell (as root) do:
# --------------------------------------------------
# mount all filesystems
mount /dev/block/mmcblk0p1 /mnt/sdcard
mount /dev/block/mmcblk0p2 /data
mount /dev/block/stl9 /system
mount /dev/block/stl10 /dbdata
# remove older backups
rm /mnt/sdcard/data.tar /mnt/sdcard/system.tar /mnt/sdcard/dbdata.tar
# backup them all to the root of the internal sdcard (make sure enough space is free)
cd /
tar cvf /mnt/sdcard/system.tar /system
tar cvf /mnt/sdcard/data.tar /data
tar cvf /mnt/sdcard/dbdata.tar /dbdata
Restore:
Code:
# restore - process
# --------------------------------------------------
# flash stock ROM with Odin/heimdall
# flash fugumod with Odin/heimdall
# reboot recovery - claim root and open a shell
adb root
adb shell
# unmount all filesystems
umount /system
umount /data
umount /mnt/sdcard
umount /dbdata
umount /cache
# recreate filesystems (jfs)
/sbin/jfs_mkfs -q /dev/block/stl9
/sbin/jfs_mkfs -q /dev/block/mmcblk0p2
/sbin/jfs_mkfs -q /dev/block/stl10
/sbin/jfs_mkfs -q /dev/block/stl11
# mount all filesystems and internal sdcard
mount /dev/block/mmcblk0p1 /mnt/sdcard
mount /dev/block/mmcblk0p2 /data
mount /dev/block/stl9 /system
mount /dev/block/stl10 /dbdata
mount /dev/block/stl11 /cache
# restore the tar
cd /
tar xvf /mnt/sdcard/system.tar
tar xvf /mnt/sdcard/data.tar
tar xvf /mnt/sdcard/dbdata.tar
Listing: http://pastebin.com/rpZW1uWD
Good stuff.
really useful, thank you.
Danke^^
When I think about it, it should not be too difficult to write an application to create and pull the backups off the phone. And pushing and restoring would be the same thing in the other way. If I got some spare time I could do that, I think it would be really handy
Yeah... I also though about to supply an update.zip for backup and one for restore... but I was to lazy
I'm starting to form the project and layout for the program in my head, but on the other hand my laziness starts to fight all growing motivation. I'm wondering how this will turn out
Works perfect, thx.
How and in what regard is this faster than making the backup with CWM?
Not that I don't believe you that it is faster I just want to understand things
I pretty much understand what your script does, so probably what I would need to know to see the difference is how the CWM does the backup. I guess CWM is storing the whole file system with dd or something like that...
zsori said:
How and in what regard is this faster than making the backup with CWM?
Not that I don't believe you that it is faster I just want to understand things
I pretty much understand what your script does, so probably what I would need to know to see the difference is how the CWM does the backup. I guess CWM is storing the whole file system with dd or something like that...
Click to expand...
Click to collapse
It's faster since it does not create a new filesystem to back up the data... TBH. It is less safe than a nandroid backup (no md5 check). but faster in creation. and actually never failed on me
also everybody modding the hell out of their phones should get to know adb shell and the power that lies within it. You can take many shortcuts and debug errors easier.
do I understand correctly that this is able to restore a TAR file decrypted from a AB android backup file created before?
Can this make the backup on the computer the phone is connected to? Not enough free space on the phone to backup to.
Can it pull apps and their data from external SD?
Does it work without the user having to touch the screen? Broken screen, no touch possible and can't see anything so even if I had paired a bluetooth mouse before the damage it'd still be useless.
Can it restore to a different but identical in every way phone?

[Q][possable solution found??][universal??] data2ext

I have made a file to mount an sdcard second partition to "/data". It needs to go in "/system/etc/init.d/". Can some have a look to tell me if it would work or not as I don't have a partition sdcard.
-Download link: http://db.tt/paxqo1b
Code:
#!/system/bin/sh
if [ -e /dev/block/platform/msm_sdcc.1/by-num/p2 ]
then
busybox mount -o rw,remount -t yaffs2 /dev/block/mtdblock10 /;
busybox umount /data;
busybox mount /dev/block/platform/msm_sdcc.1/by-num/p2 /data;
busybox chown system system /data;
busybox chmod 771 /data;
busybox mount -o ro,remount -t yaffs2 /dev/block/mtdblock10 /;
fi;
Why would you want the whole data partition on the sdcard? It will ruin it a lot quicker, and also slow the phone down if the card isn't fast enough.
Jack

[Q] oc kernel, battery drain & full backup

I've rooted my Nook Simple Touch thanks to the advice and instructions xda (thank you all) and after a few days decided to instal the custom kernel (174 modified from the thread in the dev forum).
Battery drain went from moderate to losing about 10/15% per day even when turned off?!?
I made a full backup via nookmanager before rooting. I would like to try uninstalling the oc kernel first but don't know how to pull files from the backup or what files need replacing or deleting.
I'm willing to do a full restore but only as a last resort. Please could someone tell me how to get back to a stock kernel?
Thank you.
chipsugar said:
I've rooted my Nook Simple Touch thanks to the advice and instructions xda (thank you all) and after a few days decided to instal the custom kernel (174 modified from the thread in the dev forum).
Battery drain went from moderate to losing about 10/15% per day even when turned off?!?
Click to expand...
Click to collapse
Are you leaving WiFi enabled? What extra apps have you installed?
I made a full backup via nookmanager before rooting. I would like to try uninstalling the oc kernel first but don't know how to pull files from the backup or what files need replacing or deleting.
Click to expand...
Click to collapse
If you've got a Linux machine somewhere, you can mount the backup image by gunzipping a copy to backup.img and using something like:
Code:
#!/bin/sh
losetup -D
mkdir -p backup
losetup --offset 16384 /dev/loop0 backup.img
losetup --offset 79691776 /dev/loop1 backup.img
losetup --offset 96468992 /dev/loop2 backup.img
losetup --offset 295714816 /dev/loop3 backup.img
losetup --offset 597704704 /dev/loop4 backup.img
losetup --offset 849362944 /dev/loop5 backup.img
losetup --offset 1101021184 /dev/loop6 backup.img
fsck -y /dev/loop5
fsck -y /dev/loop6
cd backup
umount *
mount -o ro -t vfat /dev/loop0 boot
mount -o ro -t vfat /dev/loop1 rom
mount -o ro -t ext2 /dev/loop2 factory
mount -o ro -t ext2 /dev/loop3 system
mount -o ro -t vfat /dev/loop4 sdcard
mount -o ro -t ext3 /dev/loop5 cache
mount -o ro -t ext3 /dev/loop6 data
I'm willing to do a full restore but only as a last resort. Please could someone tell me how to get back to a stock kernel?
Thank you.
Click to expand...
Click to collapse
NookManager only does a full restore. If you do that, the old stock kernel will be restored.

Categories

Resources