Need FS Block Size: Bad Magic Block Error - Verizon Droid Charge

SHORT: I need the filesystem block size (location would be nice too; however, I can guess that) so I can use e2fsck to restore my super-block.
LONG: I have been having issues for the past several days where I cannot umount /system. I thought it may have been a bad conversion going to/from or from/to rfs and ext4 and thought doing the conversion again had fixed it. But alas...it didn't.
I cannot umount the files system from adb ("device is busy" error) or CWMR ("Couldn't find valid filesystem superblock" in the log) on any version of ROM or using any kernel that I can find. Voodoo can seem to convert the filesystem (back/forth), but it only seem to work if I tell it to from the Voodoo Control and then reboot, which is odd. Still cannot umount.
When I try and use Navenedrob's Ext4 Formatter, it fails for /system. CWMR's log shows:
/tmp/tune2fs: Bad magic number in super-block while trying to open /dev/block/stl10
Couldn't find valid filesystem superblock
Should be fixable with e2fsck, if I can get the correct information from tune2fs.
Typically, the command should be:tune2fs -l /dev/block/stl10 OR tune2fs -l -L /system
That said, tune2fs is tell me "-l" is an unknown option.
Can someone who is familiar with tune2fs (or other filesystem tools) in the Android/BusyBox environment please post either the correct command or a list of the contents of the filesystem super-block? Please be sure to include if your /system is in EXT4 or RFS.
Man, I haven't see this **** in years. Even then, it was pretty exclusive to virtual/networked file system (e.g. LVM).
Any-who, much appreciated....

So, after sleeping on it, I came to realize an error in my thinking...
I cannot use e2fsck to fix an RFS filesystem. Even more upsetting is that I cannot seem to find anything on The Google about command line RFS tools. Guess I could try a conversion and EXT filesystem, then change the superblock, then convert back to RFS, but that seems awfully convoluted.
Suggestions?

I suggest you odin with pit and check repartition. That *usually* fixes everything.
Sent from my debloated ep1q charge......bro.

Thanks for the tip...I probably should have mention that I've used Pit+ED1 numerous times in a effort to fix this. It goes through successfully; however, it doesn't actually wipe the partition and I've found old files in /system.
UPDATE:
Last thing I tried is manually wiping everything from /system (in CWMR + adb shell). Also, wiped everything I could find having anything to do with voodoo or EXT4 (just in case). After power off then back to recovery, I found I could umount /system. Created a new partition, formatted, then wacked the partition.
I just (successfully) ran ED1+pit from the Samsung Flashing Utility (which I have NOT tried using before) and I am now in the process of upgrading. Once I have root back, I'll go see if the fix for /system was permanent.

Related

[Q] Reformat data partition as ext4

Rather than making a loopback filesystem, I've been trying to reformat the data partition as ext4, but haven't been able get past the galaxy "S" screen yet (the big S on boot). Here's what I did
* Compile a kernel with ext4 and modified init.rc to mount /data as ext4.
* Reboot into recovery and format /dev/block/mmcblk0p2 as ext4.
* Reboot into download and flash the custom kernel.
It was stuck at "S" for a while, then the screen went dark, and the only thing I could do was to pull out the battery. Then I went into recovery mode and found the partition was trashed, i.e. I couldn't mount it as ext4 again. I had to format it back to rfs and restore the stock kernel to get it to boot. I have to believe that there's something other than init.rc that assumes data partition to be in a certain format. Has anyone had success on a similar task?
BTW, the same process DID work for /dbdata, but I see no visible improvement in Quadrant score...
I has a similar thing occur on my first attempt with nilfs2. Did you remove anything that would attempt to mount as rfs? I think the rfs driver will claim pretty much anything that might be rfs, so if your format left the backup FAT intact, that might be your problem. By the way, the nilfs2+user_init kernel I posted in the mimocan fix thread does support ext4 as well, and allows you to customize the mount without rebuilding your kernel.
Sent from my SAMSUNG-SGH-I897 using XDA App

[DEV] Someone ever tried an "init.d/rc0.d" script on Android ?

While messing around with ext2 and data2ext i noticed that android doesn't umount the sd-ext partition (Vold process unmounts the fat partition just fine as it can be seen with logcat). Also cyanogen states the same in this posting (Im wasn't sure on this but i don't doubt him EDIT: i doubt him now ... ).
I wonder now why the recommended solution for file corruption issues is using ext3/4 (wich slows things down due to the journal and reduces the lifetime of flashdrives due to limited r/w cycles) instead of just make a shutdown script wich unmounts the ext partition? (About lifetime: I think 10.000-100.000 r/w cycles is a rather high value and lifetime is only a theoretical and not a practical issue - but im not sure on this)
Since i'm not really expirenced in scripting on either linux or android i wanted to ask if a script in "init.d/rc0.d" (+"init.d/rc6.d" for reboot) would be possible? I could write one but i don't know if this would be executed and i actually don't know how i could check if it works (i think logcat would be shutdown before this is done).
Edit: At least if rc0.d scripts are run BEFORE logcat stops it doesn't work. Logcat log is empty if i "grep test" an "echo "test"" script.
Need help. Someone ...
melethron said:
While messing around with ext2 and data2ext i noticed that android doesn't umount the sd-ext partition (Vold process unmounts the fat partition just fine as it can be seen with logcat). Also cyanogen states the same in this posting (Im wasn't sure on this but i don't doubt him ).
I wonder now why the recommended solution for file corruption issues is using ext3/4 (wich slows things down due to the journal and reduces the lifetime of flashdrives due to limited r/w cycles) instead of just make a shutdown script wich unmounts the ext partition? (About lifetime: I think 10.000-100.000 r/w cycles is a rather high value and lifetime is only a theoretical and not a practical issue - but im not sure on this)
Since i'm not really expirenced in scripting on either linux or android i wanted to ask if a script in "init.d/rc0.d" (+"init.d/rc6.d" for reboot) would be possible? I could write one but i don't know if this would be executed and i actually don't know how i could check if it works (i think logcat would be shutdown before this is done).
Click to expand...
Click to collapse
Does /system/bin/shutdown get called to turn off the phone?
Logcat looks like its the last thing to stop
coutts99 said:
Does /system/bin/shutdown get called to turn off the phone?
Logcat looks like its the last thing to stop
Click to expand...
Click to collapse
Code:
adb logcat | grep /system/bin/shutdown > ~/shutdowntest.log
Empty file
Although the file is present in ROM's so maybe it IS called after logcat stops. But i don't know if it's added to Custom ROMs and if it's also present in RUU's.
If it's not called do you see any possibility to use "Vold" process? Cause it does the unmounting:
Code:
I/Vold ( 145): /mnt/secure/staging/.android_secure sucessfully unmounted
I/Vold ( 145): /mnt/secure/asec sucessfully unmounted
I/Vold ( 145): /mnt/secure/staging sucessfully unmounted
I/Vold ( 145): /mnt/sdcard unmounted sucessfully
D/Vold ( 145): Volume sdcard state changing 5 (Unmounting) -> 1 (Idle-Unmounted)
melethron said:
Code:
adb logcat | grep /system/bin/shutdown > ~/shutdowntest.log
Empty file
Although the file is present in ROM's so maybe it IS called after logcat stops. But i don't know if it's added to Custom ROMs and if it's also present in RUU's.
If it's not called do you see any possibility to use "Vold" process? Cause it does the unmounting:
Code:
I/Vold ( 145): /mnt/secure/staging/.android_secure sucessfully unmounted
I/Vold ( 145): /mnt/secure/asec sucessfully unmounted
I/Vold ( 145): /mnt/secure/staging sucessfully unmounted
I/Vold ( 145): /mnt/sdcard unmounted sucessfully
D/Vold ( 145): Volume sdcard state changing 5 (Unmounting) -> 1 (Idle-Unmounted)
Click to expand...
Click to collapse
hmm, interesting. Maybe have to poke through the source and see what is called to shutdown the phone.
Sent from my HTC Desire using XDA App
coutts99 said:
hmm, interesting. Maybe have to poke through the source and see what is called to shutdown the phone.
Sent from my HTC Desire using XDA App
Click to expand...
Click to collapse
I think this would be a major improvement. Since journaling is actually bad for sd's. Im not sure on this, but the journal is in some specific area on the filesystem. If this is the case I'm not sure if algorithms used to distribute r/w on flash drives will help if the journal gets overwritten (as i understand it so far the r/w is distributet over FREE space but not if something gets overwriten). If this is the case the part of the SD with the journal will be stressed heavy.
I've been playing around with data2sd with ext2 for a few weeks now.
I might be wrong but I think that the system is unmounting cleanly /data (and not /dev/block/mtdblock5) because I always have a clean e2fsck log after rebooting the phone.
So basically if you mount something under the /data mountpoint, it won't be cleanly unmounted and you'll end-up with corrupted FS. That what happens for A2SD because /data is still /dev/block/mtdblock5. But if you mount straight over /data, like I do with DATA2SD, the system unmounts /data on shutdown, witch is now your ext partition (whether your ext partition or a file on ext partition mounted via a loop device) and your FS is not corrupted. In that case you don't need journaling and can stick with ext2.
sibere said:
I've been playing around with data2sd with ext2 for a few weeks now.
I might be wrong but I think that the system in unmounting cleanly /data (and not /dev/block/mtdblock5) because I always have a clean e2fsck log after rebooting the phone.
So basically if you mount something under the /data mountpoint, it won't be cleanly unmounted and you'll end-up with corrupted FS. That what happens for A2SD because /data is still /dev/block/mtdblock5. But if you mount straight over /data, like I do with DATA2SD, the system unmounts /data on shutdown, witch is now your ext partition (whether your ext partition or a file on ext partition mounted via a loop device) and your FS is not corrupted. In that case you don't need journaling and can stick with ext2.
Click to expand...
Click to collapse
Im pretty sure for 3 reasons that it doesnt unmount data:
1. Android unmounts "/sdcard" as it can be seen in logcat while other stuff isn't unmounted. It may be still that the other unmount stuff is not not by the "Vold" process. Sdcard needs to be able to get unmounted when the phone is plugged to usb.
2. I also did quite a lot testing with sd-ext directly mounted to /data and i did get quite a lot corruption. But it is situation depended. If my phone was "idle" i didn't get corruption (1 time in 20 reboots) with no corruption. Then to make absolutly sure that it works i shut it down right after it boots up. There is many stuff running then wich means there is a much higher chance that something is still written while it shutdowns. Doing this i had corruption every 3rd reboot.
3. And this is the most important reason why you didn't get corruption but i did : You use sync as a mount option so you there is no need to unmount it ^^ !!!!
Sync is not an option for me for some reason:
-No cache will slowdown write on small files heavily
-Without cache every other process has to wait if some writing is done (lags).
-Much more wear for the sd since small files aren't cached
Using ext2 with sync isn't an option for me. Either i get ext2 with a proper unmount to work or i'll use Ext4 with an "ordered" journal then (or maybe i give a s*** about data2ext then).
melethron said:
Im pretty sure for 3 reasons that it doesnt unmount data:
1. Android unmounts "/sdcard" as it can be seen in logcat while other stuff isn't unmounted. It may be still that the other unmount stuff is not not by the "Vold" process. Sdcard needs to be able to get unmounted when the phone is plugged to usb.
2. I also did quite a lot testing with sd-ext directly mounted to /data and i did get quite a lot corruption. But it is situation depended. If my phone was "idle" i didn't get corruption (1 time in 20 reboots) with no corruption. Then to make absolutly sure that it works i shut it down right after it boots up. There is many stuff running then wich means there is a much higher chance that something is still written while it shutdowns. Doing this i had corruption every 3rd reboot.
3. And this is the most important reason why you didn't get corruption but i did : You use sync as a mount option so you there is no need to unmount it ^^ !!!!
Sync is not an option for me for some reason:
-No cache will slowdown write on small files heavily
-Without cache every other process has to wait if some writing is done (lags).
-Much more wear for the sd since small files aren't cached
Using ext2 with sync isn't an option for me. Either i get ext2 with a proper unmount to work or i'll use Ext4 with an "ordered" journal then (or maybe i give a s*** about data2ext then).
Click to expand...
Click to collapse
To me, the main purpose with data2Sd was to get more storage with at least the same amount of performances than the original NAND. I found that, on top of the extra space I have now, I also have a very good performance, roughly the same as NAND on small files and a much better one on bigger files. And I'm not thinking about quadrant score here
Talking about the unmount, if I run an e2fsck -n on the ext2 file while it's in use by the system, I have a report of a few errors (like deleted inode with nodtime, or wrong count of free blocks) But if I shut down the phone and turn in on again, the e2fsck I run at boot reports no errors at all. I might be wrong but my guess is that there is a clean umount done at some stage...
What I am going to do is an other test. You know that when an ext2 partition is not umounted properly, a flag is activated and this ext2 partition must be checked, regardless of the number of mounts done before running a check. This flag can be check by running a tune2fs -l on the partition before mounting it. It is reported as well by the system that the partition hasn't been unmounted properly when you try to mount it and that it should be checked .
So If i turn off my phone, restart in recovery mode, run a tune2fs -l on the ext2 file or mount it manually, I should be able to see if the partition has been unmounted by the system or not before the actual reboot.
I'll report the results and let you know if I'm wrong
OK
I've just turned off my phone. rebooted in recovery, mounted the 2nd FAT32 partition and run a tune2fs -l ext2 (that's the name of my ext2 file mounted via a loop device over /data)
Here is the result:
Code:
tune2fs 1.40.8 (13-Mar-2008)
Filesystem volume name: userdata
Last mounted on: /data
Filesystem UUID: 296f98d0-21e8-48b6-82ac-6c94c4edf28d
Filesystem magic number: 0xEF53
Filesystem revision #: 1 (dynamic)
Filesystem features: ext_attr dir_index filetype sparse_super
Filesystem flags: unsigned_directory_hash
Default mount options: (none)
Filesystem state: clean
Errors behavior: Continue
Filesystem OS type: Linux
Inode count: 60800
Block count: 243056
Reserved block count: 0
Free blocks: 168874
Free inodes: 57516
First block: 0
Block size: 4096
Fragment size: 4096
Blocks per group: 32768
Fragments per group: 32768
Inodes per group: 7600
Inode blocks per group: 475
Filesystem created: Tue Dec 7 15:00:51 2010
Last mount time: Thu Dec 9 17:40:16 2010
Last write time: Thu Dec 9 21:16:43 2010
Mount count: 1
Maximum mount count: 21
Last checked: Thu Dec 9 17:40:10 2010
Check interval: 15552000 (6 months)
Next check after: Tue Jun 7 17:40:10 2011
Reserved blocks uid: 0 (user root)
Reserved blocks gid: 0 (group root)
First inode: 11
Inode size: 256
Default directory hash: half_md4
Directory Hash Seed: 8ff9238f-aef7-48a7-85e1-7d2d45b9e809
You can see that it's reporting that the system is clean. If the ext2 partition wasn't cleanly unmounted by the system at shutdown, it would never report as being clean.
Obviously, if I check the state now that, after booting to android, the FS is mounted over /data, it is reported as being unclean.
It's reporting 1 as mount count because I'm forcing an fsck on boot anyway.
This doesn't mean that I will never get errors tho. I even have some errors from time to time when I reboot my linux home server
melethron said:
-No cache will slowdown write on small files heavily
-Without cache every other process has to wait if some writing is done (lags).
-Much more wear for the sd since small files aren't cached
Using ext2 with sync isn't an option for me. Either i get ext2 with a proper unmount to work or i'll use Ext4 with an "ordered" journal then (or maybe i give a s*** about data2ext then).
Click to expand...
Click to collapse
Remember that there is no writeback cache (AFAIK) with YAFFS2
But I should try with sync off and see if the system is still "clean" after a shutdown. If the systems unmounts ext2 properly, then the cache should be flushed by the system before unmounting the filesystem.
sibere said:
OK
I've just turned off my phone. rebooted in recovery, mounted the 2nd FAT32 partition and run a tune2fs -l ext2 (that's the name of my ext2 file mounted via a loop device over /data)
You can see that it's reporting that the system is clean. If the ext2 partition wasn't cleanly unmounted by the system at shutdown, it would never report as being clean.
Obviously, if I check the state now that, after booting to android, the FS is mounted over /data, it is reported as being unclean.
It's reporting 1 as mount count because I'm forcing an fsck on boot anyway.
This doesn't mean that I will never get errors tho. I even have some errors from time to time when I reboot my linux home server
Click to expand...
Click to collapse
You are right about the "clean" flag being set while unmounted. But you forgot one thing. The "clean" flag must be cleared when the partition is mounted. You should check if it as also reported while it IS mounted .... if so mount doesn't write proberly to the superblock. I would do this myself but im on ext4 and afaik it isn't cleared on mount then. For me this far it shows also "clean" when it is mounted.
My guess that mount doesn't write the superblock proberly is also supported by the fact that your and my mount count both shows 1. This could be a coincidince (chance for this is 0,147928994083 %) but could also support my assumption.
So check again while you mounted your system.
EDIT: I completly agree with you that data2ext is about space. Considering speed i also expirienced that reading larger amounts of data from data/data is faster with data2ext. But i also expirienced some slowdown sometimes on ext 4. It was better on ext2 and with that im really fine.
Remount done: Mount count still 1. I bet you will also get clean when you mount your ext.
melethron said:
Since i'm not really expirenced in scripting on either linux or android i wanted to ask if a script in "init.d/rc0.d" (+"init.d/rc6.d" for reboot) would be possible? I could write one but i don't know if this would be executed and i actually don't know how i could check if it works (i think logcat would be shutdown before this is done).
Edit: At least if rc0.d scripts are run BEFORE logcat stops it doesn't work. Logcat log is empty if i "grep test" an "echo "test"" script.
Need help. Someone ...
Click to expand...
Click to collapse
i think that won't work with rc.0 as init.d script execution is initiated in
init.rc only for "before booting", its not as a "normal" linux init system
# Execute files in /etc/init.d before booting
service sysinit /system/bin/logwrapper /system/xbin/busybox run-parts /system/etc/init.d
disabled
oneshot
i wonder if a shutdown.rc could be populated, there is a shutdown.bravo.rc but its empty
for init-handling, in the kernel source its in system/core/init
but im not fit with c/c++ to look into
maybe the init binary would have to be modified by a kernel dev to enable shutdown.rc / also possible that htc has motified it to not to be used.
woti23 said:
i think that won't work with rc.0 as init.d script execution is initiated in
init.rc only for "before booting", its not as a "normal" linux init system
# Execute files in /etc/init.d before booting
service sysinit /system/bin/logwrapper /system/xbin/busybox run-parts /system/etc/init.d
disabled
oneshot
i wonder if a shutdown.rc could be populated, there is a shutdown.bravo.rc but its empty
for init-handling, in the kernel source its in system/core/init
but im not fit with c/c++ to look into
maybe the init binary would have to be modified by a kernel dev to enable shutdown.rc / also possible that htc has motified it to not to be used.
Click to expand...
Click to collapse
This would have been to easy ....
Well maybe some Kernel Dev will look into this.... coutts, sibere, anyone ... can you help ?
Btw: i still wonder why /system/bin/shutdown is present in ROMs if it's not used ....
melethron said:
This would have been to easy ....
Well maybe some Kernel Dev will look into this.... coutts, sibere, anyone ... can you help ?
Btw: i still wonder why /system/bin/shutdown is present in ROMs if it's not used ....
Click to expand...
Click to collapse
this works for the script that should be executed part
/system/bin/logwrapper /system/xbin/busybox run-parts /system/etc/shutdown.d
runs every script which is in /system/etc/shutdown.d
if you create /system/etc/shutdown.d before
and put one or more executable script/s that do something in
melethron said:
You are right about the "clean" flag being set while unmounted. But you forgot one thing. The "clean" flag must be cleared when the partition is mounted. You should check if it as also reported while it IS mounted .... if so mount doesn't write proberly to the superblock. I would do this myself but im on ext4 and afaik it isn't cleared on mount then. For me this far it shows also "clean" when it is mounted.
My guess that mount doesn't write the superblock proberly is also supported by the fact that your and my mount count both shows 1. This could be a coincidince (chance for this is 0,147928994083 %) but could also support my assumption.
So check again while you mounted your system.
EDIT: I completly agree with you that data2ext is about space. Considering speed i also expirienced that reading larger amounts of data from data/data is faster with data2ext. But i also expirienced some slowdown sometimes on ext 4. It was better on ext2 and with that im really fine.
Remount done: Mount count still 1. I bet you will also get clean when you mount your ext.
Click to expand...
Click to collapse
Sorry mate, but, like I wrote in my previous post, it shows unclean when mounted.
Sent from my HTC Desire using XDA App
sibere said:
Sorry mate, but, like I wrote in my previous post, it shows unclean when mounted.
Sent from my HTC Desire using XDA App
Click to expand...
Click to collapse
ROFL! I should learn to read proberly:
Obviously, if I check the state now that, after booting to android, the FS is mounted over /data, it is reported as being unclean.
Click to expand...
Click to collapse
Well thats actually good news thanks for helping me reading. ^^
Well so this isn't a problem. Now its time for ext4 (no loop) without journal mounted to data. About the loopdevice: you might wanna read what ownhere has to say about loop.
melethron said:
If it's not called do you see any possibility to use "Vold" process? Cause it does the unmounting:
Code:
I/Vold ( 145): /mnt/secure/staging/.android_secure sucessfully unmounted
I/Vold ( 145): /mnt/secure/asec sucessfully unmounted
I/Vold ( 145): /mnt/secure/staging sucessfully unmounted
I/Vold ( 145): /mnt/sdcard unmounted sucessfully
D/Vold ( 145): Volume sdcard state changing 5 (Unmounting) -> 1 (Idle-Unmounted)
Click to expand...
Click to collapse
http://android.git.kernel.org/?p=pl...2af4c72427ad069245d0aa572;hb=refs/heads/froyo
Some interesting stuff in this code here
coutts99 said:
http://android.git.kernel.org/?p=pl...2af4c72427ad069245d0aa572;hb=refs/heads/froyo
Some interesting stuff in this code here
Click to expand...
Click to collapse
i'm running this now on btrfs partition
/dev/block/mmcblk0p6** on /system/sd type btrfs (rw,relatime,ssd,noacl)
/dev/block/mmcblk0p6 5.2G 1.3G 3.9G 26% /system/sd
tmpfs 85.8M 24.0M 61.8M 28% /cache
a2sd btrfs *
d2sd btrfs *
dalvik-cache in /data mtd
cache in ram 90M
* without loop mounted img filesystem
** logical partition on extented partition
woti23 said:
i'm running this now on btrfs partition
/dev/block/mmcblk0p6** on /system/sd type btrfs (rw,relatime,ssd,noacl)
/dev/block/mmcblk0p6 5.2G 1.3G 3.9G 26% /system/sd
tmpfs 85.8M 24.0M 61.8M 28% /cache
a2sd btrfs *
d2sd btrfs *
dalvik-cache in /data mtd
cache in ram 90M
* without loop mounted img filesystem
** logical partition on extented partition
Click to expand...
Click to collapse
Running what now?
conventional (not froyo app2sd) a2sd + data2sd both on btrfs without loopmounted filesystem files
/data/dalvik-cache left in nand
/cache tmpfs in RAM
btrfs instead of ext4

[Q] SD Card will not mount after ext4 part.

Attempting to partition sd card with ext4 -a process I completed multiple times successfully on a Nexus One, the process appeared to complete but now the phone will not mount the sd card. I've tried a wipe/reset, to no avail. I can still access and partition the sd card through adb, but the phone cannot mount it to format/partition, restore from recovery, partition sd-card from within ClockWork Recovery, nothing. I've re-partitioned the sd card through adb, which indicated a successful completion, but the phone still refuses to mount the sd card. If this weren't a Nexus S with it's cursed internal sd-card I would simply swap out the sd card with another or format it externally like all the google topics I pull up on the subject suggest.
Is this fixable or has the fused sd-card scenario become a liability?
Common Error messages:
Can't mount /sdcard
Can't mount /sdcard/.android_secure
Phone: Nexus S (US, T-Mobile, manufactured Dec. '10)
Recovery Img: ClockworkMod Recovery 3.0.2.4
Rom: CM 7.0.3 (now wiped, cannot put back on since sd card won't mount)
fstab:
/dev/block/mtdblock4 /cache yaffs2 rw
/dev/block/platform/s3c-sdhci.0/by-name/userdata /data ext4 rw
/dev/block/platform/s3c-sdhci.0/by-name/system /system ext4 rw
/dev/block/platform/s3c-sdhci.0/by-name/media /sdcard vfat rw
Can mount everything except the last one, /sdcard.
I've tried all the recommended procedures garnered from the first 10 or so pages in google, xda, cyanogem forum, etc:
Restore from nandroid: Not possible, can't mount the SD,
Wipe/Reset: can't wipe /media as sd card won't mount,
partition sd card from within Clockwork: indicates success but does nothing,
format from within clockwork: unable to mount,
repartition using adb: works, parted can see them, I can move files to from, but the phone will not mount,
clearing fstab: no effect,
Fastboot works, but I don't have the proper images. ADB works, as do the installed utilities. Have not tried ODIN as again, I don't have the proper images. Should I attempt to compile my own images from source?
Update: SOLVED, Microsoft Windows. To whom it may concern: I was able to mount the /dev/block/platform/s3c-sdhci.0/by-name/media from two different laptops running OSX and Fedora/Ubuntu then successfully been able to partition them with fat32 as the ClockworkMod (and maybe Cyanogen?) expect with 0 progress. Then I pulled out an old Windows machine, installed the JDK/ADK's +tools and performed the same procedure and that time it worked. I'm uncertain as to what particular quality a 'genuine' Windows formatting provides, but either this phone or the particular software combination I'm running require it. I was able to mount & re-partition the /sdcard in Clockwork, then manually remove rebuild them and upgrade to ext4 using tune2fs as usual. In the interim for work and such, I had to find a surrogate (for the SIM) and could only find and old k750i (which still had a full charge and worked flawlessly all day, btw). Wow phones used to be small.
I think I was missing something about the way ClockworkMod handles fstab, because everytime I would modify it specifically to the specs I passed to parted while creating the partitions with mkpartfs, it would either ignore or overwrite them. So be careful messing with the sd-card, the S's aren't like the One's in the sense that if you screw it (the sd-card) up or it goes bad you can't just take it out and format it in another machine/phone, you have to appeal to ClockworkMod. ODIN $ucks by the way, I found fastboot to be much more effective.
If you format the sd partition ext4, then you should change the fstab too.
from
Code:
/dev/block/platform/s3c-sdhci.0/by-name/media /sdcard vfat rw
to from
Code:
/dev/block/platform/s3c-sdhci.0/by-name/media /sdcard ext4 rw
or from
Code:
/dev/block/platform/s3c-sdhci.0/by-name/media /sdcard auto rw
The 2nd last entry there is the file system type.
Likely, this would have solved your problem.
Of course, I don't know, whether the recovery has the vfat type in fstab. You might have to change it there too. On my linux box auto works very well in fstab.
Of course, if you partition your sd partition ext4, you won't be able to use it as usb memory from windows. (At least I am pretty sure you can't, haven't tried)
Well of course I couldn't let it die, I went back and started tinkering again now that I have a way back. I can't change the fstab it seems, whatever I change it to gets over written everytime either Clockwork or the Rom starts. It's weird, I know I'm missing something and I don't know much about CWMod. (had Amon_Ra on the N1, which had the nifty fsupgrade script)
The 2nd last entry there is the file system type.
Likely, this would have solved your problem.
Click to expand...
Click to collapse
I'm quite familiar with unix style fs and fstab, it's the stubbornness I'm not used to. I'm also spoiled by vi and nano. CW has some nice scripts built in as well though.

[Q] ext4 optimizations

Now, i know there are a *few* places in the dev section that have ext4 optimizations. But these "optimizations" are for the conversion from ext3 to ext4 without having the reformat and everything.
I've been trying (unsuccessfully) to change some of the ext4 mount flags for better speed. My problem is, everything i do in making a CWM flashable with a ext4 optimize sh script errors out with a Status 0. it doesn't even run.
But this time, i though i'd try a few things using adb shell. I got some tune2fs stuff working, so i thought i'd run an fsck on it. There isn't any fsck located on the phone. So i copied over a fsck.ext4, ran it but then got this error (and it also left my rom unuseable, but luckily i had a nandroid):
Code:
***file system was modified*** invalid argument passed to ext2 library while rewriting block inode bitmaps
.
And when doing an ls of /sbin, there isn't anything in there related to ext4, let alone ext3. So i'm wondering, why is our phone supports ext4 partitions, but doesn't actually have anything to support them?
EDIT: running just the tune2fs seems to have worked, just need to test out any differences found first.

[GUIDE] Repartition your gpt partitioned device after custom rom install(Huawei Y6)

This guide was written for the Huawei y6 with a gpt partition table, mounts that use partition names not numbers and the userdata partition is the last one on disk however with a little adaption this should work for most gpt devices.
If you are unsure if your system uses partition names for the mount system look in /fstab."hardware" to see if your devices are labelled in the following manner. "/dev/block/bootdevice/by-name/system".
If the fstab file does not exist all is not lost look in your root directory at the .rc files for the command mounting system.
If you are unsure ask in the thread before doing anything. Better to ask than be stuck with a brick.
This guide covers modification to only system and userdata partitions but if you use great care the basics covered here will allow for modification to other partitions as long as you understand the risk and know that backups are your friend.
If you are unable to follow instructions and end up with a bricked device that is your own fault and attempts to blame me will be laughed at.
I obtained the attached parted binary from here
So you have flashed a custom ROM and without all the OEM bloatware you now have some unused free space in your system partition just sitting there gathering dust.
You are stuck with this space... Wrong.
You can repartition your device with a little paitence, time and work.
Read along if you are curious about how to get the space you deserve.
Prerequisites:
Free space (Duh).
The ability to follow instructions and to read ALL steps before you start so you know what your plan is.
An unlocked bootloader which you already have if you flashed a custom ROM.
A custom recovery (twrp preferred).
Parted binary (see attachment at the bottom of this post).
A computer with adb installed and working (there are many guides out there if you don't have it, Google is your friend).
A calculator (well I'm sure your computer has one but just so you know).
Some knowledge using terminal commands.
Risk of Bricking your device:
Low if you backup and can double check typing and calulations.
High if you can't do one of the above.
Because parted does not allow resizing of ext4 partitions you must delete partitions you want to change then recreate them.
All steps must be performed while in recovery because you are going to have to unmount any partition before you can change it.
Step 1:
Boot into recovery and make a backup. You MUST do this otherwise you will have nothing to restore.
Step 2:
Plug your device into your computer.
Copy the parted binary into your working directory on your PC.
Open your Command Prompt (Windows) or Terminal (Linux) and navigate to where adb is installed and you also put parted, or if you have adb in your PATH just go to where parted is.
Run
Code:
~ # adb devices
to ensure your device is present.
Run
Code:
~ # adb root
to get root priviliges.
Run
Code:
~ # adb push parted /sbin/parted
/sbin is in your devices PATH so you don't have to worry about typing /parted.
Run
Code:
~ # adb shell
Run
Code:
~ # chmod 755 /sbin/parted
If you get an error about a read only file system run
Code:
mount -o remount,rw /
then try again.
Step 3: Now you need to do some homework to find your sector size, sector count and how much free space you have available.
DO NOT shrink your filesystem to smaller than you need to operate. I always add at LEAST 50 mb to the used space however I recommend you think for the future, are you planning on restoring to stock?, are you planning on flashing OpenGAPPS?, are you planning on moving third party apps into the system?, are you planning on adding media or custom boot animations to the system?
So in the case below I would not make the partition any smaller than 800 MB.
Code:
~ # df
Filesystem Size Used Free Blksize
/system 1.2G 748.5M 441.8M 4096
/data 5.2G 3.5G 1.6G 4096
/cache 147.2M 4.7M 142.5M 4096
Now issue the following command to get your disks sector size in bytes remember to note this down.
Code:
~ # blockdev --getss /dev/block/mmcblk0
512
Time to use parted.
Issue the following commands to get some info on your current partitions.
"unit s" tells parted to show sectors instead of blocks, bytes etc.
Code:
~ # parted /dev/block/mmcblk0
(parted) unit s
(parted) print
Number Start End Size File system Name Flags
22 876562s 1191132s 314571s ext4 cache
23 1191133s 3990839s 2799707s ext4 system
24 3990840s 15269854s 11279015s ext4 userdata
Remember to not the partition number as you will need it later.
Remember to note your partition name with exact case, if you changed "system" to "System" you will have problems.
Also note the start sector of your system partition for the later steps.
Also note the end sector number for your userdata partition for the later steps.
Now get your calulator ready.
Some things to keep in mind here are that the number of sectors times sector size is the size of your partition in bytes and your starting sector must be 1 after the end of the previous partition.
So the following equation will give you the numbers you need.
Desired size in MB * 1024 * 1024 / Sector Size = Number of sectors
Starting sector + Number of sectors - 1 = Last Sector
If you want a 1.1 Gb partition, you have 512 byte sectors and the starting sector is 1191133 you would then use the following equation.
1100 * 1024 * 1024 / 512 = 2252800
1191133 + 2252800 - 1 = 3443932
Step 4:
Now using the info you have gathered you can change your partitions.
So I would issue the following commands to delete, create and name the system partition with the size I want.
Code:
(parted) rm 23
(parted) mkpart 23 ext4 1191133 3443932
(parted) name 23 system
Now to resize the data partition.
You need to start with the first available sector after the end of system and end with the last available sector noted earlier.
Code:
(parted) rm 24
(parted) mkpart 24 ext4 3443933 15269854
(parted) name 24 userdata
Now that your partitions are all done you can exit parted with the following.
Code:
(parted) quit
Step 5:
Now restore the backup you made earlier.
If you get an error restoring which usually only happens if you have altered partition numbers just reboot back into recovery and restore then so the kernel gets to update its own info.
Reboot.
Congratulations you now have repartitioned your device.
Don't forget to thank this post if you are grateful.
Is there anything diferent to do about moderm mmcblkop14(/firmware)? I want to reduce it to 100 mb but i noticed its blocksize it's different from the others (others =4096, firmware=16384). I saw in your pictures you reduce it, so i will try it to do that. I have a nandroid so i hope this try works.
OK, i should probably been the first idiot to bricked his phone by reading a tutorial.
I need some help. I was trying to make this extra space and i have a few problems during the process.
First of all, in my case i have a partition 23 called cust, exactly the same in size with the cache. So i started with the cache calculating and then the other 3( 23 cust, 24 system, 25 userdata). For that moment i already made my nandroid, buy for some stupid reason I saved to my pc.
My problems came when i began with step 4. When i tried to put the cache it told me that it can't do it because it was in use. So i twrp y put on mount and desmounted that partition and then i could keep going. Same thing happened with Data partition, i did the same.
Finally, i did it all the tutorial, just needed to restore as it said in step 5 because i didn't have it in my phone. So i tried with adb push but nothing and i couldn't mount again those partition with twrp. Then, in a desperate move, i tried to reflash my cm rom, so i did that. And later, it bootloop with te huawei logo and i can´t flash a rom o restore my nandroid. It doesn't read a sdcard.
And now, when i see the script in twrp (sorry i don't know how is the name, i talking about the center botton in twrp) it appears in red "unable to mont '/data', '/system', '/cache'.
I don't know what to do, really, i need a hand.
beatLeo said:
OK, i should probably been the first idiot to bricked his phone by reading a tutorial.
I need some help. I was trying to make this extra space and i have a few problems during the process.
First of all, in my case i have a partition 23 called cust, exactly the same in size with the cache. So i started with the cache calculating and then the other 3( 23 cust, 24 system, 25 userdata). For that moment i already made my nandroid, buy for some stupid reason I saved to my pc.
My problems came when i began with step 4. When i tried to put the cache it told me that it can't do it because it was in use. So i twrp y put on mount and desmounted that partition and then i could keep going. Same thing happened with Data partition, i did the same.
Finally, i did it all the tutorial, just needed to restore as it said in step 5 because i didn't have it in my phone. So i tried with adb push but nothing and i couldn't mount again those partition with twrp. Then, in a desperate move, i tried to reflash my cm rom, so i did that. And later, it bootloop with te huawei logo and i can�´t flash a rom o restore my nandroid. It doesn't read a sdcard.
And now, when i see the script in twrp (sorry i don't know how is the name, i talking about the center botton in twrp) it appears in red "unable to mont '/data', '/system', '/cache'.
I don't know what to do, really, i need a hand.
Click to expand...
Click to collapse
Ok this is difficult because of your wording but it sounds like data, system and cache no longer exist.
Is your device the y6?
Do you have adb access?
Did you finish recreating the partitions?
Did you manage to name them if so?
Are you able to use recovery?
If you have adb can use please issue the following code, if you don't have adb can you please use twrp, advanced, terminal command to issue it.
Code:
ls /dev/block/bootdevice/by-name/
and let me know if it shows your cache, userdata and system.
DestructoSphere said:
Ok this is difficult because of your wording but it sounds like data, system and cache no longer exist.
Is your device the y6?
Do you have adb access?
Did you finish recreating the partitions?
Did you manage to name them if so?
Are you able to use recovery?
If you have adb can use please issue the following code, if you don't have adb can you please use twrp, advanced, terminal command to issue it.
Code:
ls /dev/block/bootdevice/by-name/
and let me know if it shows your cache, userdata and system.
Click to expand...
Click to collapse
- Yes, my device is Y6 (SCL-L03).
- Seems that i don't have access to adb, because in cmd show me "offline" device.
-Yes, i fineshed with that, but couldn't do the restore of backup.
- I did all step 4.
- Yes, i'm using twrp.
I put the code with twrp... and here it says not found.
Any ideas? I hope you could help me.
beatLeo said:
Ok this is difficult because of your wording but it sounds like data, system and cache no longer exist.
Is your device the y6?
Do you have adb access?
Did you finish recreating the partitions?
Did you manage to name them if so?
Are you able to use recovery?
If you have adb can use please issue the following code, if you don't have adb can you please use twrp, advanced, terminal command to issue it.
- Yes, my device is Y6 (SCL-L03).
- Seems that i don't have access to adb, because in cmd show me "offline" device.
-Yes, i fineshed with that, but couldn't do the restore of backup.
- I did all step 4.
- Yes, i'm using twrp.
I put the code with twrp... and here it says not found.
Any ideas? I hope you could help me.
Click to expand...
Click to collapse
You need to put a space between ls and the /
DestructoSphere said:
You need to put a space between ls and the /
Click to expand...
Click to collapse
ups, ok, i did that and i see all the partitions including cache, cust, system and userdata. Please, what is next?
beatLeo said:
ups, ok, i did that and i see all the partitions including cache, cust, system and userdata. Please, what is next?
Click to expand...
Click to collapse
Ok I suspect maybe the filesystems never got created.
Can you run
Code:
df
this will show you the currently mounted partitions free space.
Output will look something like this
Code:
Filesystem Size Used Free Blksize
/dev 442.6M 60.0K 442.5M 4096
/system 1.2G 948.5M 241.8M 4096
/data 5.2G 2.8G 2.4G 4096
/cache 147.2M 176.0K 147.0M 4096
/persist 3.9M 776.0K 3.1M 4096
/firmware 99.8M 46.8M 52.9M 2048
If you dont see data or cache they never got mounted at twrp start, system is not mounted by default.
Then if data is not listed try
Code:
mount -t ext4 /dev/block/bootdevice/by-name/userdata /data
Remember to have spaces between arguments.
Or try system by replacing "userdata" with "system" and "/data" with "/system"
If you get an error trying to mount please do the following referring to the attached screenshots.
In twrp, go to "wipe", "advanced wipe". Then select one of the partitions and select "repair or change filesystem".
This should give you info about the partition.
If you wish to reformat it select "change filesystem" then select "ext4" and swipe to confirm.
Now retry the mount command and hopefully it will succeed.
Do this for each partition then retry your backup/flash.
Hopefully this works, good luck.
Thanks for your help. At first i couldn't see cache or data partition. I did what you told me, and i made cache to appears with df command. System too. But i couldn't made the same with the userdata partition. I tried to repair but it didn't work.
Is there another way to remount that partition?
A question apart: what was that "cust" partiton i've got and you didn't in your images posted in cm12.1 post? Because i recalculated it too.
beatLeo said:
Thanks for your help. At first i couldn't see cache or data partition. I did what you told me, and i made cache to appears with df command. System too. But i couldn't made the same with the userdata partition. I tried to repair but it didn't work.
Is there another way to remount that partition?
A question apart: what was that "cust" partiton i've got and you didn't in your images posted in cm12.1 post? Because i recalculated it too.
Click to expand...
Click to collapse
Hi,
Does twrp show the userdatas partition filesystem type? Like in my previous screenshot cache is shown as ext4.
If not can you try change filesystem instead of the repair option and choose ext4.
I removed my cust partition altogether as I had no use for it.
DestructoSphere said:
Hi,
Does twrp show the userdatas partition filesystem type? Like in my previous screenshot cache is shown as ext4.
If not can you try change filesystem instead of the repair option and choose ext4.
I removed my cust partition altogether as I had no use for it.
Click to expand...
Click to collapse
Yes, it shows current file system: ext4. I tried repair and change file system but nothing. When i'm trying to use "mount -t ext4 /dev/..." it says "failed: invalid argument"
What else could i do?
I really appeciate your help man.
P.S: Sorry, i don't know why the screenshot looks not vertical.
beatLeo said:
Yes, it shows current file system: ext4. I tried repair and change file system but nothing. When i'm trying to use "mount -t ext4 /dev/..." it says "failed: invalid argument"
What else could i do?
I really appeciate your help man.
P.S: Sorry, i don't know why the screenshot looks not vertical.
Click to expand...
Click to collapse
Ok for some reason filesystem seems to have issues.
Can you please try
Code:
mkfs.ext2 -j /dev/block/bootdevice/by-name/userdata
to manually format it?
Remember spaces before and after -j option.
DestructoSphere said:
Ok for some reason filesystem seems to have issues.
Can you please try
Code:
mkfs.ext2 -j /dev/block/bootdevice/by-name/userdata
to manually format it?
Remember spaces before and after -j option.
Click to expand...
Click to collapse
It says mkfs.ext2: lseek: Value too large for define data type
beatLeo said:
Ok for some reason filesystem seems to have issues.
Can you please try
It says mkfs.ext2: lseek: Value too large for define data type
Click to expand...
Click to collapse
As far as I know that happens when you break some size limit.
How big did you make your userdata partition? Maybe you had a typo so I'm thinking you may want to run through the guide again to check but first can you let me know what you get if you write
Code:
blockdev --getsize64 /dev/block/bootdevice/by-name/userdata
DestructoSphere said:
As far as I know that happens when you break some size limit.
How big did you make your userdata partition? Maybe you had a typo so I'm thinking you may want to run through the guide again to check but first can you let me know what you get if you write
Code:
blockdev --getsize64 /dev/block/bootdevice/by-name/userdata
Click to expand...
Click to collapse
it says 5465161216
beatLeo said:
As far as I know that happens when you break some size limit.
How big did you make your userdata partition? Maybe you had a typo so I'm thinking you may want to run through the guide again to check but first can you let me know what you get if you write
it says 5465161216
Click to expand...
Click to collapse
Ok the number seems ok.
Can you please try using parted again with the guide to delete then recreate the partition making sure to specify the filesystem.
Hopefully that works but if not I think you need to rewrite the partition table a start again.
If it doesn't work can you please post the output from
Code:
parted
unit s
print free
DestructoSphere said:
Ok the number seems ok.
Can you please try using parted again with the guide to delete then recreate the partition making sure to specify the filesystem.
Hopefully that works but if not I think you need to rewrite the partition table a start again.
If it doesn't work can you please post the output from
Code:
parted
unit s
print free
Click to expand...
Click to collapse
Hi DestructoSphere,
tried to do that, but remember i can't get to adb so i can't find a way to paste the parted file into de sbin. Any ideas about that?
beatLeo said:
Ok the number seems ok.
Can you please try using parted again with the guide to delete then recreate the partition making sure to specify the filesystem.
Hopefully that works but if not I think you need to rewrite the partition table a start again.
If it doesn't work can you please post the output from
Hi DestructoSphere,
tried to do that, but remember i can't get to adb so i can't find a way to paste the parted file into de sbin. Any ideas about that?
Click to expand...
Click to collapse
In twrp can you mount mtp or usb storage and copy it to sdcard then twrp filemanager to copy to sbin?
Ok, i tried with a sdcard, but i couldn't either. It didn't recognize my sdcard. And i don't have an otg's usb.
But in twrp's cmd showed "mtp enabled". Could this means that i have to mounted the sd partition? If that is a yes, could you please write me the code ?
beatLeo said:
Ok, i tried with a sdcard, but i couldn't either. It didn't recognize my sdcard. And i don't have an otg's usb.
But in twrp's cmd showed "mtp enabled". Could this means that i have to mounted the sd partition? If that is a yes, could you please write me the code ?
Click to expand...
Click to collapse
Hi DestructoSphere, i finally resolve this. It was a lot simplier than you ever thought. I tried changing to ext2 my data partion, and then change it again to ext4 and that's how it works again.
Take a look into my partitions. But i still want to reduce to 100mb the modem partition.

Categories

Resources