[DEV] data2"XYZ" general filesystem discussion (Updated Dec 20 - Benchmarking)

Search This thread

melethron

Senior Member
Sep 13, 2010
854
193
[DEV] data2"XYZ" general filesystem discussion (Updated Dec 20 - Benchmarking)

I will rewrite this posting soon. As for now please check the scheduler Benchmark:

http://xdaforums.com/showpost.php?p=9959265&postcount=257



================================================================
data2btrfs (this is DEV status so don't ask how to install - there is (little) linux expirience required)

Update about btrfs dec 15: Still testing btrfs and im REALLY amazed. Battery life has no difference to ext4 but performance is FAR better then ext4. I do still get lags in some cases (like fast! downloads) but this is simply a hardware issue which can not be addressed. Im using a class 2 sd only and i dont think that this can get ANY better. I think btrfs should run like HELL on a class 6+ card.

Update dec 14: Atm i'm using btrfs with "ssd_spread" (for ssd harddisk with older controllers. The controllers in SD should suck compared to some modern SSD so this will effect SD-Cards even more than "ssd" optimization (more info). And im amazed. It is even more smooth than nilfs (maybe less cpu) and so far the smoothest expirence i had with data2sd/data2ext. Even compared to EXT4 without journaling.

Why btrfs?

1. Btrfs is "copy-on-write" filesystem and i think that "copy-on-write" or logbased (like nilfs) will be the future.

2. Btrfs and nilfs are both better for "old" or "cheap" SSD-Drives because they are optimized for it. While this will decrease the performance of a modern SSD-Harddisk (since they are getting better and better in emulating a rotating device like a classic HD) it will INCREASE the general performance on ssd like an sd-card because their controllers is a lot worse than one of a state-of-the art SSD-Harddisk. So these optimization.

3. MeGoo (a linux made for smartphones) already has chosen it as default even though its still beta and i think they have some good reasons for this.

4. Btrfs has the same (and theoratically it should be even less - tiny) battery consumption. Other then nilfs wich had horrible battery (over 1%/h on its own even when phone was idle). Thats why i moved to btrfs from nilfs.

EDIT: Removed something really stupid xD



Safety concerns about data2btrfs


script: Considering the script i addressed ALL safety conserns that there are at present. This is based on the findings of the SGS devs and mounting directly on /data is even more save then cyanogen's app2sd+ (at least for the desire which unmounts /data - SGS doesn't). Only dalvik-cache is symlinked and a data corruption there is unimportant and can be helped by a simple wipe of the cache. So no concerns about this. (But note: the script is still "young" and there might be still errors - thats why i also don't provide a zip for ext4 yet)

btrfs is indeed still in an experimental state. But speaking FOR MYSELF ONLY (everyone should estimate this on its own) i don't have any concerns. The reasons are:
-experimental state is almost over and i doubt that there are any major bugs present.
-many Linux already use it and its default for MeGoo
-I have backups for all sensible data on my computer (like license keys - this can be lost if you backup already corrupted data with titanium/etc)


How to use it

(experienced linux users who know what they do ONLY)

- (recommended for ~ +20% speed) Delete your old ext partition create a new primary partition if it is not aligned yet. Gparted has a "align to mb" option wich makes alignement increadibly easy. Since 1024kb alignement is enough for sd there isn't anything else you need to care about.
- Make a btrfs partition with your favorite linux distribution (im still a ubuntu noob ;) ) with btrfs utils.
- Make sure you flash a Rom that doesn't need sd-ext for installation (check the META-INF/../update-script for "copy_package XYZ SD-EXT:XYZ" - delete or format sd-ext there isn't a problem you will get an error (like on leedroid) on install but this doesn't matter)
-make sure you have Kernel with btrfs support (see below for this)


Kernels with btrfs support (SENSE ONLY for now)


-NeoPhyTe.x360 's (ext2, ext3, ext4, reiserfs, xfs, jfs, btrfs, nilfs2)

-Coutts99 Kernels (chose the btrfs-test-kernel ofc ;-) )

Known Issues

no btrfs support in recovery this means:

-no backup of the sd-ext partition (it isn't ext anymore ;-) )
-wont work with ROMs that need sd-ext for installation (some HD roms)

Thanks

- cyanogen who made app2sd+ in the first place.
- sibere and ownhere who started all the data2sd.
- supercurio and Unhelpful of SGS' Voodoolagfix (#Project-Voodoo on freenode) for their helpfull script tipps.
- Coutts99 and Neophyte for their Kernels.
- woti23 for all those test's in this thread.
- All devs of XDA in generall for all this nice stuff that is done here

Further Plans for the script
- Changing scheduler settings depending on results in the btrfs thread to get the last out of your SD while assuring safety (thanks woti23 for all the testing).
- Trying to add support to delete the ext partition and create it new with an 1024k alignement (~ +20% more speed)
- Mounting /app-cache to /cache or internal data partition (8 MB more RAM since its mounted on RAM)
- Changes for the mount options of the internal YAFFS2 Partition to optimize the speed of the "dalvik-cache" (have to look into YAFFS2 what can be done)
- Adding some lines of code to clear up any present symlinks on first boot to make it ROM upgrade compatible
- Adding e2fsck with check on every boot (script is quick edit of my script for btrfs - no e2fsck yet)
- Other changes based on the results in this or other threads about data2ext/data2sd
- Remove the errors i made ^^
---------------------------------------------------------------------------------------
Remark: i moved the data2ext4 script to my other script and set the dev tag again. I also added UBIFS discussion to the title. I also removed the nilfs utils and the data2ext4. The data2ext script can be found here. If someone wants to test nilfs you can PM me (but battery SUCKS incredibly )
---------------------------------------------------------------------------------------


Changelog:
:
(dec 15): One minor change in assigning a variable. Doesn't change ANYTHING in actual behavior but code it's more "logical" (assigning the output of "busybox ls" to the variable instead of the command ^^ d'oh)
(dec 15) Fixed a stupid error that could lead to exit code (2) ....... and uploaded the proper file for btrfs (not the ext one). Sorry.... -.-
(dec 16) Fixed the fix ....
(dec 16) the scripts create now the folder it needs if it is not present yet (sorry i also forgot this in required ... was only there in the ext4 thread ^^)

=========================================================================
DISCLAIMER: BTRFS is still under development and thus an EXPERIMENTAL filesystem. Please refer to the btrfs wiki for more information.
 

Attachments

  • 40data2btrfs.txt
    1.8 KB · Views: 106
Last edited:

coutts99

Senior Member
Nov 1, 2010
1,406
261
Sunderland
Quick Info: NILFS2 - data2nilf2 will be much faster then data2ext and won't have Lags.


Long info:
After some thought's how to make things better for data2ext i started to think about how a flash based memory actually works.

Your Sd-card isn't a HDD (as you may have noticed ^^). It is actually a NAND based flash memory wich is divided into pages of 2-4kb and they are grouped to blocks of 128kb-512kb (!). But you will never see these. And you cant never change these (mkfs -b as much as you like ^^). This is done in hardware by a controller. All you will see is - you may call it an emulation - the LBA provided by the "flash translation Layer" (FTL). While the FTL can read/and write per page (2-4kb) it can't overwrite it. It needs to delete the data first AND THIS CAN ONLY BE DONE PER BLOCK !!! (Thats why read mb/s is higher then write mb/s).

What this means. Your filessystem should be aligned on the Blocks and should also avoid the need to erase blocks.

So forget every filesystem that my rock on your HDD (it may prefer e rewriteble sector if it's close f/e. If you "emulate" a filesystem through the controller it should respect the "true nature" of the hardware. A logbased filesystem would be far better since it will more likely take advantage of erased blocks. Also you may want that the blocks of the FS fit on the blocks of the NAND (alignement - but this mathes for every fs).

... Well long story short ... you need NILFS2

Links

http://www.usenix.org/event/lsf08/tech/shin_SSD.pdf

and this:
http://xdaforums.com/showpost.php?p=7647224&postcount=21

(For germans: http://www.hardwareluxx.de/community/f227/os-optimierungen-fuer-flash-ssds-543445.html#post10373042)

Btw: In the XDA thread linked use it for the internal sd in samsung galaxy S for a LAGFIX. Wasn't lag the reason data2ext sucks atm.


My 2nd partition would already use this by now but there are 2 things needed:
-Kernel Support
-mount binary

Im to noobish to provide both ... so .... help ... anyone .... pls ?!

Ill try and sort a kernel
 
  • Like
Reactions: latif and melethron

melethron

Senior Member
Sep 13, 2010
854
193

sibere

Retired Recognized Developer
May 14, 2006
2,055
375
Paris
I would just like to mention here that I made a special note about bloc alignment on sd card on my thread. I provided a link for that and FAT32 can be aligned to the actual bloc 128kb/512kb size of an sd/usb flash memory. This is the reason why I use 2 fat32 (aligned) partitons.

Sent from my HTC Desire using XDA App
 
Last edited:

woti23

Senior Member
May 27, 2010
920
173
Thanks x 3 times.

About binary

"Mount -t auto" didn't work with nilfs2 with ubuntu. "Mount -t nilfs2" calls mount.nilfs2 i think.


EDIT: Did you add nilfs or nilfs2?

ubuntu:

you maybe want to install nilfs2-tools first

then it mounts without -t option

am i the only one who is a little scared about this:

#> mount /dev/sdb1 /mnt/nilfs2

mount.nilfs2: WARNING! - The NILFS on-disk format may change at any time.
mount.nilfs2: WARNING! - Do not place critical data on a NILFS filesystem.
 

melethron

Senior Member
Sep 13, 2010
854
193
I would just like to mention here that I made a special note about bloc alignment on sd card on my thread. I provided a link for that and FAT32 can be aligned to the actual bloc 128kb/512kb size of an sd/usb flash memory. This is thefbreason why I use 2 fat32 (aligned) partitons.

Sent from my HTC Desire using XDA App

I still don't get the point using FAT for the 2nd partition. Also did you see what ownhere posted here:
Why create a small loopback device? the reason is item 3. But I found some bug with this case, any data write to loopback device need twice kernel IO command, one virtual one real, so the cpu usage will be high

About the 512kb. Are sure this is the max size "erase block" size for microsd?
 

sibere

Retired Recognized Developer
May 14, 2006
2,055
375
Paris
I still don't get the point using FAT for the 2nd partition. Also did you see what ownhere posted here:


About the 512kb. Are sure this is the max size "erase block" size for microsd?

I have used loop so far because I have run some I/O test on my phone (not quadrant) and I always had a better result with loop than with direct format.

ownhere post is great but he's not always 100% right. For instance, the fact that ext2 partition when mounted on /data is not unmounted properly by the system in wrong. You can read my post here http://xdaforums.com/showpost.php?p=9704670&postcount=9 to see the tests I did. I do confirm that the FS is unmounted by the system on shutdown.

About ext4 4K block size, you can do the same with EXT2 (my actual bloc size is 4096).

But I'm reading with great interest the thread about alternatives FS for NAND data storage. The erase block size is different for different devices and manufacturers. But at least if you align blocks to a multiple of 128kb, you will get a noticeable improvement in I/O than no alignment at all.
 
Last edited:

melethron

Senior Member
Sep 13, 2010
854
193
ubuntu:

you maybe want to install nilfs2-tools first

then it mounts without -t option

am i the only one who is a little scared about this:

#> mount /dev/sdb1 /mnt/nilfs2

mount.nilfs2: WARNING! - The NILFS on-disk format may change at any time.
mount.nilfs2: WARNING! - Do not place critical data on a NILFS filesystem.

y i have nilfs2-tools. I only meant that -t auto doesn't work. -t nilfs2 works fine.

I also got scared by the warning and googled the warning: http://www.spinics.net/lists/linux-nilfs/msg00595.html

Quoting a dev:
NILFS2 is almost stable. We have a record of nine months operation on in-house samba servers and a webDAV server.

> There is still still warning when mounting verbosely though:
> mount.nilfs2: WARNING! - The NILFS on-disk format may change at any time.
> mount.nilfs2: WARNING! - Do not place critical data on a NILFS filesystem.
>
> As per the first message, Is the on disk format expected to change any
> time soon?

Well, I don't want to change disk format in a way that breaks
compatibility. I'm considering to remove the above message at the
next utility release.


Reading this im willing to use it.
 

melethron

Senior Member
Sep 13, 2010
854
193
ownhere post is great but he's not always 100% right. For instance, the fact that ext2 partition when mounted on /data is not unmounted properly by the system in wrong. You can read my post here http://xdaforums.com/showpost.php?p=9704670&postcount=9 to see the tests I did. I do confirm that the FS is unmounted by the system on shutdown.

ownhere got this (wrong) information from me don't blame him... :eek: :eek: :eek:

You proofed me wrong on this and i admit that i was only guessing ....

After reading cyanogens post i thought that he tried to mount on /data before or tried to create an init.d/rc0.d to make a clean unmount. I didn't dare to think that any good dev would just say "... give a **** about a proper umount and use a journling fs". I mean wtf ....
 

sibere

Retired Recognized Developer
May 14, 2006
2,055
375
Paris
ownhere got this (wrong) information from me don't blame him... :eek: :eek: :eek:

You proofed me wrong on this and i admit that i was only guessing ....

After reading cyanogens post i thought that he tried to mount on /data before or tried to create an init.d/rc0.d to make a clean unmount. I didn't dare to think that any good dev would just say "... give a **** about a proper umount and use a journling fs". I mean wtf ....

Do you mean that you/he/they stated without trying ? ;)
I never take a guess for granted :)
 

Top Liked Posts

  • There are no posts matching your filters.
  • 17
    [DEV] data2"XYZ" general filesystem discussion (Updated Dec 20 - Benchmarking)

    I will rewrite this posting soon. As for now please check the scheduler Benchmark:

    http://xdaforums.com/showpost.php?p=9959265&postcount=257



    ================================================================
    data2btrfs (this is DEV status so don't ask how to install - there is (little) linux expirience required)

    Update about btrfs dec 15: Still testing btrfs and im REALLY amazed. Battery life has no difference to ext4 but performance is FAR better then ext4. I do still get lags in some cases (like fast! downloads) but this is simply a hardware issue which can not be addressed. Im using a class 2 sd only and i dont think that this can get ANY better. I think btrfs should run like HELL on a class 6+ card.

    Update dec 14: Atm i'm using btrfs with "ssd_spread" (for ssd harddisk with older controllers. The controllers in SD should suck compared to some modern SSD so this will effect SD-Cards even more than "ssd" optimization (more info). And im amazed. It is even more smooth than nilfs (maybe less cpu) and so far the smoothest expirence i had with data2sd/data2ext. Even compared to EXT4 without journaling.

    Why btrfs?

    1. Btrfs is "copy-on-write" filesystem and i think that "copy-on-write" or logbased (like nilfs) will be the future.

    2. Btrfs and nilfs are both better for "old" or "cheap" SSD-Drives because they are optimized for it. While this will decrease the performance of a modern SSD-Harddisk (since they are getting better and better in emulating a rotating device like a classic HD) it will INCREASE the general performance on ssd like an sd-card because their controllers is a lot worse than one of a state-of-the art SSD-Harddisk. So these optimization.

    3. MeGoo (a linux made for smartphones) already has chosen it as default even though its still beta and i think they have some good reasons for this.

    4. Btrfs has the same (and theoratically it should be even less - tiny) battery consumption. Other then nilfs wich had horrible battery (over 1%/h on its own even when phone was idle). Thats why i moved to btrfs from nilfs.

    EDIT: Removed something really stupid xD



    Safety concerns about data2btrfs


    script: Considering the script i addressed ALL safety conserns that there are at present. This is based on the findings of the SGS devs and mounting directly on /data is even more save then cyanogen's app2sd+ (at least for the desire which unmounts /data - SGS doesn't). Only dalvik-cache is symlinked and a data corruption there is unimportant and can be helped by a simple wipe of the cache. So no concerns about this. (But note: the script is still "young" and there might be still errors - thats why i also don't provide a zip for ext4 yet)

    btrfs is indeed still in an experimental state. But speaking FOR MYSELF ONLY (everyone should estimate this on its own) i don't have any concerns. The reasons are:
    -experimental state is almost over and i doubt that there are any major bugs present.
    -many Linux already use it and its default for MeGoo
    -I have backups for all sensible data on my computer (like license keys - this can be lost if you backup already corrupted data with titanium/etc)


    How to use it

    (experienced linux users who know what they do ONLY)

    - (recommended for ~ +20% speed) Delete your old ext partition create a new primary partition if it is not aligned yet. Gparted has a "align to mb" option wich makes alignement increadibly easy. Since 1024kb alignement is enough for sd there isn't anything else you need to care about.
    - Make a btrfs partition with your favorite linux distribution (im still a ubuntu noob ;) ) with btrfs utils.
    - Make sure you flash a Rom that doesn't need sd-ext for installation (check the META-INF/../update-script for "copy_package XYZ SD-EXT:XYZ" - delete or format sd-ext there isn't a problem you will get an error (like on leedroid) on install but this doesn't matter)
    -make sure you have Kernel with btrfs support (see below for this)


    Kernels with btrfs support (SENSE ONLY for now)


    -NeoPhyTe.x360 's (ext2, ext3, ext4, reiserfs, xfs, jfs, btrfs, nilfs2)

    -Coutts99 Kernels (chose the btrfs-test-kernel ofc ;-) )

    Known Issues

    no btrfs support in recovery this means:

    -no backup of the sd-ext partition (it isn't ext anymore ;-) )
    -wont work with ROMs that need sd-ext for installation (some HD roms)

    Thanks

    - cyanogen who made app2sd+ in the first place.
    - sibere and ownhere who started all the data2sd.
    - supercurio and Unhelpful of SGS' Voodoolagfix (#Project-Voodoo on freenode) for their helpfull script tipps.
    - Coutts99 and Neophyte for their Kernels.
    - woti23 for all those test's in this thread.
    - All devs of XDA in generall for all this nice stuff that is done here

    Further Plans for the script
    - Changing scheduler settings depending on results in the btrfs thread to get the last out of your SD while assuring safety (thanks woti23 for all the testing).
    - Trying to add support to delete the ext partition and create it new with an 1024k alignement (~ +20% more speed)
    - Mounting /app-cache to /cache or internal data partition (8 MB more RAM since its mounted on RAM)
    - Changes for the mount options of the internal YAFFS2 Partition to optimize the speed of the "dalvik-cache" (have to look into YAFFS2 what can be done)
    - Adding some lines of code to clear up any present symlinks on first boot to make it ROM upgrade compatible
    - Adding e2fsck with check on every boot (script is quick edit of my script for btrfs - no e2fsck yet)
    - Other changes based on the results in this or other threads about data2ext/data2sd
    - Remove the errors i made ^^
    ---------------------------------------------------------------------------------------
    Remark: i moved the data2ext4 script to my other script and set the dev tag again. I also added UBIFS discussion to the title. I also removed the nilfs utils and the data2ext4. The data2ext script can be found here. If someone wants to test nilfs you can PM me (but battery SUCKS incredibly )
    ---------------------------------------------------------------------------------------


    Changelog:
    :
    (dec 15): One minor change in assigning a variable. Doesn't change ANYTHING in actual behavior but code it's more "logical" (assigning the output of "busybox ls" to the variable instead of the command ^^ d'oh)
    (dec 15) Fixed a stupid error that could lead to exit code (2) ....... and uploaded the proper file for btrfs (not the ext one). Sorry.... -.-
    (dec 16) Fixed the fix ....
    (dec 16) the scripts create now the folder it needs if it is not present yet (sorry i also forgot this in required ... was only there in the ext4 thread ^^)

    =========================================================================
    DISCLAIMER: BTRFS is still under development and thus an EXPERIMENTAL filesystem. Please refer to the btrfs wiki for more information.
    7
    http://mirror.couttstech.com/android/bravo/kernel/nilfs_test_kernel.zip

    Usual HAVS@925 kernel with NILFS built-in

    As for mount binary. busybox mount might work. I've just been playing with aufs and normal mount worked for that.
    2
    Quick Info: NILFS2 - data2nilf2 will be much faster then data2ext and won't have Lags.


    Long info:
    After some thought's how to make things better for data2ext i started to think about how a flash based memory actually works.

    Your Sd-card isn't a HDD (as you may have noticed ^^). It is actually a NAND based flash memory wich is divided into pages of 2-4kb and they are grouped to blocks of 128kb-512kb (!). But you will never see these. And you cant never change these (mkfs -b as much as you like ^^). This is done in hardware by a controller. All you will see is - you may call it an emulation - the LBA provided by the "flash translation Layer" (FTL). While the FTL can read/and write per page (2-4kb) it can't overwrite it. It needs to delete the data first AND THIS CAN ONLY BE DONE PER BLOCK !!! (Thats why read mb/s is higher then write mb/s).

    What this means. Your filessystem should be aligned on the Blocks and should also avoid the need to erase blocks.

    So forget every filesystem that my rock on your HDD (it may prefer e rewriteble sector if it's close f/e. If you "emulate" a filesystem through the controller it should respect the "true nature" of the hardware. A logbased filesystem would be far better since it will more likely take advantage of erased blocks. Also you may want that the blocks of the FS fit on the blocks of the NAND (alignement - but this mathes for every fs).

    ... Well long story short ... you need NILFS2

    Links

    http://www.usenix.org/event/lsf08/tech/shin_SSD.pdf

    and this:
    http://xdaforums.com/showpost.php?p=7647224&postcount=21

    (For germans: http://www.hardwareluxx.de/community/f227/os-optimierungen-fuer-flash-ssds-543445.html#post10373042)

    Btw: In the XDA thread linked use it for the internal sd in samsung galaxy S for a LAGFIX. Wasn't lag the reason data2ext sucks atm.


    My 2nd partition would already use this by now but there are 2 things needed:
    -Kernel Support
    -mount binary

    Im to noobish to provide both ... so .... help ... anyone .... pls ?!

    Ill try and sort a kernel
    2
    Still trying to get cross-compile environment set-up :) Think I'm nearly there now though!