[Q] Is fragmentation ever an issue? - Android Software Development

I know the core of the Android system is based on Linux. I've been learning Linux a little before I got my Droid. I started to notice that disk/file fragmentation is hardly ever even mentioned in Linux (Ubuntu/Kubuntu). I'm not sure how Linux and Android handle file and disk I/O but it must be more efficient that Windows systems.
So I'm curious if fragmentation would ever cause an issue on the Android? And/or is there a script or program to run to analyse both internal and external storage? That being Ext3 and FAT32.
Thanks.
Jeremy

Related

What exactly is a kernel?

Hi everyone
I've been applying the SD fix with the V4 kernel, but now i'm wondering what exactly it is. In theory, could the SD fix be applied without it?
aciduzzo said:
Hi everyone
I've been applying the SD fix with the V4 kernel, but now i'm wondering what exactly it is. In theory, could the SD fix be applied without it?
Click to expand...
Click to collapse
Well the first question is a simple question without an easy answer.
The last question is easy, the answer is NO.
The Linux kernel is the software program which directly controls the hardware.
It contains low level software which drives the cellular radio receiver/transmitter, video and audio hardware, touchscreen, etc.
It also contains the software which implements the filesystem types, so that you can create/read/write files and directories on the storage chips, either SD-cards or built in the device.
The SD fix depends on writing the data in a different way than the old MSDOS FAT filesystem which is normally used on SD cards. It writes a Linux filesystem, either ext3 or ext4 (ext 2 would probably work too).
These ext3/4 drivers are not in the stock kernel program, so you need a different kernel.
I personally wouldn't use the fix, and wait one or two months for the official newer firmware of flash newer firmware. Newer versions of firmware have also almost no lag.
thanks very much for that tomtor!

Nand + SD = raid0?

Here's an idea.
We use additional EXT partition on our SD cards to extend memory of 512MB Leos.
Why not turning it into a RAID matrix?
I use software RAID on my desktop Linux, why not here?
I'm not sure if its even possible.
It also might actually slow down the devices because of the differences between both memories, but it's worth a try, isn't it?
Any one skilled and willed enough to do this?
tomus said:
Here's an idea.
We use additional EXT partition on our SD cards to extend memory of 512MB Leos.
Why not turning it into a RAID matrix?
I use software RAID on my desktop Linux, why not here?
I'm not sure if its even possible.
It also might actually slow down the devices because of the differences between both memories, but it's worth a try, isn't it?
Any one skilled and willed enough to do this?
Click to expand...
Click to collapse
Well, RAID0 would require both volumes to be the same size, or it will cap it to the size of the smallest one. So the best you could get would be 1024 for EU, 2048 for US.
So, how about you start begging Cotulla for the MAGLDR source (or find some way to implement it into Android) and dedicate the next two years to it Nothing is impossible, but it definitely isnt plausible.
I'm not sure what are the differences between the desktop Linux kernel and the Android one (I actually think they are the same with some addons, can anyone clarify on that?), but there is support for software RAID in the Linux kernel. We could create a system partition in NAND, another one of the same size on SD and "software-RAID them up" Whole matrix is being assembled during init, so no need for any low level code.
I guess we would need some initrd, or non-RAID boot partition with kernel...
It would also require to build matrix and filesystem on the device (instead of flashing already pre-created one) or flashing both NAND memory and RAID partition on the SD card...
Also software RAID impacts the CPU performance on IO. I'm very curious how it would run
Talking about desktop kernel... Maybe I should try in the Ubuntu section? ;P
tomus said:
I'm not sure what are the differences between the desktop Linux kernel and the Android one (I actually think they are the same with some addons, can anyone clarify on that?), but there is support for software RAID in the Linux kernel. We could create a system partition in NAND, another one of the same size on SD and "software-RAID them up" Whole matrix is being assembled during init, so no need for any low level code.
I guess we would need some initrd, or non-RAID boot partition with kernel...
It would also require to build matrix and filesystem on the device (instead of flashing already pre-created one) or flashing both NAND memory and RAID partition on the SD card...
Also software RAID impacts the CPU performance on IO. I'm very curious how it would run
Talking about desktop kernel... Maybe I should try in the Ubuntu section? ;P
Click to expand...
Click to collapse
A RAID Partitioning would be great if we would use it like WP7 (which i have tested for a week), its working great but if i remember what wp7 does, if you remember the sdcard (you MUST reflash Wp7 to get everything to work again) it would be less attractive than before.... :/
Sounds like you want JBOD (which isn't really raid, but related, and usually implemented in the raid tools), and it's not required to have same size disks. If it's possible to implement, you could then add on a 32g SD card onto the built-in NAND to create a 33g virtual NAND(TMOUS).
http://en.wikipedia.org/wiki/Non-RAID_drive_architectures

Lost 7Gb of music?

Yesterday I looked through my phone and all my music was gone. The space showed available too. . . . WTF?
I noticed a message about a hour before saying the SD card is unmounted. Which came on its own, I didn't do anything at all, I just exited the browser.
Now, I am just putting all the stuff back on after formatting my card.
What gives? I never seen this one yet.
i assume you are using android...?
probably "just" a FAT32 glitch that grew beyond its critical mass and caused the file system to crash.
i say "just a glitch" because all of us sd-card using folk should understand the lack of reliability and lack of fault tolerance inherent in the FAT32 file system...thus the need to backup important stuff periodically before one has to learn the value of a backup the "hard way".
now, regarding android...you know there are TWO styles of android with respect to how you "boot" them:
a. sd-card based ROM - usually booted by first letting WM6.5 load up and then running some CLRCAD+haret voodoo to get the android on your sd-card to boot
b. NAND based ROM - usually just boots with no user intervention (assisted behind the scenes by MAGLDR or clk)...this mechanism REPLACES the WM6.5 on the NAND
it is generally recommended for style (a) users to avoid removing the sd-card while android is running from it.
style (b) users can more freely remove the sd-card while android runs from NAND (i do this all the time because i use a NAND android ROM).
even then, several times a month, i have to perform a file system check on my sd-card. usually, my desktop windows just prompts me to run a check when it senses something wrong in the sd-card file system when i insert it into the desktop card reader. the message you saw in android (something like "sd card mounted read only" or some such) indicates that android also senses a problem with the file system.
now, both android as well as desktop windows are CAPABLE of finding and fixing FAT32 file system errors. my gut feeling is that the desktop windows disk checking and repairing is more reliable. bad disk checking and repairing routines CAN cause data loss, which might have occurred in your case because the file system errors were possibly detected and corrected by android. and thats the kicker...while desktop windows leaves the decision up to the user to grant a disk check and repair, android will just try to fix the errors as soon as you insert the sd-card back into the HD2 and this behavior can muck up your data.
still, i would also suggest reading the thread of the particular android build you are using to see if other users are facing (or have faced in the past) the same problem you are describing. just to clarify, the message about your sd-card:
1. just appeared all on its own in android? this might indicate a hardware problem or a problem in your particular android build's kernel and/or drivers or a close-to-death sd-card
2. or you had physically reinserted the card shortly before the error occurred? this might indicate a file system problem that android couldn't quite fix properly
It is running a NAND based Android ROM.
I guess it could be a glitch. We shall see.

[Q] External Storage Woes: exFAT vs FAT32 For My N900V

Hi all,
I'm starting this thread because I didn't see something quite like what I was looking for to answer some questions I had about exFAT vs FAT32. The question is, essentially, which file system is best to use with this high-cap SD card? If this thread is redundant, please let me know and/or direct me to the appropriate thread.
The reason I started looking for information is because of strange storage symptoms I was experiencing after introducing a SanDisk 64GB Class 10 SD card to my Verizon Note3. I first noticed the symptoms after taking the NC4 OTA (first mistake, I know). Nonetheless, the symptoms were there. I eventually followed some instructions to install BajaROM (thanks @az_biker and @barrackOBAMA) since the issue of r/w to SD card was addressed in that ROM, and since I could use that ROM on the NC4 OTA base. However, the symtpoms persisted. One thing I noticed happened when I was re-installing apps on the new ROM. One, in particular, was MinecraftPE, purchased legit through the Play Store. I would install the app, and it would open and function correctly. Then, when I rebooted the device, the app would not run from the app drawer. The app would still be listed in Settings > Applications > Downloaded, but it was listed as 0.00MB installed. If I executed the app from the lingering icon, I got the message "App not installed on this device," which would open the Play Store to re-install the app. But the app wouldn't install at that point, since it was still registered as installed, per Settings > Applications. I had to uninstall from Settings, then reboot, then open Play Store to re-install. Ugh! I was able to get the app to install "correctly," though not as preferred (App2SD), by un-mounting the SD card prior to executing the install from Play Store.
One other major issue involved using the stock camera app and saving to SD. When the pic was snapped, and saved to SD, I could open the pic from the gallery link in the camera right then, and even share it. However, if I exited the camera app and opened the stock gallery app separately, the pic was listed as a broken link (or unreadable file?) and I could neither open it or share it or anything. The file was also defunct if I tried to access it from any file manager utility, stock or otherwise. The only "fix" I found for that was simply to save pics to internal storage. Again, ugh, that takes up space quickly.
I've read a lot of information about exFAT vs FAT32 and I've wondered whether the issue is that exFAT isn't a good functional match with Android in general or, in this case, even with custom ROMs. I do not, by any means, assert that I truly understand Android OS, file system/structure protocols, or anything of the sort. I read when I don't understand. I've read varying opinions about which SD card file structure is best overall to use with Android, and about which to use with high-cap SD cards. I see that ext3 is reliable and scalable, but that I'd need to use Linux to access it from off-device. That is a bit more awkward for me. I see that, overall, FAT32 is more reliable for use, and that there's no incompatibility with Windows. I don't really mind that file size is limited to 4GB, so I'm leaning that way.
Also, I found this on TeamWin website, which I found helpful (quoted & referenced). It explained what's what with exFAT (for me, anyway).:
​"exFAT is an update to FAT32 file system and is commonly found on 64GB or larger sdcards. exFAT has a different and much more restrictive license compared to FAT32. Due to this restrictive license, we'll probably never see exFAT support in the Linux kernel. Many Android manufacturers (e.g. Samsung, HTC) have cross-licensing agreements with Microsoft that allow them to add exFAT support in Android, but that agreement doesn't mean that we're able to add exFAT support for your device in TWRP.
​You can reformat your 64GB card to FAT32. You may need to remove the card from your device and use a computer to accomplish the reformat. You also may have to find and download a third party utility to format to FAT32 if you're using a Windows PC. The biggest downside to using FAT32 is that FAT32 doesn't support files larger than 4GB.
​If you need a file system that can support files larger than 4GB and works in recovery, you pretty much have one choice: ext4. Unfortunately Android often doesn't handle ext4 formatted sdcards automatically. You'll probably have to mount the sdcard manually using a shell script, GScript (free app in the market), or an init.d type of script. You also won't be able to pop your sdcard into a Windows computer because Windows doesn't recognize the ext4 file system.
​You're also welcome to try NTFS, but the majority of the time, NTFS will only mount as read-only in recovery. The Linux kernel doesn't have very good NTFS support either."
So that's a lot for a post. If you're still reading, thanks. I welcome any and all feedback or insight regarding my SD card "woes," or the issue(s) I presented. I'm definitely ok with learning and appreciate your time and help. Have a great rest of your day.
SscoootzZ :fingers-crossed:
I have my sandisk ultra 64gb formatted fat32. I do not need it to handle files larger then 4gb so no issues for me.
---------- Post added at 11:59 AM ---------- Previous post was at 11:57 AM ----------
this is the program I used to format mine...
http://www.ridgecrop.demon.co.uk/index.htm?guiformat.htm

Can anyone give me a complete list of supported memory card filesystems for stock?

I'm having to prepare a memory card for my nieces phone and I will not have a lot of time to trouble shoot it (she lives across state) when I go to install it.
It would be better if it was fully prepared and ready to go when it is opened at Christmas and ready for gaming.
Her phone is a unmodded Samsung Galaxy J3.
I know that Samsung Note 3's will take Exfat and a lot of phones won't, but I don't want to plug
and pray and lose and have to trouble shoot during a very limited amount of time.
Anyone have a complete list of filesystems the stock rom J3 can read on a memory card?
Or atleast can attest that it supports a certain other filesystem with no filename limits?
Samsung made F2FS do most of their phones support it innately?
I expect that all files put on it will be over 255 characters of length for the filename (beyond Fat32's support).
Exfat, NTFS, Ext4, F2FS? Information that anything is supported instead Fat32 will help immensly.
I've searched all over the internet for this info, thank you for any replies. >.<
.
iBarf said:
I'm having to prepare a memory card for my nieces phone and I will not have a lot of time to trouble shoot it (she lives across state) when I go to install it.
It would be better if it was fully prepared and ready to go when it is opened at Christmas and ready for gaming.
Her phone is a unmodded Samsung Galaxy J3.
I know that Samsung Note 3's will take Exfat and a lot of phones won't, but I don't want to plug
and pray and lose and have to trouble shoot during a very limited amount of time.
Anyone have a complete list of filesystems the stock rom J3 can read on a memory card?
Or atleast can attest that it supports a certain other filesystem with no filename limits?
Samsung made F2FS do most of their phones support it innately?
I expect that all files put on it will be over 255 characters of length for the filename (beyond Fat32's support).
Exfat, NTFS, Ext4, F2FS? Information that anything is supported instead Fat32 will help immensly.
I've searched all over the internet for this info, thank you for any replies. >.<
.
Click to expand...
Click to collapse
ExFAT is recommended and probably the file system the sdcard will be shipped with.
ashyx said:
ExFAT is recommended and probably the file system the sdcard will be shipped with.
Click to expand...
Click to collapse
It worked out beautifully with exfat.
Yeah it had a Exfat filesystem on it at first.
Pretty sure my Honor 5x won't load it though.
Phone manufactures have to license exfat support right?
And Android memory cards are usually Fat32?
I skipped using unmodded phones completely so I'm not really sure
what most of the stock phone systems support (my memory cards are usually ext4 or f2fs formatted).

Categories

Resources