I've ben gone for a while after working on my app2sd script (unfortunately I wasn't able to completely debug it, but kudos to devs that got it working for different devices) and I thought it would be nice to list some of the interesting commands I used to put the script together and eventually add other useful commands that can pull interesting info from devices, thus helping devs accomplish whatever it is that they're trying to accomplish.
For starters, this is one of my favorites, though unfortunately it doesn't work in every device:
Find Partition Blocks by Name:
Code:
ls -ln $(ls -lnR /dev | busybox egrep -i "by-name" | busybox grep /dev | busybox cut -f1 -d':') | busybox cut -f2 -d':' | busybox cut -f2,3,4 -d' '
Code:
BOOT -> /dev/block/mmcblk0p5
BOTA0 -> /dev/block/mmcblk0p1
BOTA1 -> /dev/block/mmcblk0p2
CACHE -> /dev/block/mmcblk0p8
EFS -> /dev/block/mmcblk0p3
HIDDEN -> /dev/block/mmcblk0p10
OTA -> /dev/block/mmcblk0p11
PARAM -> /dev/block/mmcblk0p4
RADIO -> /dev/block/mmcblk0p7
RECOVERY -> /dev/block/mmcblk0p6
SYSTEM -> /dev/block/mmcblk0p9
USERDATA -> /dev/block/mmcblk0p12
As you can see, if your device has the info, like my Galaxy Note 10.1, it will list every partition in the device with their name and their respective block.
Let's say you needed to point to the recovery partition, you could take the command one step further to make it return the recovery partition itself:
Code:
ls -ln $(ls -lnR /dev | busybox egrep -i "by-name" | busybox grep /dev | busybox cut -f1 -d':') | busybox cut -f2 -d':' | busybox cut -f2,3,4 -d' ' | busybox egrep -i "recovery" | busybox cut -f3 -d' '
Returns:
Code:
/dev/block/mmcblk0p6
Find folders using up the most space:
This is a quick way to find folders using the most space on your device. Great when you're running out of space.
Code:
busybox du -sh $(du -kHd 100 [XXXX] 2>/dev/null | sort -nr | cut -f2 | head -[YY]) 2>/dev/null
Replace [XXXX] with the path you want to analyze, such as /sdcard
Replace [YY] with how many results you want to show, such as the top 10 folders using up space
Code:
busybox du -sh $(du -kHd 100 /sdcard 2>/dev/null | sort -nr | cut -f2 | head -10) 2>/dev/null
would show the top largest folders in /sdcard
Reserved...
And if anyone has useful commands that they would like to contribute, please feel free to post them and I'll add them to the OP with credits.
Related
So, I've been playing around with QuickSSHd and one thing I noticed is there aren't many tools available in the shell. I put an arm build of Fedora on the phone, and now I have access to strace, gdb, gcc, etc..
I figured I'd post my steps here in case anyone else is interested.
1) First thing I did was root the phone with the Unrevoked app.
2) Then I bought a 16 gb microsd card so I wouldn't have to split the 8gb card that came with the phone
3) I partitioned the new card on my linux box using fdisk. I did two partitions, the first a FAT partition and the second a linux one. It was something like:
# fdisk /dev/sdb
d 1
n
p
1
t
c
n
p
2
w
# /sbin/mkfs.vfat /dev/sdb1
# /sbin/mkfs.ext3 /dev/sdb2
4) One that was done, i mounted the ext3 partition and grabbed this prebuilt fedora chroot tarball:
ftp.linux.org.uk/pub/linux/arm/fedora/rootfs/rootfs-f12.tar.bz2
and untarred it into a directory i called "fedora" on the ext3 partition.
5) I then turned off my phone, pulled out the battery and swapped the existing sdcard with my newly formatted one, put the phone back together and booted it up. It took a long time to boot after this and in the notification panel it said it was "preparing the sdcard"
6) Then i started QuickSSHd back up and ssh'd to the machine as root
7) next i ran "busybox sh" to get a better shell than whatever was started before
8) then I created a shell script called f12.sh that looked like this:
--8<----------
#!/bin/sh
cd $HOME
mkdir -p mnt/fedora
mkdir -p dev
ln -sf /dev/block/vold/179\:2 dev/sdcard2
grep -q dev/sdcard2 /proc/mounts || mount dev/sdcard2 mnt/fedora
grep -q rootfs-f12/dev /proc/mounts || mount --bind /dev mnt/fedora/rootfs-f12/dev
grep -q rootfs-f12/sys /proc/mounts || mount --bind /sys mnt/fedora/rootfs-f12/sys
grep -q rootfs-f12/proc /proc/mounts || mount --bind /proc mnt/fedora/rootfs-f12/proc
grep -q rootfs-f12/tmp /proc/mounts || mount -ttmpfs tmpfs mnt/fedora/rootfs-f12/tmp
mkdir -p mnt/fedora/rootfs-f12/mnt/system
mkdir -p mnt/fedora/rootfs-f12/mnt/data
grep -q rootfs-f12/mnt/system /proc/mounts || mount --bind /system mnt/fedora/rootfs-f12/mnt/system
grep -q rootfs-f12/mnt/data /proc/mounts || mount --bind /system mnt/fedora/rootfs-f12/mnt/data
mkdir -p mnt/fedora/rootfs-f12/debug
grep -q rootfs-f12/debug /proc/mounts || mount -tdebugfs debugfs mnt/fedora/rootfs-f12/debug
export LD_LIBRARY_PATH=`pwd`/mnt/fedora/rootfs-f12/lib:`pwd`/mnt/fedora/rootfs-f12/usr/lib
export HOME=/root
cd mnt/fedora/rootfs-f12
lib/ld-linux.so.3 usr/sbin/chroot . bin/bash --login
------>8---------------------
I used vi for this, you could use cat > f12.sh instead.
One weird part of this is the /dev/block/vold/179\:2 symlink. The busybox version of mount apparently can't grok source devices with colons in them. The symlink is just to rename it to something that mount can understand. I imagine the 179 part varies from system to system.
9) Then i ran sh f12.sh which put me in a fedora chroot.
10) I notice the rpm database is a little screwy in the chroot so I ran
# rm -f /var/lib/rpm/__db*
# rpm --rebuilddb
11) At this point I could yum:
# yum -y install strace gdb screen gcc vim-enhanced powertop
Some useful things:
- The kernel debug filesystem is in /debug
- Parts of the phone OS are available in /mnt/data and /mnt/system
Attached is an updated f12.sh (minor tweaks made as I've noticed issues come up)
wow, this is quite interesting!
i might venture into giving this a try.
two pieces of information, only as an FYI, i make no claim to whether or not these are better than the method you provide, only an alternate method which might or might not be better. perhaps a combination of methods would be best? i'll leave it up to the end user to decide.
1) some of those binaries you mention, like strace are already provided by the userdebug PC36IMG.zip (root part 1) in system/xbin from HTC. if anybody wants these binaries, they can be extracted from the system.img inside of the .zip file using unyaffs. if requested, i can post.
2) android open source project, which contains all the source files for android, provides dropbear has a compact arm compiled ssh client.
thanks for taking the time to test all this out and posting up the detailed step by step along with your .sh file!!!
Ok so the reason why I made this topic is because Coertmans asked me about virtual ram in android (2.3.6), which is available in CM9, so I went surfing on the interwebs to find about this zRam, first thing I found was this:
Site: http://code.google.com/p/compcache/ (ramzswap_32a.ko/ramzswap_32b.ko)
Instructions: http://code.google.com/p/compcache/wiki/CompilingAndUsingNew
This is the link to the zRam modules for linux kernels, as I'm not sure if it's able to import it into GB I continued searching and found a GB ROM (CM7) which has zRam. I downloaded the rom and searched for the files that possible could be the zRam. All ram/swap related items I got are these:
in /system/etc/init.d/07script
Code:
ZRAM=`ls -d /sys/block/zram*`;
for z in $ZRAM
do
echo 256 > $z/queue/read_ahead_kb;
echo 0 > $z/queue/iostats
done
if [ -e /sys/kernel/mm/ksm/run ]; then
echo "Kernel Samepage Merging support ON for RAM managment speedup."
echo 1 > /sys/kernel/mm/ksm/run
fi
ZRAM=`ls -d /sys/block/zram*`;
for z in $ZRAM
do
echo 256 > $z/queue/read_ahead_kb;
echo 0 > $z/queue/iostats
done
in /sdcard/gscript/swapon.sh
Code:
echo "Enabling SWAP Now! Please Wait."
echo "OFFLINE"
free | grep Swap
swapon -a
echo "ONLINE"
free | grep Swap
sleep 2
echo "DONE, Have a Nice Day!"
in /sdcard/gscript/swapoff.sh
Code:
echo "Disabling SWAP Now! Please Wait."
echo "ONLINE"
free | grep Swap
swapoff -a
echo "OFFLINE"
free | grep Swap
sleep 2
echo "DONE, Dont forget to turn it back ON"
in /sdcard/gscript/system-to-ram-off.sh
Code:
#!/system/bin/sh
#System unmount from ram by Dorimanx!
umount -l /system/app/ 2> /dev/null
umount -l /system/framework 2> /dev/null
echo "DONE. system is removed from RAM, do your changes now."
In /sdcard/gscript/ram-clean.sh
Code:
#!/system/bin/bash
#Created by Dorimanx for cron ram managment
CPULOAD=$(cat /proc/loadavg | cut -d " " -f1)
sleep 1
while [[ ! $CPULOAD < 2.00 ]]
do
echo "Waiting For CPU to cool down"
sleep 30
CPULOAD=$(cat /proc/loadavg | cut -d " " -f1)
sleep 1
done
#Boosting CPU
CHECKMAXFREQ=`cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq`
CHECKMINFREQ=`cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq`
echo 998400 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
echo 998400 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
sync
ZRAMUSE=`cat /proc/swaps | grep -v /dev/block/mmcblk0p3 | grep -v /sd-ext/swap | grep -v /sdcard/mnt/swap | grep -v /sdcard/swap | grep -v Used | cut -s -f3`
if [[ $ZRAMUSE < 10000 ]]
then
echo "no need to clean zram"
else
if [ -e /dev/block/mmcblk0p3 ]
then
sysctl -w vm.drop_caches=3
swapoff /dev/block/zram0
sleep 2
swapon /dev/block/zram0
sleep 2
swapoff /dev/block/mmcblk0p3
sleep 2
swapon /dev/block/mmcblk0p3
elif [ -e /sdcard/swap ]
then
sysctl -w vm.drop_caches=3
swapoff /dev/block/zram0
sleep 2
swapon /dev/block/zram0
sleep 2
swapoff /sdcard/swap
sleep 2
swapon /sdcard/swap
elif [ -e /sd-ext/swap ]
then
sysctl -w vm.drop_caches=3
swapoff /dev/block/zram0
sleep 2
swapon /dev/block/zram0
sleep 2
swapoff /sd-ext/swap
sleep 2
swapon /sd-ext/swap
fi
fi
#In case no secondary SWAP detected and ZRAM use lower than 80MB then we can safely clean it.
ZRAMUSE=`cat /proc/swaps | grep -v /dev/block/mmcblk0p3 | grep -v /sd-ext/swap | grep -v /sdcard/mnt/swap | grep -v /sdcard/swap | grep -v Used | cut -s -f3`
if [[ $ZRAMUSE < 80000 ]]
then
swapoff /dev/block/zram0
sleep 2
swapon /dev/block/zram0
fi
sync
sysctl -w vm.drop_caches=3
date > /data/cron-clear-swap
echo "runing clear swap every 4:20AM" >> /data/cron-clear-swap
echo "ram and swap cleared"
#Restoring CPU
echo $CHECKMAXFREQ > /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq
echo $CHECKMINFREQ > /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
developer comment on the files in gscripts
dorimanx said:
About SWAP!
ROM will activate 3 kind of swap
It's will turn ON (only if you have already created swap file on partition, or set partition for swap (the hard way) )
SD-EXT SWAP
SD-SWAP
EXT dedicated SWAP partition
***If you have SWAP already, or EXT or SD-SWAP/EXT-SWAP, no need to run the swap activation scripts.
***I have created 2 scripts for disabling SD swap before use of USB storage.
I have put them in your /sdcard/gscript
so you only need the app (gscript light or full)
then load this scripts, when you need usb storage run swapoff script. when done run swapon.
or you can install dual mount app. i can’t live without it so try it.
Click to expand...
Click to collapse
and
dorimanx said:
SD SWAP THE EASY WAY!
In Easy way Swap you don't need to reformat or even reboot your phone to create swap!
If you installed my ROM and you don't have swap but you want to stay on HIGH END ROM,
Then you can do this to enable SD swap
Download script sdswap200.sh or dataswap250.sh from my mirror.
Run in in GSCRIPT App or copy it to SDCARD root,
Click to expand...
Click to collapse
sdswap200.sh
Code:
#!/system/bin/sh
# Created by Dorimanx
echo "WORKING PLEASE WAIT A MINUTE"
echo "Remounting System to allow WRITE"
mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system
if [ -e /sdcard/swap ]; then
swapoff -a
rm -f /sdcard/swap
fi
if [ -d /mnt/sdcard ]; then
echo "Creating SWAP on SDCARD"
busybox dd if=/dev/zero of=/sdcard/swap bs=1k count=250000 > /dev/null
mkswap /sdcard/swap > /dev/null
echo "/sdcard/swap swap swap" >> /system/etc/fstab
echo 50 > /proc/sys/vm/swappiness
swapon -a
echo "DONE CREATING, ENJOY MORE RAM"
free
sleep 3
else
echo "Your SDCARD NOT MOUNTED, SWAP CANT BE CREATED"
fi
dataswap250.sh
Code:
#!/system/bin/sh
# Created by Dorimanx
echo "WORKING PLEASE WAIT A MINUTE"
echo "Remounting System to allow WRITE"
mount -o remount,rw /system
if [ -e /sd-ext/swap ]; then
swapoff -a
rm -f /sd-ext/swap
fi
if [ -d /sd-ext ]; then
echo "Creating SWAP on SD-EXT"
busybox dd if=/dev/zero of=/sd-ext/swap bs=1k count=250000 > /dev/null
mkswap /sd-ext/swap > /dev/null
echo "/sd-ext/swap swap swap" >> /system/etc/fstab
echo 50 > /proc/sys/vm/swappiness
swapon -a
echo "DONE CREATING, ENJOY MORE RAM"
free
sleep 3
else
echo "You do not have EXT partition!, Cant create SWAP"
fi
in /sdcard/gscripts/swaphard.sh
Code:
echo "Activating EXT SWAP Please Wait"
mount -o rw,remount -t yaffs2 /dev/block/mtdblock3 /system
mkswap /dev/block/mmcblk0p3
echo "/dev/block/mmcblk0p3 swap swap" >> /system/etc/fstab
swapon -a
echo "DONE"
free
sleep 3
So what do you guys think about it? It seems to me that this is really possible on GB
This is what I tried so far:
Code:
adb shell
su
mount -o remount rw /system
busybox dd if=/dev/zero of=/sdcard/swap bs=1k count=250000 > /dev/null
busybox mkswap /sdcard/swap > /dev/null
echo "/sdcard/swap swap swap" >> /system/etc/vold.fstab
echo 50 > /proc/sys/vm/swappiness
swapon -a
Now I don't get an error, but also nothing seems to happen, I'm going to try to make the sdcard "swappable ready" the manual way now
edit: Hmm I can only pick my internal sdcard for partitioning the sdcard, someone knows how to do that for external?
And how can I see if the virtual ram is actually working?
btw here is the mirror with the files I used: http://www.bourseanalyse.fr/dorimanx/
btw, totally of topic, but I saw 2 cars on fire so I made a video
broodplank1337 said:
And how can I see if the virtual ram is actually working?
Click to expand...
Click to collapse
The easiest and the only way i know of to check how ram, swap, and memory is used is by going into Terminal Emulator and typing in "free" and click enter... (without the quotations)
shahbaz5588 said:
The easiest and the only way i know of to check how ram, swap, and memory is used is by going into Terminal Emulator and typing in "free" and click enter... (without the quotations)
Click to expand...
Click to collapse
Ok thanks, used: "free | grep Swap" seems it's not working yet.
Hello
do you know the app swapper2 ?
it do the same what you try to do here !
But in the german forum there are some people who bricked their device with this app so i just want to say that you really have to pay attention with swapping
PortoBraso said:
Hello
do you know the app swapper2 ?
it do the same what you try to do here !
But in the german forum there are some people who bricked their device with this app so i just want to say that you really have to pay attention with swapping
Click to expand...
Click to collapse
they bricked it because of partition of internal sdcard If all of us will partition internal sdcard we have more than 50% chances to brick our device. It seems that partioning internal SD affects the 1-8 boot partitions (dunno how to explain it better) I`ve just woke up lol
Also we need a kernel that supports swap
And we don't have such a kernel
Sent from my GT-I9001 using XDA
broodplank1337 said:
Ok thanks, used: "free | grep Swap" seems it's not working yet.
Click to expand...
Click to collapse
if u are getting all 0's in swap then it is not working... i thik you can try going thru htc dream (G1) gingerbread roms.... they used swap and zramk a lot... well it was essential for the rom to run on that device
If it looks like this (with zeros in the swap line), you do not have swap/compcache:
total used free shared buffers
Mem: 97932 96640 1292 0 272
Swap: 0 0 0
Total: 97932 96640 1292
If it looks like this (with anything other than zeros in the swap line), you do have swap/compache:
total used free shared buffers
Mem: 97932 96004 1928 0 332
Swap: 24472 0 24472
Total: 122404 96004 26400
I had a swap partition on my galaxy 3 and i just wanted to say that it isnt fun...it makes the phone laggy cause you can never have a sd-card which is as fast as a ram module
Sent from my GT-I9001 using XDA
Yes! SDcards even class 10, ain't that stable. Anyhow what's the big deal ?
we never fall short of ram on our device.
Had tried ram swapping on my I9003 and i managed to screw up everything,made it a paper weight (Hard bricked it).
Had to get the board replaced from samsung, on the good side i got the latest latona board with 16gb onboard memory
but i no longer have the i9003
I tried swap while I had Galaxy 3 (it only has 256MB RAM) and I didn't like it. Also many other people reported that it was only slowing down system (even with class 10 cards) SD Cards just aren't fast enough to be used as a RAM...plus, Android is based on a though that free RAM is wasted RAM, right? 512MB for our phone is enough for me, and I've never fallen short of RAM..swap is not needed..but that's just my opinion
I'm not going to continue on this anyway, making your sdcard a swap drives really ****s it up, when I tried to install an app my phone shut down..
I hate to have my 8 gigs of internal storage splitted between data and sdcard, considering that I have a 16gigs external sd, this is a lot annoying. So, checking the partition tree I found out that it should be possibile to merge internal_sd and data partition.
Now, this operation is risky, so I would like to ask if someone (even on other devices) has tryed this and succeded, or any possibile side effects on system behavior.
thanks
any news for this mod?
Sent from my HTC One SV using xda app-developers app
Thirded
madpausa said:
I hate to have my 8 gigs of internal storage splitted between data and sdcard, considering that I have a 16gigs external sd, this is a lot annoying.
Click to expand...
Click to collapse
I'm interested in this too, I want to get my Google Play music off my internal fake "sdcard" mount and onto my actual SD card. Plus I'm tired of running out of space on my "internal storage" and having to move it to the (also internal) "phone storage"...
I've had a look around the forums and there seems to be a few posts on achieving this for other handsets (Samsung Galaxy Ace, HTC One X) but I don't know how applicable the advice on those threads would be for a HTC One SV.
+1
I encountered this problem last night when I got an error saying I needed more storage space.
Code:
#!/system/bin/sh
# =========================================================================== # NexTool Swap Enble For Sense # # $LastChangedDate: 2012-10-10 20:27:06$ # ===========================================================================
LOG_FILE=/data/swap.log if [ -e $LOG_FILE ]; then rm $LOG_FILE fi
echo "Starting swap set $( date +"%m-%d-%Y %H:%M:%S" )" | tee -a $LOG_FILE
if [ ! -e /system/xbin/busybox ]; then echo "busybox not installed" | tee -a $LOG_FILE exit -1 fi
# enable swap prtition 130m /system/xbin/busybox mkswap /dev/block/mmcblk0p27 | tee -a $LOG_FILE
# enable swap file on /mnt/emmc CREATE_EMMC_SWAPFILE=1
# mount /mnt/emmc if needed if [ -e /mnt/emmc ]; then # check if already mounted cat /proc/mounts |grep mmcblk0p32 &> /dev/null
if [ $? -eq 1 ]; then # not mounted till now busybox mount -t vfat -o nosuid,nodev /dev/block/mmcblk0p32 /mnt/emmc if [ $? -eq 1 ]; then echo "failed to mount /dev/block/mmcblk0p32 to /mnt/emmc" | tee -a $LOG_FILE CREATE_EMMC_SWAPFILE=0 fi else # mounted - check if its an ext partition cat /proc/mounts |grep mmcblk0p32 | grep ext4 &> /dev/null if [ $? -eq 1 ]; then echo "/mnt/emmc is not an ext4 partition" | tee -a $LOG_FILE CREATE_EMMC_SWAPFILE=0 fi fi else echo "/mnt/emmc not found" | tee -a $LOG_FILE CREATE_EMMC_SWAPFILE=0 fi
if [ $CREATE_EMMC_SWAPFILE -eq 1 ]; then if [ -e /mnt/emmc ]; then if [ -e /mnt/emmc/swapfile ]; then rm /mnt/emmc/swapfile fi
# 60m dd if=/dev/zero of=/mnt/emmc/swapfile bs=1024 count=61440 | tee -a $LOG_FILE /system/xbin/busybox mkswap /mnt/emmc/swapfile | tee -a $LOG_FILE /system/xbin/busybox swapon /mnt/emmc/swapfile | tee -a $LOG_FILE fi fi
/system/xbin/busybox free | tee -a $LOG_FILE cat /proc/swaps | tee -a $LOG_FILE
echo "Ending swap set $( date +"%m-%d-%Y %H:%M:%S" )" | tee -a $LOG_FILE
this was used on my HTC One V for this issue. even though it was only 130mb extra, it still helped.
^^ I was really hoping when I clicked "click to show content" there was a link to a magical program I could install to solve this issue
Lol I'm working on modifying it for this phone. Once I get it working I'll post it
EDIT: all the information I've found on creating the bind of internal storage and app storage seems like it does more damage than good
russellvone said:
Lol I'm working on modifying it for this phone. Once I get it working I'll post it
EDIT: all the information I've found on creating the bind of internal storage and app storage seems like it does more damage than good
Click to expand...
Click to collapse
For what I could understand, the fake partition was made to be used as fat32 filesystem, so that windows could read it as a mass storage device... For me this behaviour is not really useful :/
If we were on a PC I would've erased data and fake sd partition, to make a new data partition... though I don't have the knowledge to do this safely on android.
When I'll know more, I'll do that
Will this http://forum.xda-developers.com/showthread.php?t=2432479 work with our phones?
I am curious where are the people or posts that have done this to their one x phones?
I was looking for a way to speed up my TF700t, running Cyanogenmod 11. Generally I'm very happy with my tablet, but over the last months Chrome performance got worse and worse, both while browsing and when switching to other apps / the homescreen.
Googling a bit I found the browser2ram thing, which in principle simply mounts a tmpfs over the browser cache directory. As the scripts I found for download, were pretty bloated and did not hint at cyanogenmod integration, I came up with my own scripts, which I'm about to share here.
To make the chrome cache reside in a 100MB tmpfs, copy the following code snippet to /data/local/userinit.d/chrome_cache_to_ram, creating the directory when it's missing, and then make the script executable (chmod 755 /data/local/userinit.d/chrome_cache_to_ram)
Code:
#! /system/bin/sh
CHROME_CACHE=/data/data/com.android.chrome/cache
[ -d $CHROME_CACHE ] || exit 0
fgrep chrome_cache /proc/mounts >/dev/null && exit 0
set $(stat $CHROME_CACHE | fgrep Uid | tr '(/)' ' ')
mount -t tmpfs -o size=100m,mode=$2,uid=$5,gid=$8 chrome_cache $CHROME_CACHE
You can do the same for gmail, using this script saved and made executable as /data/local/userinit.d/gmail_cache_to_ram :
Code:
#! /system/bin/sh
GMAIL_CACHE=/data/data/com.google.android.gm/cache
[ -d $GMAIL_CACHE ] || exit 0
fgrep gmail_cache /proc/mounts >/dev/null && exit 0
set $(stat $GMAIL_CACHE | fgrep Uid | tr '(/)' ' ')
mount -t tmpfs -o size=50m,mode=$2,uid=$5,gid=$8 gmail_cache $GMAIL_CACHE
Credits to: ameer1234567890
Official Thread:Online Nandroid Backup / Nandroid Backup without re-booting
I wanted to use Ameer's script/app on my new Galaxy S7 but it was not recognized.
I was able to make it work myself by generating the correct patch file using this script:
Code:
mount -o rw,remount /system
echo "dev: size erasesize name" > /system/partlayout4nandroid
cd `find /dev -name by-name`
for d in * ; do
lc=`echo $d | tr [A-Z] [a-z]`
dev=`readlink $d | awk -F/ '{print $NF}'`
hex=$(printf "%07x\n" `dd if=$d of=/dev/null bs=1m 2>&1 | grep bytes | awk '{print $1/1024}'`)
echo "$dev: $hex 0000000 \"$lc\"" >> /system/partlayout4nandroid
done;
mount -o ro,remount /system
I had also to change this line :
Code:
if $bb [ "`$bb cat /system/partlayout4nandroid | $bb egrep "(mtd|mmc|bml|nand|act)"`" != "" ]; then
to
Code:
if $bb [ "`$bb cat /system/partlayout4nandroid | $bb egrep "([B]sda|[/B]mtd|mmc|bml|nand|act)"`" != "" ]; then
Cheers