Which filesystem to use for RAM disk?

Solution 1:

Let's consider the file systems' applicability to a RAM disk by attributes:

Safety (Journaling)

Conceptual Notes

If you are meaning to cause your RAM disk to eventually persist back to disk, you would need your RAM disk software to periodically write any changes back to a hard disk backup file, so that if you reboot, you don't lose (too much) data.

If you were to cause the RAM disk backup file to be constantly overwritten, you'd be totally defeating the purpose of the RAM disk, because that would be the same as just writing the files straight to the HDD in the first place. So in other words, any data stored in the RAM disk should be considered expendable (if your system turned off right now, the data would be gone) for any writes to the RAM disk which occur between the synchronization point(s) to the persistent media (your hard disk).

If you don't want your RAM disk to be file-backed at all and can afford to lose the data whenever, then disregard data safety entirely.

NTFS: It has a feature called "journaling", which basically means that the file system is always in a consistent state; it's never left in a state where a write command is only "half done", because every write gets staged on the disk first (either in the metadata journal, the data journal, or both) and then finally committed. This is great for non-volatile media like hard disks and SSDs, but it is useless for RAM disks. The main thing that a journal tries to prevent is data loss during a sudden loss of power to the PC, or a software bug so severe that it causes the system to crash without being able to synchronize the file system (e.g. a Blue Screen of Death). But since the journal and the file system's data is in RAM, no amount of data journaling can prevent data loss! So the journal is just wasted space and I/O operations.

FAT32: Does not have a journal.

FAT16: Does not have a journal.

Performance

Conceptual Notes

Performance is affected by many factors, including the amount of data safety (data safety measures usually directly hurt performance as a consequence of increased safety), the amount and levels of caching, the block size, and file system index and data accounting algorithms.

NTFS: Performance of NTFS is probably quite competitive as a RAM disk compared to FAT16 or FAT32 due to the use of more advanced algorithms for data accounting and indexing. Even though NTFS does have a journal, which slows it down somewhat, the cost of the journal is even lower in RAM than it is on the hard disk.

FAT16: The use of a smaller address space yields FAT16 slightly higher performance over other filesystems. However, the filesystem uses fairly naive algorithms for managing and indexing data compared to NTFS, so the performance-due-to-simplicity may be partially or completely offset by the lack of performance due to the absence of robust algorithms.

FAT32: Almost the same as FAT16, but it can hold many more files within the filesystem -- up to 268,170,300 for 32KB clusters -- at a very small (negligible?) performance delta compared to FAT16.

Features

NTFS: Possesses the most robust features relative to FAT16 and FAT32. It supports things like file system-level encryption and compression; very large (>4 GB) files; extended attributes; alternative data streams; and much longer filenames than FAT16 and FAT32. Some programs that use very special features of the file system may not work unless you are using NTFS.

FAT16: Extremely weak on the features front. Should work with most programs doing normal disk I/O, but file-level access permissions aren't accounted for.

FAT32: Extremely weak on the features front. Should work with most programs doing normal disk I/O, but file-level access permissions aren't accounted for.

For a size of only 1.5 GB, FAT16 wouldn't bump up against any of its inherent limits, except maybe the limit of the number of files if you have a program that creates lots of files. FAT32 eliminates the worry of limits entirely, because you can't store a >4 GB file in a 1.5 GB volume, and the maximum number of files is more than you can probably fit in 1.5 GB of space (268 million).

That said, I would go with NTFS unless you need every last 0.5% of performance. And even then you may be able to get better performance with certain operations using NTFS over FAT due to its improved management of data (for example, it supports extents) to reduce internal fragmentation).