[Android Software/Hacking General [Developers Only]] .:Crack:.:
Hey Pika, could there be any chance that this script kills my Sdcard (external) almost every time i reboot?!

Has to be formatted every other reboot... (Since yesterday!)

Thanks..

edit: wait a sec, ill put the script i use in a

#!/system/bin/sh
#
# 89system_tweak V63
# by zacharias.maladroit
# modifications and ideas taken from: ckMod SSSwitch by voku1987 and "battery tweak" (collin_ph@xda)
# OOM/LMK settings by Juwe11
# network security settings inspired by various security, server guides on the web

# ==============================================================
# ==============================================================
# ==============================================================
# One-time tweaks to apply on every boot
# ==============================================================
# ==============================================================
# ==============================================================
# =========
STL=`ls -d /sys/block/stl*`;
BML=`ls -d /sys/block/bml*`;
MMC=`ls -d /sys/block/mmc*`;

# set the cfq scheduler as default i/o scheduler (Samsung ROMs)
for i in $STL $BML $MMC;
do
#	echo "sio" > $i/queue/scheduler;
done;

# Optimize non-rotating storage;
for i in $STL $BML $MMC;
do
#IMPORTANT!
if [ -e $i/queue/rotational ]
then
echo 0 > $i/queue/rotational;
fi;
if [ -e $i/queue/nr_requests ]
then
echo 1024 > $i/queue/nr_requests; # for starters: keep it sane
fi;
#CFQ specific
if [ -e $i/queue/iosched/back_seek_penalty ]
then
echo 1 > $i/queue/iosched/back_seek_penalty;
fi;
#CFQ specific
if [ -e $i/queue/iosched/low_latency ]
then
echo 1 > $i/queue/iosched/low_latency;
fi;
#CFQ Specific
if [ -e $i/queue/iosched/slice_idle ]
then
echo 1 > $i/queue/iosched/slice_idle; # previous: 1
fi;
# deadline/VR/SIO scheduler specific
if [ -e $i/queue/iosched/fifo_batch ]
then
echo 1 > $i/queue/iosched/fifo_batch;
fi;
if [ -e $i/queue/iosched/writes_starved ]
then
echo 1 > $i/queue/iosched/writes_starved;
fi;
#CFQ specific
if [ -e $i/queue/iosched/quantum ]
then
echo 8 > $i/queue/iosched/quantum;
fi;
#VR Specific
if [ -e $i/queue/iosched/rev_penalty ]
then
echo 1 > $i/queue/iosched/rev_penalty;
fi;
if [ -e $i/queue/rq_affinity ]
then
echo "1" > $i/queue/rq_affinity;
fi;
done;y

#disable iostats to reduce overhead # idea by kodos96 - thanks !
for k in $STL $BML $MMC;
do
if [ -e $i/queue/iostats ]
then
echo "0" > $k/queue/iostats;
fi;
done;

# Optimize for read- & write-throughput;

for i in $STL $BML $MMC;
do
if [ -e $i/queue/read_ahead_kb ]
then
echo "1024" > $i/queue/read_ahead_kb; # yes - I know - this is evil ^^, might help with battery runtime still (in certain workloads)
fi;

done;

# =========
# TWEAKS: raising read_ahead_kb cache-value for sd card to 2048 [not needed with above tweak but just in case it doesn't get applied]
# =========
#echo "2048" > /sys/devices/virtual/bdi/179:0/read_ahead_kb

# improved approach of the readahead-tweak:

if [ -e /sys/devices/virtual/bdi/179:0/read_ahead_kb ]
then
/system/xbin/echo "1024" > /sys/devices/virtual/bdi/179:0/read_ahead_kb;
fi;

if [ -e /sys/devices/virtual/bdi/179:8/read_ahead_kb ]
then
/system/xbin/echo "1024" > /sys/devices/virtual/bdi/179:8/read_ahead_kb;
fi;

if [ -e /sys/devices/virtual/bdi/default/read_ahead_kb ]
then
/system/xbin/echo "128" > /sys/devices/virtual/bdi/default/read_ahead_kb;
fi;

# ==============================================================
# ==============================================================
# ==============================================================
# VFS, VM settings
# ==============================================================
# ==============================================================
# ==============================================================

# =========
# TWEAKS: MEMORY SETTINGS for general operation + zcache/zram usage
# =========

# optimizing the system for zcache & zram usage [Samsung ROMs only (for now)]

echo 0 > /proc/sys/vm/swappiness # 70 for zram, Talon # 0 for CM7 / MIUI (no zram yet)
echo 3 > /proc/sys/vm/page-cluster # when swapping then hesitate to swap out pages & pull them in again in a fast manner

##echo 20 > /proc/sys/vm/vfs_cache_pressure; # 100 while screen off # 200 # 50
echo 50 > /proc/sys/vm/vfs_cache_pressure; # same value for both: screen on & off - needs some testing due to RAM filling and OOM killer triggering # 20 (on talon & testing)

echo 0 > /proc/sys/vm/laptop_mode; # do not omit syncing
echo 700 > /proc/sys/vm/dirty_expire_centisecs; # 2000 # 700 is long enough [stability testing]
echo 500 > /proc/sys/vm/dirty_writeback_centisecs; # 1000 # 500 is long enough [stability testing]
echo 10 > /proc/sys/vm/dirty_background_ratio; # 15 # 10 # 50
echo 80 > /proc/sys/vm/dirty_ratio; # 40 # 90
#	echo 20 > /proc/sys/vm/vfs_cache_pressure; # 100 while screen off # 200 # 50 # 20 [less reclaim]
echo 0 > /proc/sys/vm/overcommit_memory
echo 0,1,2,4,6,15 > /sys/module/lowmemorykiller/parameters/adj
echo 2560,4096,5632,10240,11776,14848 > /sys/module/lowmemorykiller/parameters/minfree

# ==============================================================
# ==============================================================
# ==============================================================
# network speed and throughput
# ==============================================================
# ==============================================================
# ==============================================================

# =========
# TWEAKS: for TCP read/write
# =========
echo 0 > /proc/sys/net/ipv4/tcp_timestamps;
echo 1 > /proc/sys/net/ipv4/tcp_tw_reuse;
echo 1 > /proc/sys/net/ipv4/tcp_sack;
echo 1 > /proc/sys/net/ipv4/tcp_dsack;
echo 1 > /proc/sys/net/ipv4/tcp_tw_recycle;
echo 1 > /proc/sys/net/ipv4/tcp_window_scaling;
echo 5 > /proc/sys/net/ipv4/tcp_keepalive_probes;
echo 30 > /proc/sys/net/ipv4/tcp_keepalive_intvl;
echo 30 > /proc/sys/net/ipv4/tcp_fin_timeout;
echo 524288 > /proc/sys/net/core/wmem_max;
echo 524288 > /proc/sys/net/core/rmem_max;

# Increase the maximum total TCP buffer-space allocatable
sysctl -w net.ipv4.tcp_mem="57344 57344 65536"

echo 1 > /proc/sys/net/ipv4/tcp_moderate_rcvbuf # enabled by default
# removes an odd behavior in the 2.6 kernels, whereby the kernel stores the slow start threshold for a client between TCP sessions. This can cause undesired results, as a single period of congestion can affect many subsequent connections.

echo 256960 > /proc/sys/net/core/rmem_default;
echo 256960 > /proc/sys/net/core/wmem_default;
echo 4096 16384 404480 > /proc/sys/net/ipv4/tcp_wmem;
echo 4096 87380 404480 > /proc/sys/net/ipv4/tcp_rmem;
setprop net.tcp.buffersize.default 4096,87380,256960,4096,16384,256960;
setprop net.tcp.buffersize.wifi 4095,87380,256960,4096,16384,256960;
setprop net.tcp.buffersize.umts 4094,87380,256960,4096,16384,256960;
setprop net.tcp.buffersize.gprs 4094,87380,256960,4096,16384,256960;
setprop net.tcp.buffersize.edge 4094,87380,256960,4096,16384,256960;

# ==============================================================
# ==============================================================
# ==============================================================
# network security related settings
# ==============================================================
# ==============================================================
# ==============================================================

# Configure the server to ignore broadcast pings and smurf attacks:
# (smurf-attacks)

echo "1" > /proc/sys/net/ipv4/icmp_echo_ignore_broadcasts # default

echo "1" > /proc/sys/net/ipv6/icmp_echo_ignore_broadcasts # default

# Ignore all kinds of icmp packets or pings:

echo "1" > /proc/sys/net/ipv4/icmp_echo_ignore_all # default: 0

echo "1" > /proc/sys/net/ipv6/icmp_echo_ignore_all # default: 0

# Some routers send invalid responses to broadcast frames, and each one generates a
# warning that is logged by the kernel. These responses can be ignored:

echo "1" > /proc/sys/net/ipv4/icmp_ignore_bogus_error_responses

echo "1" > /proc/sys/net/ipv6/icmp_ignore_bogus_error_responses

echo 4096 > /proc/sys/net/ipv4/tcp_max_syn_backlog # default: 128

echo 2 > /proc/sys/net/ipv4/tcp_synack_retries # default: 5

# Increase the number of outstanding syn requests allowed.
# Note: some people (including myself) have used tcp_syncookies to handle the problem of too many legitimate outstanding SYNs.

echo "2500" > /proc/sys/net/core/netdev_max_backlog # default: 1000
echo "1" > /proc/sys/net/ipv4/tcp_window_scaling # default

# enabling syncookies
echo "1" > /proc/sys/net/ipv4/tcp_syncookies # default

#echo "0" > /proc/sys/net/ipv6/tcp_syncookies

# sysctl -w net.ipv4.tcp_window_scaling=1
echo "1" > /proc/sys/net/ipv4/tcp_window_scaling # default

# disable IP dynaddr
echo "0" > /proc/sys/net/ipv4/ip_dynaddr # default

# ==============================================================
# ==============================================================
# ==============================================================
# general phone/RIL-related settings
# ==============================================================
# ==============================================================
# ==============================================================
# =========
echo 0 > /proc/sys/kernel/hung_task_timeout_secs;

# ==============================================================
# ==============================================================
# ==============================================================
# Optimize SQlite databases of apps
# ==============================================================
# ==============================================================
# ==============================================================
# =========
for i in \
`find /data -iname "*.db"`;
do \
sqlite3 $i 'VACUUM;';
done;

# =========
# TWEAKS: new scheduler performance settings (test)
# =========

echo "NO_GENTLE_FAIR_SLEEPERS" > /sys/kernel/debug/sched_features;
echo "NO_NEW_FAIR_SLEEPERS" > /sys/kernel/debug/sched_features;
echo "NO_NORMALIZED_SLEEPER" > /sys/kernel/debug/sched_features;

-> CM7

+ S70Darkyzipalign + sqlite3 and zipalign in /system/xbin