====== Mark 1: Storage ======
The [[mark_1:home|Mark 1]] stores permanent data on hard disks and floppy disks. The files are stored on the NBS file server and accessed through drivers built in to both disk types. The default file system is [[mark_1:storage#cloud_file_system|CFS]].
The Mark 1's "cloud storage" may seem unrealistic, because it is the only feature - aside from networking - which does not operate entirely within LSL. Several LSL-based methods were tested over several years, but all of them had serious drawbacks which made them impractical for mainstream use. The memory limitations of LSL scripts imposed extreme limitations on storage capacity and speed, so NBS decided to create a cloud storage system which avoided these issues.
===== Cloud File System =====
The Cloud File System (CFS) is the file system used by all Mark 1 computers. It organizes files and directories much like any other file system in reality, with some minor limitations very similar to FAT, which was standard in the era the Mark 1 is designed for. Although CFS disks are referred to by UUIDs, SCOPE assigns each disk drive a letter similar to the DOS style (A & B for floppy disks, C for the internal hard disk, and D-Z for any external hard disks).
The key limitations of CFS are filename length, directory depth, and file size.
CFS files must conform to the [[https://en.wikipedia.org/wiki/8.3_filename|8.3 filename convention]] but must have at least a 1-character extension. A filename, excluding the extension, cannot exceed 8 characters. Filenames are case-insensitive and only support the following characters:
''0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ!#$%&'()-@^_`{}~''
Directories in CFS can only be 8 layers deep, including the disk root. For example, ''C:\A\B\C\D\E\F\G\file.txt'' is the deepest layer permitted. If you attempt to create or move a file or directory so that you would create another directory layer, such as ''C:\A\B\C\D\E\F\G\H\file.txt'', the storage driver will return an error.
Files in CFS cannot exceed 8196 bytes. This is a limitation to protect against script crashes in the system unit by loading files which would exceed the memory capacity of active scripts.
CFS does not implement clusters and traditional slack space. Instead, every file and directory record takes 256 bytes, plus the length of the file's contents. Because CFS supports only up to 512 kilobyte partitions, a single CFS partition can only support a maximum of 2048 empty files, 409 1k files, or 62 8K files.
Stored CFS partitions can only be read through the BIOS CFS driver in a Mark 1 system unit; there is no web interface or third-party API.
==== Data Integrity Check ====
Because disks are copyable, CFS implements special methods to ensure that data integrity is not lost by duplicate disks - for example, if you take a disk and rez two copies of it, then edit a file on one copy, the server recognizes that there may be two copies of the same disk, so it only changes the file on the disk being used.
One drawback to this system is that there is no way to detect if "Take Copy" is used on a disk. If a copy of a disk is taken and the original disk is edited, the copy will lose the original file because the server is not aware that there may be another copy in your inventory. Therefore, if a disk detects that it no longer has the original file, it will consider itself corrupted and will erase itself. The original disk will not be affected.
Because of this check, users should not use the "Take Copy" option on system units and floppy disks, because the copy may eventually be erased. Instead, users should use the "Take" option, then re-rez the taken copy back out in-world.
Note that this check does not affect any other duplication methods, such as shift-dragging or the "Create Copy" build tool. In those cases, the disk will retain its own data correctly.