Hello boys,
before spending useless some euros on a new MicroSD ...
Can you please post BRAND, NAME, SIZE AND CLASS of your Microsd used to install with success Android on Ext2 partition (NOT IN NAND!) ???
I tried with:
- 2 Gb Trascend (No class... i think class 1)
- 2 Gb Kingstone (No class... i think class 1)
and i got always mmcblk0 errors!!!
Thanks in Advance.
Regards.
Success with:
4Gb Transcend class 6 (TS4GUSDHC6) (3Gb FAT + 2x512Mb Ext2)
Failed with:
4Gb Kingston (have no serial #)
Change in Default.txt for SD card Polaris 100
Try this
you can try change Default.txt - max frequency ..... I have try msmsdcc_4bit (1 or 4) and diffrent values of msmsdcc_fmax=10000000 and now it works.
My default.txt
#alloctest 0x2000
set RAMSIZE 0x08000000
set MTYPE 1723
set KERNEL zImage
set initrd initrd.gz
#
# The following kernel parameters are useful
# ppp.nostart - Set ppp.nostart=1 to disable starting the ppp connection on boot
# msm_sdcc.msmsdcc_fmax - The maximum frequency (in Hz) used by the SD controller
# pm.sleep_mode - The mode used when the phone is off
# 0=Power Collapse Suspend, 1=Power Collapse, 2=AppsSleep,
# 3=Slow Clock and Wait for Interrupt 4=Wait for Interrupt
# Default is 1, use 1 for best power savings
# board-htcpolaris.panel_type - Panel type used to power the panel off and on
# 0=Don't power off the panel (Default)
# 1=Sony 2=Topoly 3=Topoly (probably just the same as 2)
# lcd.density - Defaults to 160, 128 shows more on screen
#
set cmdline "ppp.nostart=0 board-htcpolaris.panel_type=1 pm.sleep_mode=1 mddi.width=240 mddi.height=320 no_console_suspend clock-7x00.mddi=0xa51 msmsdcc_4bit msmsdcc_fmax=10000000 msmsdcc_nopwrsave"
boot
2GB Sandisk (Class 1?) (only one 2GB FAT32 partition) works!
8GB Sandisk (Class 2) (only one 2GB FAT32 partition) somtime with boot problem. I must shortly remove the battery. Than it works. But only with kernel 23-06-2010!
I bought a 2 GB Panasonic CLASS 4 ... and no more problems!!! It works perfectly!
kingston sd-c02g (2GB)
kingston sd-c02g (2GB) works with :
NAND
polaimg-panel1-320-25-06-10.nbh (modified the polaimg-panel3-320-25-06-10.nbh with NBH editor)
VaniljEclair RLS6
Related
The purpose of this script to allow user to define their own set of configuration in a easier way. You can play with the parameters (user.conf)
to find out what suits you best.
Please check the third post for change log and rom compatibility list
Code:
echo "Usage:"
echo "/system/sd/userinit.sh [-s|-c config.file|-i]"
echo
echo "Default:"
echo "Sets system configuration based on the paratermers"
echo "that listed in /system/sd/user.conf"
echo
echo " -s: check configuration status and cross"
echo " verifiction with user configurations "
echo " -c config.file: use user parameters that defined"
echo " in config.file "
echo " -i: Current system settings and info "
Install using ADB:
Code:
adb push userinit.sh /system/sd
adb shell chmod 755 /system/sd/userinit.sh
adb push user.conf /system/sd
adb shell chmod 755 /system/sd/user.conf
adb shell reboot
Install using terminal emulator
download the file and unzip it to your sdcard
Code:
su
mount -o remount,rw /dev/block/mtdblock3 /system
cp /sdcard/userinit.sh /system/sd
cp /sdcard/user.conf /system/sd
chmod 755 /system/sd/user.conf
chmod 755 /system/sd/userinit.sh
reboot
testing via ADB
Code:
adb shell sh /system/sd/userinit.sh -s
testing via terminal emulator
Code:
su
sh /system/sd/userinit.sh -s
Expected output for compcache 0.5
Code:
=== CompCache status ===
CompCache version 0.5
Compcache enabled
CompCache: DiskSize 32768(system) 32768(user)
CompCache: cc_swappiness - 30(system) 30(user)
=== CompCache status output ===
DiskSize: 32768 kB
NumReads: 1
NumWrites: 11
FailedReads: 0
FailedWrites: 0
InvalidIO: 0
PagesDiscard: 0
ZeroPages: 1
GoodCompress: 70 %
NoCompress: 0 %
PagesStored: 10
PagesUsed: 4
OrigDataSize: 40 kB
ComprDataSize: 10 kB
MemUsedTotal: 16 kB
the (system) beside the number means the value is gather from system and user means from user.conf
example out for compcache 0.6+
Code:
=== CompCache status ===
CompCache version 0.6+
Compcache enabled
CompCache: DiskSize 32768(system) 32768(user)
CompCache: cc_swappiness - 30(system) 30(user)
=== CompCache status output ===
DiskSize: 32768 kB
NumReads: 1
NumWrites: 3
FailedReads: 0
FailedWrites: 0
InvalidIO: 0
PagesDiscard: 0
ZeroPages: 0
GoodCompress: 100 %
NoCompress: 0 %
PagesStored: 3
PagesUsed: 1
OrigDataSize: 12 kB
ComprDataSize: 0 kB
MemUsedTotal: 4 kB
This is the default user.conf. By default, the 32MB of compcache is enabled.
Code:
# General parameters
general{
apps2sd=0 # this is useless here, require a modified a2sd script
CONF_FILE="/system/sd/user.conf" #location of user.conf
media2sd=1 # moves the medias to sd if /system/sd/media exists
permission_fix=0 # perform permission fix at start up (this parameter sets to 0 after script is executed)
odex_auto=0 # perform auto create or del odex for applications installed or removed within 3 days
odex_apk=0 # creates odex for apk that does not have odex yet (this parameter sets to 0 after script is executed)
odex_all=0 # creates odexes for all apks (this parameter sets to 0 after script is executed)
}
#compcache related parameters
compcache{
compcache_en=1 # enable(1) or disable(0) compcache
cc_disksize=32 # Ram swap disksize - any number between 1 to 95 should work; default is 1/4 of the RAM (24)
cc_memlimit=16 # Limit the memory usage for backing swap (cc .5x known issue-defaults to 15% of total RAM)
cc_backingswap_en=0 # enable(1) or disable(0) backing swap
cc_backingswap=/dev/block/mmcblk0p3 # pointing to the backingswap partition device, swap
cc_swappiness= # default 60
}
#create swap file for compcache or linux swap
swap_file{
swap_file_en=0 # set to 1 to create swap file
# set to 0 to del the swap file
linux_swap_file_size=32 # swap file size in MB
linux_swap_file=/system/sd/swap.file # pointing to the swap file location ( must be /system/sd/)
}
#Linux swap parameters
#
# linux swap can only be enabled if cc_backingswap_en is set to "0"
#
linux_swap{
linux_swap_en=0 # enable(1) or disable(0) linux swap
linux_swap_partition=/dev/block/mmcblk0p3 # swap partition device
swappiness=30 # default 60
}
#virtual memory
sys_vm{
sys_vm_en=0 # enable(1) or disable(0) virtual memory configurations
page_cluster=0 # default 3, (0 since CM3.9.6+)
laptop_mode=0 # default 0
dirty_expire_centisecs=3000 # default 3000
dirty_writeback_centisecs=500 # default 500
dirty_background_ratio=5 # default 5
dirty_ratio=10 # default 10
}
#cpu clock
proc_cpu{
proc_cpu_en=0 # enable(1) or disable(0) user cpu configurations
# freqency options
# 19200
# 122880
# 128000
# 245760
# 384000
# 528000
scaling_min_freq=245760 # default 245760
scaling_max_freq=528000 # default 528000
sampling_rate=2000000 # default 2000000 depending on kernel version
powersave_bias=200 # default 0, (200 since CM3.9.6+ )
up_threshold=40 # default 40, percent cpu usage before going up a speed step
}
# custom shell commands, these commands run last
custom_shells{
#echo "Hello!!!" # example
#echo "You can create your own cmmands here" # example
}
To enable linux swap
Code:
linux_swap_en=1
To enable virtual memory configurations
Code:
sys_vm_en=1
To enable CPU related configurations
Code:
proc_cpu_en=1
some sample configurations
To use only linux-swap
-set compcache=0
-set cc_backingswap_en=0
-set linux_swap_en=1
To use only compcache without backing_swap
-set compcache=1
-set cc_backingswap_en=0
-set linux_swap_en=0
-set cc_disksize=32 (32*1024 = 32768kb = 32MB)
-set cc_memlimit=0
To use compcache with backing_swap
-set compcache=1
-set cc_backingswap_en=1
-set linux_swap_en=0
-set cc_disksize=0
-set cc_memlimit=8
To use compcache with linux swap
-set compcache=1
-set cc_backingswap_en=0
-set cc_disksize=32
-set cc_memlimit=0
-set linux_swap_en=1
originally posted by uwonsum
To use compcache + backingswap with swap file
-set swap_file_en=1
-set linux_swap_file_size=32
-set linux_swap_file=/system/sd/swap.file
-set cc_memlimit=8
-set cc_backingswap=/system/sd/swap.file
To use compcache with linux swap file * Does not work
-set swap_file_en=1
-set linux_swap_file_size=32
-set linux_swap_file=/system/sd/swap.file
-set compcache=1
-set cc_backingswap_en=0
-set cc_disksize=32
-set linux_swap_en=1
-set linux_swap_partition=/system/sd/swap.file
Click to expand...
Click to collapse
Equivalent user.conf settings to CM 3.9.10+ compcache default settings
Code:
compcache_en=1
cc_disksize=24
cc_backingswap_en=0
Please do not use notepad to edit the user.conf or userinit.sh because you could end up some funny error due to format differences between unix and windows. A good example of unix format compatible editor for windows is notepad++
If you had any problem with the script please post the error log. This way its much easier to identify the problem
If there any other parameters/configurations that you wish to add, msg me! I will try to add them when i got time.
Which version of CM will this work for? The stable ones of the experimental also
If you upgrade from V0.1.1 to V0.1.3+ make sure you reboot your phone after install.
ROM compatibility list report by users
CM 3.6.8.1 tested by Me
CM 3.9.2 tested by MrBlueEyez
CM 3.9.3 tested by Me *requires couple lines of hacking to a2sd , Detailed instruction please see http://forum.xda-developers.com/showpost.php?p=4246619&postcount=36
CM 3.9.4 tested by sacredsoul, ShatBag1105
CM 3.9.5 tested by ShatBag1105, me
CM 3.9.6 tested by sacredsoul, uwonsum
CM 3.9.7 tested by uwonsum
Known issues
To work with CM3.9.3, couple lines of hacking to a2sd is required, Detailed instruction please see http://forum.xda-developers.com/showpost.php?p=4246619&postcount=36
~ CC backingswap with swapfile does not work
Application upgrade or reinstall may causing force close as the odex file is incompatible. Please rerun the script to create the new odex.
Change log
version 0.1.5.3
* fix missing cc_swappinessmissing in user.conf
version 0.1.5.2
* fix && error at line 649
version 0.1.5.1
* auto rebuilds the odex if the application is reinstalled or upgraded
* removes odexes if application is uninstalled
version 0.1.5
* fix permission for applications
* rebuild/create odexes
* custom user shell command support in user.conf
version 0.1.4.1
* Fix linux swappiness overwrites cc_swappiness value
* Fix duplication of mkswap for swap file
* Fix status output function turns off swap file/partition
version 0.1.4
* add userinit.sh symbolic link to system/bin/userinit
* support swap file for linux swap
version 0.1.3.7
* enables user configuration output with minor output tweaks
* fix typo in user.conf
version 0.1.3.6
* fix blank proc_cpu status output
* disable user configuration output
version 0.1.3.5
* disable sys_vm and proc_cpu by default
* some minor output tweaks
version 0.1.3.3
* Add up_threshold suggested by smeat @ #202
* Turn off Compcache/linux swap when compcache_en/linux_swap_en is set to 0
* Linux swap swappiness error message fix
Changes in v0.1.3.2
* auto detection for compcache version which means cc_version is no longer required. Detection method provided by uwonsum
Changes in v0.1.3.1
* Display cc_version for status check
Changes in v0.1.3
* support compcache version 0.6, make sure you set cc_version=0.6 in your user.conf file
* fix unable to remove kernel module errors
* fix compcache status check error
I haven't personally test the script with CM 3.9.6 yet.
Changes in v0.1.1
* fix file not found issue when the script is not executed from "/" directory
* -i only display the system information instead setting the parameters before display it
Changes in v0.1
* introduce cc_swappiness (replacement of compcache swappiness in user.conf) to fix swappiness overwrite issues.
* Fix backing swap issues
* Fix "cat /proc/ramzswap0" report not found issues
* Fix compcache detection error
thanks to uwonsum for pointing out these issues
I used the file from the thread for 3.6.7. whould u say urs is better. Even with my g1 overclocked and with compcache and it still lags little bit. Seedy for the find question u clearly state that its for 3.6.8.1. Was his wondering if it works with the experimental becuase not haveing compcache is a deal breaker.
Edit: are you sure about the experimental version because he said he is using a new kernal. S
Tried the script and my Android on CM 3.9.2 works smoothly. Checked with free on Terminal, seems to swap nicelly. What i don't get is the configuration... I downloaded the userinit.sh and user.conf, pushed to /system/sd and did the chmod stuff...
Do i have to change my user.conf to change the configuration? And what configuration works best for 3.9.2?
Nice work though! Finally after 5 months i had the guts to root and update SPL, recovery and mod my phone. Want to get the best out of it!
Ok, with the file in this post you have a compcache actived in swap partition without swap in CM ROM, thats correct?
And fixt the clock of CPU in MAX=528 and MIN=245, if i want to manage CPU status with set CPU what lines must to delete?
I only want to activate compcache in my 32mb swap partition, no swap, no CPU overcloack...
Thanks for your help and sorry for my english
For some reason this is the only one that word on the experimental builds...the others didn't work well even tho it said good compress 74 percent all the time..i would go to "tunewiki" cause that thing is the biggest memory hog, play some music see if it would load fast and then press back to go to the playlist...w/ compcache and swap off it would just go to a black screen and ask to wait or force close...but when the userinit stuff worked it would play stuff fast and go to the playlist without a hitch and no wait time...aka no killing the task in the background because of low memory....hurray..my compcache is working again..it might have had something to do w/ a .conf file...the others didn't have that file....hmmm, anyways thanks huanyu for this and whoever started playing w/ compcache in the first place!!! ha...
huanyu said:
The purpose of this script to allow user to define their own set of configuration in a easier way. You can play with the parameters (user.conf)
to find out what suits you best.
I have only test it with stable version of CM 3.6.8.1.
the by default, the 32MB of compcache is enabled. It should just work after you push the files to /system/sd
If there any other parameters that you wish to add, msg me! I will try to add them when i got time.
Click to expand...
Click to collapse
Very very nice, you basically re-wrote the whole thing from your original. Great work and thanks!
edit: The minimum usable cpu frequency is 128000, anything lower will cause the phone to freeze once power plug is removed.
here the available options:
19200
122880
128000
245760
384000
528000
I don't get it...what's the point of a config file for a config file?
jus to clairify to test it the command should be
adb shell /system/sd/userinit.sh -s
Click to expand...
Click to collapse
instead of
adb shell chmod 755 /system/sd/userinit.sh -s
Click to expand...
Click to collapse
ah wat the duece, double post
alapapa said:
I don't get it...what's the point of a config file for a config file?
Click to expand...
Click to collapse
There is a good reason to have a user config file for an init script.
One simple example; the previous less functional script had options to enable compcache and linux-swap. If you wanted just linux-swap, you would have to go into the init script and edit out the lines you don't want and then add lines you do want--this makes things a little confusing for some users. With user config file, you simply set one to 0 and the other to 1. You could call this encapsulation.
Soo what are the commands to do these while on the phone
i can get the files into the phone but im not at home so i cant use my ADB
Tested with CM 3.9.2 and this works wonderfully.
fallinprince said:
Soo what are the commands to do these while on the phone
i can get the files into the phone but im not at home so i cant use my ADB
Click to expand...
Click to collapse
Check this out. May be huanyu will consider adding these steps...
I had compcache working with 3.9 and upgraded to 3.9.1 then 3.9.2 and it stopped working somewhere in that time frame. I searched and tried two other userinit.sh files from other threads, including one that was supposed to work regardless of the kernel and couldn't get it to work again.
Threw these files on my sdcard, remounted system/sd, copied them over. Changed permissions, ran it manually and it worked fine. Rebooted to test and it worked perfect.
I spent about 2 hours yesterday searching through posts and trying to get this working again. Found this one today and not a single issue, thanks
fridlack said:
Ok, with the file in this post you have a compcache actived in swap partition without swap in CM ROM, thats correct?
And fixt the clock of CPU in MAX=528 and MIN=245, if i want to manage CPU status with set CPU what lines must to delete?
I only want to activate compcache in my 32mb swap partition, no swap, no CPU overcloack...
Thanks for your help and sorry for my english
Click to expand...
Click to collapse
if you don't wanna to enable CPU overclock or change the virtual memory configuration, you can basically set the follows
sys_vm_en=0
proc_cpu_en=0
Click to expand...
Click to collapse
Can I have your opinions on which is the best option in the performance point of view. I have a swap partition. Should I enable backing swap or the swap partition? Thanks!
If you could maintain a version numbered system for your compcache scripts that would rock, so every time you modify it and we try different setups we could know which "version" we like and use that one....I would love this...I never know what i'm getting w/ all these compcache/swap scripts..but this is the best working one by far..and which roms it works w/...like tested w/ 2.4.1 kinda stuff...IDK just some random thoughts....and would love to see a maintained compcache thread!!!
Ok I tried but hanged at the G1 screen for 3.9.3. Apparently, the exit command have to be removed from the userinit.sh. I removed the last "exit;" in the file but still got stuck. Any idea guys?
I looked online and couldn't find any instructions on migration of one SD card to another (for android devices). This can be a pain with the increase in SD-EXT partitions for apps\data. So here you go. This worked for me. I did it on a crapintosh, but should work the same on linux and there's versions of "dd" for windows.
________________________________________________________________
MAKE A DIRECTORY FOR THE DISK IMAGE
unknown0019e300f9bf:\Desktop admin$ mkdir SD_DD
CHANGE TO THE DISK IMAGE DIRECTORY
unknown0019e300f9bf:\Desktop admin$ cd SD_DD
LOOK AT MOUNTED DRIVES SO YOU MAKE SURE TO IMAGE THE CORRECT ONE, MINE IS DISK2, 16 GB WITH A 32 SWAP, AND 1024 EXT3
unknown0019e300f9bf:SD_DD admin$ diskutil list
/dev/disk0
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme *320.1 GB disk0
1: EFI 209.7 MB disk0s1
2: Apple_HFS MacHD 160.9 GB disk0s2
3: Microsoft Basic Data BOOTCAMP 158.8 GB disk0s3
/dev/disk1
#: TYPE NAME SIZE IDENTIFIER
0: Microsoft *10.7 GB disk1
/dev/disk2
#: TYPE NAME SIZE IDENTIFIER
0: FDisk_partition_scheme *15.8 GB disk2
1: Windows_FAT_32 NO NAME 13.7 GB disk2s1
2: Linux 2.0 GB disk2s2
3: Linux_Swap 32.0 MB disk2s3
THIS IS THE DD (DISK DUPLICATOR) COMMAND IF IS INPUT FILE, OF IS OUTPUT FILE
unknown0019e300f9bf:SD_DD admin$ dd if=/dev/disk2 of=sd.dd
30904320+0 records in
30904320+0 records out
15823011840 bytes transferred in 5967.374438 secs (2651587 bytes/sec)
RE-CHECKED MY DISKS WITH THE NEW SD MOUNTED, AGAIN DISK2 ALREADY PARTITION BY PUTTING IT THE PHONE AND PARTITIONING IT WITH RECOVERY
unknown0019e300f9bf:SD_DD admin$ diskutil list
/dev/disk0
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme *320.1 GB disk0
1: EFI 209.7 MB disk0s1
2: Apple_HFS MacHD 160.9 GB disk0s2
3: Microsoft Basic Data BOOTCAMP 158.8 GB disk0s3
/dev/disk1
#: TYPE NAME SIZE IDENTIFIER
0: Microsoft *10.7 GB disk1
/dev/disk2
#: TYPE NAME SIZE IDENTIFIER
0: FDisk_partition_scheme *32.0 GB disk2
1: Windows_FAT_32 NO NAME 31.0 GB disk2s1
2: Linux 1.0 GB disk2s2
3: Linux_Swap 32.3 MB disk2s3
UNMOUNTED THE DISK SO THAT IT CAN HAVE AN IMAGE LAYED DOWN ON IT
unknown0019e300f9bf:SD_DD admin$ diskutil unmountDisk /dev/disk2
Unmount of all volumes on disk2 was successful
DD COMMAND AGAIN SWITCHING THE IF TO THE IMAGE AND OF TO THE NEW SD
unknown0019e300f9bf:SD_DD admin$ dd if=sd.dd of=/dev/disk2
30904320+0 records in
30904320+0 records out
15823011840 bytes transferred in 10450.552689 secs (1514084 bytes/sec)
PUT IN INTO THE PHONE AND BOOT UP. TOOK A LITTLE WHILE TO SETTLE OUT, BUT SEEMED TO WORK LIKE A CHAMP.
_________________________________________________________________
So.. You've plugged your SD to your linux box and want to created aligned partitions with fdisk?
Follow exactly what I'm doing and your partitions will be MB aligned.
At the end you'll get a FAT32 partition for your data and an ext4 partition for data2xxxx scripts.
If you need more partitions, just adapt this tutorial to you needs.
I know some scripts or recoveries do this automatically so no need to remind me
I initially posted this in SuperNova ROM thread but it might worth a separate thread.
I've done this with an old 1GB usb key just to show you the commands, you'll have to adapt to your SD depending on it's size.
When I plugged the flash drive, it got recognized by my system as /dev/sde. It can be different on your system and once again you'll have to figure-out yourself the correct device.
Here as an example I'm splitting the flash drive in 2 partitions. 1st (512Mb) will be for the fat32 partition and will have to be formatted later. The rest is the future ext4 and is about 512MB too.
I'm gonna use 2 magic parameters with fdisk, in order to get 1024Kb clusters (2048x512 bytes) and align easily the partitions. 64 heads and 32 sectors should give 64x32=2048 so that is going to be my params here
Code:
fdisk -H64 -S32 /dev/sde
Command (m for help): p
Disk /dev/sde: 1054 MB, 1054605312 bytes
64 heads, 32 sectors/track, 1005 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes
Disk identifier: 0x00000000
Device Boot Start End Blocks Id System
/dev/sde1 * 1 1005 1028043+ 6 FAT16
Partition 1 has different physical/logical beginnings (non-Linux?):
phys=(0, 3, 45) logical=(0, 7, 10)
Partition 1 has different physical/logical endings:
phys=(509, 63, 63) logical=(1004, 3, 32)
Partition 1 does not end on cylinder boundary.
So here I have an old partition on my key (sde1). I delete it first and check that there is no more partition on the drive.
Repeat the process if you have more than 1 partition on your SD.
Make sure that it's clean before proceeding to the next step.
Code:
Command (m for help): d
Selected partition 1
Command (m for help): p
Disk /dev/sde: 1054 MB, 1054605312 bytes
64 heads, 32 sectors/track, 1005 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes
Disk identifier: 0x00000000
Device Boot Start End Blocks Id System
Empty! Great! The key is clean. Let's partition it now
Code:
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 1
First cylinder (1-1005, default 1): 2
Last cylinder or +size or +sizeM or +sizeK (2-1005, default 1005): 512
Command (m for help): p
Disk /dev/sde: 1054 MB, 1054605312 bytes
64 heads, 32 sectors/track, 1005 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes
Disk identifier: 0x00000000
Device Boot Start End Blocks Id System
/dev/sde1 2 512 523264 83 Linux
Ok now I have a partition starting on cylinder 2 and 512Mb in size. If your SD is 16GB, you can use for instance a size of 15GB to leave 1GB for the ext4 partition.
That would give approximately 15x1024=15360 instead of 512. Got it?
Pay attention to the value below "End". Here it is 512 so I will use the next cylinder (513) for the 2nd partition:
Code:
Command (m for help): n
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 2
First cylinder (1-1005, default 1): 513
Last cylinder or +size or +sizeM or +sizeK (513-1005, default 1005):
Using default value 1005
Command (m for help): p
Disk /dev/sde: 1054 MB, 1054605312 bytes
64 heads, 32 sectors/track, 1005 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes
Disk identifier: 0x00000000
Device Boot Start End Blocks Id System
/dev/sde1 2 512 523264 83 Linux
/dev/sde2 513 1005 504832 83 Linux
Now I have 2 partitions aligned to 1MB but declared as "linux". Let's change that to FAT32 for partition 1.
Code:
Command (m for help): t
Partition number (1-4): 1
Hex code (type L to list codes): c
Changed system type of partition 1 to c (W95 FAT32 (LBA))
Command (m for help): p
Disk /dev/sde: 1054 MB, 1054605312 bytes
64 heads, 32 sectors/track, 1005 cylinders
Units = cylinders of 2048 * 512 = 1048576 bytes
Disk identifier: 0x00000000
Device Boot Start End Blocks Id System
/dev/sde1 2 512 523264 c W95 FAT32 (LBA)
/dev/sde2 513 1005 504832 83 Linux
Command (m for help): w
The partition table has been altered!
Calling ioctl() to re-read partition table.
WARNING: If you have created or modified any DOS 6.x
partitions, please see the fdisk manual page for additional
information.
Syncing disks
That's all.
Now format 1st partition to FAT32 with this guide:
credits to kd8cgo
Code:
Making an aligned FAT32 format
Anyone can figure out alignment of the partition from many sources already posted on the web.
One thing I could not find was a guide on how to align that pesky FAT32 format so that each
cluster (allocation unit) is aligned inside the boundaries of erase blocks. Well, the Linux mkfs.vfat
utility has all the options we need to make this aligned format possible!
Please view this primer to FAT32 to get an idea of how the system is laid out on your disk.
You normally have the first sector in the partition which is your Volume ID, which sits in the
reserved space which is normally the first 32 sectors in the partition. This is followed
by (2) copies of the File Allocation Tables, which vary in length when created depending on
a variety of factors, including the chosen allocation unit size. The FAT size remains constant
after creation. Please keep in mind for this discussion the physical size of a sector, which is 512 bytes.
The Golden Nugget
We will be changing the reserved sectors from the default value of 32, to a number that
we will calculate from the reported size of the FAT tables after formatting. The goal will be to
make the FAT tables end right at a 128K boundary, so each cluster of the file system will fall
neatly within erase blocks on our disk!
First we will format our disk using FAT32 paying no mind to reserved sectors. This will
report to us our FAT size as so:
[email protected]:~$ sudo mkfs.vfat -F 32 -n UserData -s 32 -v /dev/sde1
mkfs.vfat 3.0.7 (24 Dec 2009)
/dev/sdd1 has 224 heads and 56 sectors per track,
logical sector size is 512,
using 0xf8 media descriptor, with 31309312 sectors;
file system has 2 32-bit FATs and 32 sectors per cluster.
FAT size is 7641 sectors, and provides 977937 clusters.
Volume ID is 40c250bd, volume label UserData .
The juicy bits are that 2nd to last line, it tells you the size on disk of 1 FAT table.
7641 sector FAT x 2 FATs x 512 bytes/sector = 7,824,384 bytes
The above formula shows you the exact amount of space the FAT tables are using at
the beginning of your disk. This number is not usually going to be evenly divisible by
128K (131,072 bytes) as you can see 7,824,384 / 131072 = 59.695 erase block sized
chunks. What we need to do is force the end of those FAT tables to end right at
60 blocks to do so we:
131,072 x 60 = 7,864,320 bytes in 60 erase blocks
7,864,320 - 7,824,384 = 39,936 bytes remainder
39,936 / 512 = 78 sectors remain
New reserved sector count for alignment = 78
Those are all the fundamentals required to align a FAT32 partition, so that
clusters on the disk fall in line with the erase blocks of the physical cell medium.
An example of the format command required:
sudo mkfs.vfat -F 32 -R 78 -n UserData -s 32 -v /dev/sde1
Breakdown:
sudo - super user privledges
mkfs.vfat - create a FAT file system
-F 32 - 32 bit FAT (FAT32)
-R 78 - Use 78 Reserved Sectors (instead of 32)
-n UserData - drive label, up to 11 characters
-s 32 - 32 sectors per cluster 32 x 512 - 16K allocation unit size
-v /dev/sdex - Device to format
Note: If you're getting a R=0, use 256 (256x512bytes=128Kb) as the minimum R value for FAT32 is 2.
Format 2nd partition with the following command, replacing xxx with your device
Code:
mke2fs -T ext4 -b 4096 -E stride=64,stripe-width=64,hash_alg=tea -O extent,^huge_file -m 0 -L userdata /dev/xxx2
You should be good to go now!
Reserved for later
thanks for this you absolute babe <3
Did you read post #7 by CitizenJohn a few posts below the original HOWTO: Increase write speed by 'aligning' FAT32
Tends to contradict the method posted by kd8cgo for Fat32
Presumably both methods can't be correct!
Of course I did. I read many posts about SSDs to come to this tutorial.
First of all I don't use the same geometry for creating partitions.
And so far this way of formatting has always been able to give me the best of all my flash memory based devices, SD and USB keys.
Have you tried both methods? Which of the two gave you the best results?
I'm gonna try it again, maybe I missed something the first time.
Of course if there is a proven better way to get even more from our flash drives and SDs, I'll gladly learn it and change the tutorial accordingly.
EDIT:
Posted atto results for both methods on a pretty old flash drive. Left is formatted with the post you mentioned and right is with the "standard" method.
Don't see much of a difference.
I have but quite a while apart, i didn't use any software to measure transfer speed but using a sd-card adapter according to Linux i get ~10Mbs sd-card to PC and ~8Mbs PC to sd-card with the method i mentioned can't imagine a class2 sd-card could get much faster
Damn just realized to PC was Fat partition to PC : To sd-card was to btrfs linux partition
The problem is that we don't know the actual erase block size of each flash drive.
And on top of that, fat32 has block sizes of 64K max. Max erase block size for SD is 256K but is usually less.
I also just tried both methods on a faster usb key (with write speeds up to 15Mb/s) and results are the same.
But each his own and if anybody can get a better data transfer rate with the 2nd method, please report all the details here.
No worries mate thanks for the TUT, the question came out of ignorance rather than any understanding of the methodology
ziggy1001 said:
No worries mate thanks for the TUT, the question came out of ignorance rather than any understanding of the methodology
Click to expand...
Click to collapse
Actually it was an interesting question.
We assume that for any device the erase block size is 128K
But the guy in your post is formatting also a usb flash thumb drive or an SD card.
If the erase block size of his flash drive is 16k, then his file was aligned
details:
8011776 / 131072 = 61.125 File "not aligned" according to him.
8011776 / 16384 = 489. Round number, file aligned.
To get even more speed, one has to use bigger fat32 blocks (up to 64k). But then each file will use blocks of 64Ko on the drive, even if it's real size is 1Ko !
Good compromises are 16 and 32Ko blocs.
... Or you can use GParted.
problem solved.
Terepin said:
... Or you can use GParted.
problem solved.
Click to expand...
Click to collapse
Could be a good idea but:
1/ Some people have reported issues with Gparted when aligning their partitions and even some 16GB SDs were not detected by the Desire after using Gparted. On the opposites, the phone could detect them by doing it manually.
2/ Unless I'm mistaken, Gparted is NOT optimizing the FAT32 formatting process nor the EXT4 one.
is there really a difference between Gparted live and your method ?
when you wipe your SDext with your recovery, does sdext returns to default value ?
t-minik said:
is there really a difference between Gparted live and your method ?
when you wipe your SDext with your recovery, sdext returns to default value ?
Click to expand...
Click to collapse
Yes there is: I don't think that Gparted is using 1024Ko cylinders.
But most of the time, choosing MB alignment is working to align partitions. However, it is not aligning the filesystem. And like I already said, some people reported issues, that's why I published this tutorial.
If Gparted is working for you, keep using it
yep, GP works ..... but I'm really curious
and what happens when wiping SDEXT ?
If you change -s to 128 does that give 64k block size?
sudo mkfs.vfat -F 32 -R 78 -n UserData-s 32 -v /dev/sde1
Well whatever it was transfer Fat32 to PC went from ~10Mbs to ~16Mbs
If you change -s to 128 does that give 64k block size?
sudo mkfs.vfat -F 32 -R 78 -n UserData-s 32 -v /dev/sde1
Well whatever it was transfer Fat32 to PC went from ~10Mbs to ~16Mbs
Click to expand...
Click to collapse
yep, s128 gives 64k blocks.
Did you calculate R78 with the given method?
Happy that you're getting higher speed, but usually this method goal is to increase write speed to the SD
Sent from my A70S using the XDA mobile application powered by Tapatalk
Does 4ext recovery does this aligned partitioning/formatting?
Great thread, Sibere.. Will modify my installation steps to point to this TUT than Sd formatter
Does 4ext recovery does this aligned partitioning/formatting?
Click to expand...
Click to collapse
According to the dev, it should. Didn't try myself though. but like Gparted, it won't optimze the FAT32 formatting part.
Sent from my A70S using the XDA mobile application powered by Tapatalk
LiooO said:
Does 4ext recovery does this aligned partitioning/formatting?
Click to expand...
Click to collapse
sibere said:
According to the dev, it should. Didn't try myself though. but like Gparted, it won't optimze the FAT32 formatting part.
Sent from my A70S using the XDA mobile application powered by Tapatalk
Click to expand...
Click to collapse
So according to your answer i can partiton SD card in 4Ext recovery or GParted and then just do Fat32 formatting according to your guide? Can someone confirm this pls?
Hello,
i just released SD-Booster 2.0 on Google Play Store.
Well, i noticed some Devs and ROM authors include my older versions with their Rom's.
SD-Booster works with a database and it was a little bit difficult to setup my app for a
special phone or rom.
Well, i have little gift for you:
SD-Booster 2.0 supports now properties. So you can put a propertie file in the app directory
and with the first start of SD-Booster the file will be readed and the database gets filled with
your settings. After that the file will be deleted.
Take a look to your logcat during first boot
SD-Booster supports each SD-Memory separately and has a monitor feature (this can't be done with a boot script).
Features:
-MMC detection framework to support any SD-Card and SD-Memory
-Speedup every external and internal SD-Memory
-Configure each SD-Memory separately (New!)
-Set on system start (boot) feature
-Device monitoring (New!)
-Notification system (New!)
-Color based suggestion terms of current cache size
-Multi-Language support (New!)
Click to expand...
Click to collapse
Example:
#
# SD-Booster version 2.x propertie file
# Copyright Daniel Mehrmann
#
# Supported by Goggle Play Store version
#
# EXAMPLE file
#
# This file is for Devs/Rom experts only
# This file will be deleted on first run
# Database get filled with these values
#
# Put this file into <app directory>/files
# Standard: /data/data/de.mehrmann.sd-booster/files/sd-booster.prop
#
# Filename must be: sd-booster.prop
#
# You can use global settings and/or card settings
#
# If you have no glue about device names just use global settings
# or create an empty file. Devices will be auto detected
#
#
# Global properties for all cards
# Global setting override card setting!
#
# 0 = Feature is disabled
# 1 = Feature is enabled
setAllonCache=1
setAllonBoot=1
setAllonMonitor=1
# Global cache size for all cards (KB)
# min = 128
# max = 8192
setAllCacheSize=1536
# Device based properties
# For each device separately
# Number of devices
number=2
# Syntax: device_NUMBER_OPTION=value
# 0 = Feature is disabled
# 1 = Feature is enabled
# size = cache size (KB)
# First device
device_0_name=mmcblk0
device_0_boot=1
device_0_monitor=0
device_0_size=768
# second device
device_1_name=179:0
device_1_boot=1
device_1_monitor=1
device_1_size=2048
Click to expand...
Click to collapse
XDA-Release-Link: http://forum.xda-developers.com/showthread.php?t=2260038
If you have a question, suggestion, something is bad or just sucks please let me know.
If i can help you with your ROM please drop me a message.
Regards,
Akusari
I just bought a new Quality micro SD from Samsung, 32GB EVO. I was using a brandless 32GB.
I used Win32DiskImager program (windows) to create images for both SD cards. One has everything installed what I want.
The newer Samsung has only the basic apps like link2SD, rootinternal2external.
The strange part is that there is an difference in the amount of free storage, both are parttioned with the same program.
The only difference is that the amount of partitions:
Black brandless: 3 partitions: Data,App,swap
Samsung: Data , App
But the image file that I pulled from the SD cards is as follows:
Black: 31.691.112.448 MB
Samsung: 31.440.502.784 MB
How come there is an difference?
I want to burn the old image on my new card. I guess I can make a partition of the black SD card about 260MB smaller, then create
a new image again, then burn it. I hope that works.
But is it normal that the amount of storage differs between brands???
I think that yes, regards
[How to] Copy image between different size micro SD
I found a way to copy my larger SD image, made with Win32diskimager, into my smaller Samsung 32GB micro SD:
http://softwarebakery.com/shrinking-images-on-linux
Basicly you have to do:
- Use a tool to access the micro SD and make the last partition XXX MB smaller. This creates unpartitioned space.
- Create a image file from that micro SD: xxxx.img
- Boot into a Linux Operating system, Like Ubuntu 14.04LTS, by installing it on your HD or boot directly from a live CD
- Open a terminal screen. With CTRL+ALT+T, or use the graphical UI to open one terminal.
- in that terminal, execute the command: fdisk -l xxxx.img
- The output of the command looks like the following:
Disk myimage.img: 6144 MB, 6144000000 bytes, 12000000 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000ea37d
Device Boot Start End Blocks Id System
myimage.img1 2048 9181183 4589568 b W95 FAT32
Now we have to calculate where we want to cut the xxxx.img file. We want to cut away the last part that is not allocated to any partition.
Above you see the line "myimage.img1 2048 9181183 4589568 b W95 FAT32".
The last partition ends at 9181183, in your example it will be different ofcourse, just take the end of the last partition.
If you have 2 partitions, then you have 2 lines under:
"Device Boot Start End Blocks Id System"
in this example we have to cut from 9181183+1. Identify also what the block size is. In our example it's 512.
512 is the block size. In your example it might be different. If it's different, execute below command with a different value.
Now we cut away the empty space that is not used in our xxx.img.
Execute in the terminal screen: truncate --size=$[(9181183+1)*512] xxxx.img
The xxxx.img file is now smaller and can be burned into the smaller device.