[Q] Updater-script mounting questions - Galaxy S 4 Q&A, Help & Troubleshooting

Anyone with updater-script knowledge would be helpful.
I'm trying to make changes to my updater-script in my ROM to mount /system and /data in EXT4 or F2FS accordingly. This is to reduce the number of ROMs I have to upload (one for each file system type), plus it saves time for people who switch back and forth. And I believe this could help other ROMs also
So far I've come up with this ifelse condition:
Code:
ifelse(mount("ext4", "EMMC", "/dev/block/platform/msm_sdcc.1/by-name/system", "/system"),
# /system EXT4 mount
ui_print("Mounting /system in EXT4 mode");
sleep(1),
# /system F2FS mount
ui_print("Mounting /System in F2FS mode");
mount("f2fs", "EMMC", "/dev/block/platform/msm_sdcc.1/by-name/system", "/system");
sleep(1));
The main idea behind this is the recovery (I'm using TWRP, so I can't speak for Philz or CWM) will attempt to mount /system in EXT4 first. If it succeeds in the initial mount, it should print out the "mount in EXT4" line, which in testing has worked for me. I am in F2FS and I see that the initial mount fails and goes to the second mount. More of my testing with "is_mounted()" shows that if I go to the F2FS part, /system is not mounted yet until it runs mount with F2FS as the argument.
I made a test zip that, after this line, pushes a test file to /system/bin and also changes it's permissions successfully. I'll include it to download for anyone else who can test this for me.
Can anyone think of reasons why this is bad in practice? Or if this will cause any issues? The goal is that this will end up in a ROM's updater-script so I'd like to know anything before I start testing this myself. Thank you!

Related

[Q]Some questions about file systems and converting.

I'd like to ask you some questions
1)Which file system is the fastest?
2)How are the separate partitions tagged(I mean /data, /system etc.)?
My best (fastest) guess would be ext2. I'm using it and it looks the fastest for our device. You may try using ext4, but then it takes some space and time for keeping up the file system journal.
As for partitions:
/dev/block/stl6 /system
/dev/block/stl7 /data
/dev/block/stl8 /cache
/dev/block/stl4 /efs

[TIP] Improve system and data partitions' performance.

WARNING You shouldn't use this if you force reboot your rom or the rom reboots itself often, may cause corruption.
So I was poking around in adb shell while in Thor's recovery while doing a nandroid backup (I imagine this applies to all CWM recoveries as well), and I noticed it had tune2fs.
Being the Linux geek I am, I had to poke around and see how android mounts /system, /data and /cache, I noticed it used data=ordered and that the partitions had has_journal flag set.
Naturally that bothered me, so I had to fix it.
Code:
umount /system
umount /data
umount /cache
tune2fs -O ^has_journal -o journal_data_writeback /dev/block/mmcblk0p7 #/cache
tune2fs -O ^has_journal -o journal_data_writeback /dev/block/mmcblk0p9 #/system
tune2fs -O ^has_journal -o journal_data_writeback /dev/block/mmcblk0p10 #/data
This would need to be reapplied if your rom formats /system, /data and /cache instead of just deleting the files on them.
read : http://kernel.org/doc/Documentation/filesystems/ext4.txt
-o journal_data_writeback :
Data ordering is not preserved, data may be written
into the main file system after its metadata has been
committed to the journal.
Click to expand...
Click to collapse
read : http://wiki.openwrt.org/doc/howto/usb.storage
-O ^has_journal :
To retain good performance with the newer filesystems, particularly on flash USB storage, you should also consider disabling journaling with the "-O ^has_journal".
Click to expand...
Click to collapse
This can be done while the ROM is running over ADB, at least on Asylum v20, tune2fs is installed, however it's better to do it from recovery since you'd be able to umount them first.
And yes I realize this is too geeky for most, but it's 4am and I'm tired, I'll clean it up later.
Booting speed and apps writing to /data or /cache are noticeably faster.
I'm not responsible if it turns your N7000 into a Nokia 3500.
I created a flashable zip that automates this + runs fsck first on all 3 partitions, the zip doesn't actually anything.
License : Apache License v2.0
Here's the relevant code (META-INF/com/google/android/updater-script):
Code:
assert(getprop("ro.product.device") == "galaxynote" || getprop("ro.build.product") == "galaxynote" ||
getprop("ro.product.device") == "n7000" || getprop("ro.build.product") == "n7000" ||
getprop("ro.product.device") == "GT-N7000" || getprop("ro.build.product") == "GT-N7000");
ui_print("Life.Eq.Null's Ext4 Optimization Script.");
ui_print("Umounting /cache ...");
show_progress(0.500000, 5);
unmount("/cache");
ui_print("Umounting /system ...");
show_progress(0.500000, 10);
unmount("/system");
ui_print("Umounting /data ...");
show_progress(0.500000, 15);
unmount("/data");
ui_print("Running fsck on /cache ...");
show_progress(0.500000, 25);
run_program("/sbin/e2fsck", "-pv", "/dev/block/mmcblk0p7");
ui_print("Running fsck on /system ...");
show_progress(0.500000, 45);
run_program("/sbin/e2fsck", "-pv", "/dev/block/mmcblk0p9");
ui_print("Running fsck on /data ...");
show_progress(0.500000, 65);
run_program("/sbin/e2fsck", "-pv", "/dev/block/mmcblk0p10");
ui_print("Running tune2fs on /cache ...");
show_progress(0.500000, 75);
run_program("/sbin/tune2fs", "-O", "^has_journal", "-o", "journal_data_writeback", "/dev/block/mmcblk0p7");
ui_print("Running tune2fs on /system ...");
show_progress(0.500000, 85);
run_program("/sbin/tune2fs", "-O", "^has_journal", "-o", "journal_data_writeback", "/dev/block/mmcblk0p9");
ui_print("Running tune2fs on /data ...");
show_progress(0.500000, 95);
run_program("/sbin/tune2fs", "-O", "^has_journal", "-o", "journal_data_writeback", "/dev/block/mmcblk0p10");
show_progress(0.500000, 100);
ui_print("All done *hopefully*, Cross your fingers and reboot.");
But wouldn't this increase the chances of data corruption if the phone suddenly shuts down or reboots?
Sent from my GT-N7000 using xda premium
Well, in theory yes, in practice I've been running this on my own desktop for over a year and I lose power quiet often, I think over the past year I lost 1 file, and it happened because I was saving the file right as the power went out.
Also, I've been using Asylum v20 for over a week now, I've never had to force restart it.
If the battery runs out, the phone gracefully shuts itself down (syncs the data, umounts all partitions then shuts down properly), so there's no risk there.
I'm also working on a semi-generic way to mount /sdcard as ext4.
life.eq.null said:
Well, in theory yes, in practice I've been running this on my own desktop for over a year and I lose power quiet often, I think over the past year I lost 1 file, and it happened because I was saving the file right as the power went out.
Also, I've been using Asylum v20 for over a week now, I've never had to force restart it.
If the battery runs out, the phone gracefully shuts itself down (syncs the data, umounts all partitions then shuts down properly), so there's no risk there.
I'm also working on a semi-generic way to mount /sdcard as ext4.
Click to expand...
Click to collapse
Agreed, but I remember from my Galaxy S days about a few people complaining about data corruption from this very same tweak.
Sent from my GT-N7000 using xda premium
I'll add that warning to the first post that people should not be force rebooting the phone.
This is my first android phone, I was going based on my Linux experience.

CWM(Touch) Mount Points!

Hey Guys!
I have a device for which I am building CWM. The problem is my /system and /data are of the type UBIFS. And both the partitions aren't getting mounted through CWM.
Need help to understand how to mount ubifs file system.
This is the error while mounting system!!
Code:
mount: mounting /dev/block/mtdblock5 on /system failed: Invalid argument
Thnx!

[GUIDE] Make sd-ext as data partition (easy way)

You can find some thread for you to move data partition to sd-ext. But there is a easier way to do that: Modify the mount point of sd-ext and data in ramdisk.
The basic step is:
0. Make a nandroid backup
1. Make an ext4 partition on your sdcard (I used gparted in ubuntu, very fast and not lost data)
2. Download your kernel as boot.img
3. Unpack you boot.img (you can find many thread said how to do, and I think the most completly tool you can get from http://forum.xda-developers.com/showthread.php?t=1241005. You can find the example to unpack boot.img, extract ramdisk, repack ramdisk, repack boot.img from the README.txt file of this tool)
4. Extract ramdisk:
Code:
gzip -dc ../unpack/boot.img-ramdisk.gz | cpio -i
If you find ramdisk.cpio file, you need to extract it by
Code:
cpio -i -F ramdisk.cpio
5. Modify the mount point of data and sd-ext
- File fstab:
+ Find the line
Code:
/data yaffs2 userdata
, and change to
Code:
/data ext4 /dev/block/mmcblk0p2
- File init.semc.rc
+ Find the line
Code:
mount yaffs2 [email protected] /data nosuid nodev
and change to
Code:
mount ext4 /dev/block/mmcblk0p2 /data nosuid nodev
- File recovery.fstab:
+ Find the line
Code:
/data yaffs2 userdata
and change to
Code:
/data ext4 /dev/block/mmcblk0p2
6. Repack the ramdisk
If you extracted from ramdisk.cpio file, you need to pack to ramdisk.cpio first
Code:
find . | cpio -o -H newc -O <target path>/ramdisk.cpio
Then repack you ramdisk: At the ramdisk folder:
Code:
mkbootfs <ramdisk folder> | gzip > <target path>/boot.img-ramdisk-new.gz
7. Repack boot.img
Code:
mkbootimg --kernel <path to>/boot.img-zImage --ramdisk <path to>/boot.img-ramdisk-new.gz -o <path to>/boot_new.img --base `cat <path to>/boot.img-base`
8. Flash boot_new.img
9. Enter CWM, wipe phone and restore from your backup
--> Done
Thanks for the info. Or you can go on cmw and create sd-ext from there.
Will it Work with an ext3 partition too?
Gesendet von meinem LT15i
lol
i dont understand at all...
ARip Kenpachi said:
i dont understand at all...
Click to expand...
Click to collapse
It's because the title is wrong.. it's not the "easy way" .. it's a little bit more 'medium - adv user' way..
If it's so hard for you, I think it's better u to search 'script/app' for doing this.
There's a lot available like link2sd, cronmod script, etc
Excellent, it worked on Vengeance Kernel, actually that was the only kernel that I was able to extract the ramdisk.
Lupus kernel has is ramdisk in another format (not gzip), and KTG is in a elf file.
The boot took a little bit longer, but i think is more stable than using init.d scripts.
EDIT: Make the backup from an old CWM (like the one on the recoveryARC.img file), newer versions will check for the correct filesystem, and as we are changing it, It will not work. For restore, use any version of CWM (the one included on Vengeance works great).
Also, if you have an LT15i, backup your /system/vendor folder, otherwise, it will be not longer available (and a lot of apps will crash), I copied it into the data folder and made a symlink into /system/vendor (and as your data folder will be bigger, thats no issue).
I can't manage to do the trick on my Arc S with DoomKernel_v22. When I flash the modified .img the phone doesn't start and i can't go into CWM.
I have two partitions on SD, the second one is the ext4 i want to use.
These are the files extracted from Doomkernel:
fstab:
Code:
/data yaffs2 userdata
/cache yaffs2 cache
init.semc.rc:
Code:
on fs
# mount mtd partitions
# Mount /system rw first to give the filesystem a chance to save a checkpoint
mount yaffs2 [email protected] /system
mount yaffs2 [email protected] /system rw remount
mount yaffs2 [email protected] /data nosuid nodev
mount yaffs2 [email protected] /cache nosuid nodev
recovery.fstab:
Code:
/cache yaffs2 cache
/data yaffs2 userdata
/system yaffs2 system
/sdcard vfat /dev/block/mmcblk0p1
/sd-ext auto /dev/block/mmcblk0p2
Can anyone help me please?

[Discussion/Guide]Dalvik-Cache filling internal memory, possible fix

I've been having problem with Honor 4x(kirin 620) internal memory randomly filling without me even using phone. I realized it was dalvik-cache that was filling memory. It was taking like ~700MB after a month use.
I'm using ksrt12 rom AEX v4.6 for Honor 4X. There is a lot of free space in other partitions like /cust /cache /system so I did some searching and found similar discussion with an older/other device about moving dalvik-cache to /system partition and creating symlink to /data. This way you could free some space and put that wasted space in other partitions in some good use without re-partitioning your device.
Make dalvik-cache to take storage space form /cust and /cache
1. Make script like this and put it in /etc/init.d
Give it permissions 700 (rwx-------)
Code:
#!/system/bin/sh
mount -o remount,rw /cust
# If folders don't exist, create them
[ -d /cust/arm64 ] || mkdir /cust/arm64
[ -d /cache/arm ] || mkdir /cache/arm
# Making sure that dalvik-cache in /data is empty
rm -r /data/dalvik-cache/{arm64,arm}
mkdir /data/dalvik-cache/{arm64,arm}
# Set permissions
chmod 711 /cust/arm64 /cache/arm
# The part that actually does something useful
mount --bind,rw /cust/arm64 /data/dalvik-cache/arm64
mount --bind,rw /cache/arm /data/dalvik-cache/arm
2. Reboot to recovery and wipe dalvik-cache, cache and cust.
3. Reboot to system
4. Done!
If you want to wipe dalvik-cache you must wipe /cache and /cust
-deleted
updated thread to a bit easier solution

Categories

Resources