It's helpful to become familiar with how Batocera has its partitions laid out first to better understand what you're accessing and where they are located.
Batocera uses two main partitions: the boot partition and the userdata partition.
The boot partition is what appears as the FAT32 partition when you plug the drive into another system (this will be the only visible partition to Windows by default). This is where Batocera contains all the files necessary to boot Batocera on your device. While Batocera is running, it is mounted to the /boot/ folder, but its original location is simply / on the FAT32 partition. It is not usually necessary to edit this partition (except for editing a few settings in the batocera-boot.conf file if required).
The userdata partition contains “the rest”, all the ROMs, BIOS files, saves, configuration (including batocera.conf), etc. This is referred to as either userdata or share interchangeably (in reference to it being the default path the network share points to), they both mean one and the same thing. This is designed to be portable between all versions of Batocera, even Batocera builds running on different platforms (granted, weaker platforms like SBCs won't magically gain the ability to play ROMs for emulators they don't have). Refer to the attached image below:
You are free to use a variety of filesystems for the userdata partition. The best filesystem to use depends on your situation and what capabilities you need/restrictions you can deal with. The boot partition should not be reformatted to a different filesystem (your particular platform may depend on it).
Here are the options available for the userdata partition:
btrfs_for_windows driver on the boot partition to allow Windows machines to read a BTRFS userdata partition. This issue can be worked around if you have network access. No restriction when using BTRFS, except you can't read it natively with MacOS. Performs slightly slower than ext4, but is better at protecting corruption from files such as during a power cut mid-transfer.To summarize in a table:
| Filesystem | Writable by Linux OSes? | Writable by Windows? | Writable by MacOS? | Issues with emulators | File size restrictions | Notes |
|---|---|---|---|---|---|---|
| ext4 | Yes | Not by default | No | None | None you'd feasibly reach | Some protection against file corruption. |
| btrfs | Yes | Not by default | No | None | None you'd feasibly reach | More protection against file corruption, but slightly slower than ext4. |
| NTFS | Yes | Yes | Not by default | Some (any that rely on symlinks, special character/case-sensitive filenames or certain permission bits) | None you'd feasibly reach | Minimal protection against file corruption. |
| exFAT | Yes | Yes | Yes | Many (really, only 4th gen and below systems are guaranteed to still be functional) | None you'd feasibly reach | No protection against file corruption. Is however the best for USB flash storage, as it uses the least amount of writes (increasing longevity of the drive). |
| FAT32 | Yes | Yes | Yes | Many (really, only 4th gen and below systems are guaranteed to still be functional) | 4GB (lower than DVD disc images) | No protection against file corruption. Not recommended under any circumstances, exFAT is superior in every way. |
You can reformat the userdata partition of the storage device you are using to ext4, BTRFS or exFAT using Batocera's built-in formatting tools. Go to SYSTEM SETTINGS → DEVELOPER → FORMAT A DISK. Of course, when you format a partition, you lose everything that was on it. So, backup your userdata (ROMs, saves, etc.) before doing this!
If you're handy with formatting partitions, you can always format the partitions yourself and manually install Batocera.
Batocera.linux is based on buildroot. You can see buildroot as a minimal Linux distribution which maintains base packages. Its focus is on being firmware for embedded systems, but is flexible enough to allow for more complex projects such as Batocera. Batocera.linux mainly includes extra packages not available by default in Buildroot (emulators, front-end GUI, additional drivers for devices, etc.) and configuration.
More information about Buildroot can be found here: https://buildroot.org.
The partition named BATOCERA visible on any computer under Windows, MacOS or Linux is the system. It is a partition formatted in FAT32, a filesystem supported by almost every OS and boot system (BIOS legacy or UEFI).
The three most important files on the boot partition are:
linux, the technical system (about 10 MB)batocera, the software system containing all the programs (about 2 GB compressed)initrd.gz or uInitrd, the loader (about 600 kB)Upgrading the system means mainly that these three files are getting upgraded. There may be some other files depending on the architecture.
The file batocera can be seen like a firmware, you cannot directly modify it. However the architecture is a bit more complex and allows you to add “adjustments” to modify the firmware without recompiling everything: batocera.linux supports and uses by default overlayfs. The real system is the firmware (the file batocera) and a filesystem in memory initialized with the file overlay if it exists. The overlay is an in-memory filesystem and not directly the overlay file because under Linux, you cannot properly unmount the root filesystem, mainly when it's a complex root from several filesystems.
As a general rule, the file overlay doesn't exist, unless it's created by the script batocera-save-overlay if a user or developer customizes the system.
+--------------------------------+ | TMPFS, writable | --> must be saved explicitly on /boot/overlay +--------------------------------+ | firmware (squashfs), read only | +--------------------------------+
More details on overlayfs can be found here : http://embedded-computing.com/guest-blogs/understand-what-an-overlayfs-is-and-how-it-works
When you create the card to run batocera.linux, the card is more complex than a basic card, and it's dependent on the architecture. It's why you need a special tool to burn it.
1 1263
+-----+-------------------+--------+--------------+
| MBR | | BOOT | FREE |
+-----+-------------------+--------+--------------+
512 631K
1 1263
+-----+-------------------+--------+--------------+
| GPT | SYSLINUX | BOOT | FREE |
+-----+-------------------+--------+--------------+
512 631K
1 31 63 719 1231 1263
+-----+-------+-------+-----------+--------+-------+----------+--------------+
| MBR | bl1 | bl2 | uboot | tzsw | | BOOT | FREE |
+-----+-------+-------+-----------+--------+-------+----------+--------------+
512 15K 31K 359K 615K 631K 1.2G
1 97 1281
+-----+-------+-----------+--------+--------------+
| MBR | bl1 | uboot | BOOT | FREE |
+-----+-------+-----------+--------+--------------+
512 48K 640K
The rest.