What are the *real* limitations of FATX

Discussion about Modding the XBOX, including hardware and software hacks.
bengalih
Posts: 57
Joined: Mon Dec 05, 2016 7:41 pm
Has thanked: 1 time

Re: What are the *real* limitations of FATX

Post by bengalih » Tue Mar 20, 2018 3:12 pm

No.

I haven't done any work on this since August of 2017. Headphones over on Emuxtras did end up sending me his save set, which I uploaded to my xbox and still couldn't create a problem. As in, I could continue to create the files/folders, upload more via ftp, and have the xbox itself load games properly, create new saves when necessary.

In short, I could not reproduce any issue where 240 (or any number close to it) was a limitation in my save game directory.
I doubt that I have a "magic xbox", although I do have an X3 chip which from what I can gather is probably not a large segment of the modded population (due to them not being produced anymore and relatively sought after). I'm not saying this is the reason, but I can't explain why some others have posted this limit and I have not.

I'm willing to do more experiments if anyone wants to continue investigating.

psyko_chewbacca
Posts: 213
Joined: Fri Oct 05, 2012 5:19 pm
Location: Québec, Canada
Has thanked: 21 times
Been thanked: 125 times

Re: What are the *real* limitations of FATX

Post by psyko_chewbacca » Wed Mar 21, 2018 4:01 pm

I in over my head with FATX at the moment. I'm not an expert by any means but here's my take.

Root directory of a logical drive (C, E, F, G and others) can contain only a single cluster of directory/file entries. A FATX directory entry is 64 bytes long. Standard partitions (C, E, X, Y, Z) are all formatted using 16KB clusters. You can then have up to 256 entries in there. I have not personally tested it but root directory file count could be higher than 256 on a volume with larger cluster size. At least I don't see in the kernel code why it wouldn't be. Sub directories have a hardcoded limitation of 4096 entries as multiple clusters can be chained.

I don't know if it's the case or not but could the 240 game save limitation be because some game mount E:\UDATA and E:\TDATA to virtual drive mounts, making the kernel unable to follow cluster chains for that folder? When accessed as a subfolder, the kernel's FATX lib knows to follow the cluster chain but when mounted as root directory, the kernel invariably applies its rules for root directory and sets the max size to a single cluster.


Other important information I found:
Xbox Kernel can mount partitions with clusters size from 512bytes up to 64KB but will use a minimum cluster size of 4KB invariably when formatting, even if the partition size allows for smaller cluster size. For standard partitions (C, E, X, Y, Z), 16KB clusters is invariably used when using standard volume formatting tools like Evox or UnleashX dash. I don't know about XBPartitionner but I guess it could select a cluster size smaller than 16KB if it determines it's possible.

Kernel decides to format in FATX16 if the total size of the partition is smaller than 65520 clusters(Xbox-Linux states 65525 clusters but they're wrong. That's the limit for FAT16). For example, with 16KB clusters, max partition size is 1023.74MB: (65520 - 1) * 16 / 1024. Anything larger than that is interpreted as FATX32 volume, during mounting and formatting.

Volumes start location are aligned on 4096 bytes boundaries by design, in the kernel's hardcoded partition table. There doesn't seem to be any check when creating a partition. XBpartitionner could theoretically create a misaligned partition and kernel would take it; for hacked kernels that reads PartInfo on HDD.

psyko_chewbacca
Posts: 213
Joined: Fri Oct 05, 2012 5:19 pm
Location: Québec, Canada
Has thanked: 21 times
Been thanked: 125 times

Re: What are the *real* limitations of FATX

Post by psyko_chewbacca » Sat Apr 07, 2018 8:28 pm

Well I am stomped. It does seem FATX volumes can indeed have up to 4096 entries in their root directory, on both FATX16 and FATX32 formatted volumes!
Tinkering with FATX limitations on a spare drive, I stumbled on this behavior.

It does seem the implementation of the FATX filesystem "driver" in the kernel does indeed limit root directory to a single cluster worth of entries; so 256 entries on 16KB clusters. But it would seem the very same fs driver handles the root directory of FATX drives with the same logic as if it was a sub-directory and follow cluster chains to expand max file count to 4096 entries.

Maybe the 256 entries limitation was enforced in very early kernel revisions but was later changed?

Also, I don't remember if I said it before but contrary to regular FAT fs, FATX only has a single reserved cluster compared to 2 for FAT12/16/32.

Post Reply