QNX File Systems

J

Jarret W. Buse

Guest
QNX File Systems

Similar to Minix, the QNX file systems are based from an Operating System (OS). QNX is a commercial OS designed for embedded systems. The OS was designed in the 1980’s by Quantum Software Systems, later to be QNX Software Systems. In 2010, QNX Software Systems was bought by Blackberry.

NOTE: QNX is the basis for the Blackberry 10 systems.

In the late 1980’s, QNX4 was released. With the QNX4 release, there was also the addition of the QNX4FS (QNX version 4 File System). In late 2008, QNX 6.4.0 was released which introduced the QNX6FS.

The QNX4FS supports the following:
  • support for files up to 2GB
  • 505-character long filenames
  • File system using extents where files are stored in contiguous blocks and addressed as one unit
Each QNX4FS partition contains the following:

  • loader block – the first physical block of the volume which contains information to load the installed OS.
  • root block – the second physical block of the volume that holds the volume’s inode information of the following:
    • the root directory of the file system
    • /.inodes – where the inodes are stored for each file
    • /.boot – can contain OS image to load from loader block
    • /.altboot - can contain OS image to load from loader block
  • bitmap blocks – consecutive blocks after the root block which contains a bitmap for the QNX4FS volume. One bitmap block covers 4096 physical blocks. A zero means the block is unused, while a one is when the block is used
  • root directory – file containing the directory entries and inode addresses
  • other directories, files, free blocks – area of the storage volume holding the file data stored on the disk such as data, applications, images, etc.
More robustness for the QNX file systems came with the release of QNX6. The QNX6FS was made the default file system in QNX 6.4.1.

When a QNX volume is created, it is possible to specify to the default block size for the file system. The options are 512, 1024, 2048 or 4096. Be aware that on a system with a lot of small files, the block size should be kept small (512 bytes). If a file system will hold large files, then the block size should be larger (4096 bytes). Even if a volume will hold a mix of small and large, the block size can be set depending if there are more smaller or larger files. By setting the block size appropriately, more space is saved. For example, if files in the range of 100-500 bytes are to be stored, a block size of 512 bytes is best. Even if a file is 500 bytes, it will nearly fill a whole block. If a file is even 513 bytes in length, then two blocks are used. The first block of 512 bytes and another block with only 1 bytes used and 511 bytes wasted, making a lot of wasted space.

NOTE: Determine the predominate file type to be stored on a volume and find the average file size.

Be aware that the inode pointers are 32-bit in size. This means that volume using a block size of 4096 bytes can be just over 16 TB in size. The addresses available are 2 to the 32nd power or 4,294,967,296 blocks. If each block is then the maximum size of 4096 bytes, you get a maximum volume size of over 16 TB.

NOTE: Inode pointer values are set to zero when not used.

Each QNX6FS has two copies of the Super Block. The main copy and a backup copy are kept in the case of a corruption of one Super Block. The first Super Block is stored at address 0x2000. The backup of the Super Block is stored in the second last block on the volume. The address is calculated by taking the last address, zero the last three bytes of the address and subtract 0x1000 from the result.

For example, we will use a 20GB hard disk with a maximum address of 4A7576FF0. We zero the last three bytes to make a new address of 4A7576000. Finally, we subtract 0x1000 for an address value of 4A7575000. It is at the address of 4A7575000 that the backup Super Block address starts.

NOTE: The Superblock occupies a space of 0x1000 no matter the block size of the volume.

In the QNX6FS, the inodes contain the metadata about the files. Data such as permissions, number of blocks, timestamps of various items, etc. is stored in the indoe. Everything about a file is stored in the inode but the file name itself. Sixteen pointers are used to store the addresses of the first sixteen blocks (if needed). If the file is longer than sixteen blocks, then another pointer is used to point to another set of pointers as indirect blocks. The sizes are as follows for sixteen blocks:

Block Size -------- Size
512 ------------------ 8,192
1,024 -------------- 16,384
2,048 -------------- 32,768
4,096 -------------- 65,536

For example, on a volume using a block size of 2048 bytes per block, a file size of 32,768 bytes or less will not require more than the first sixteen pointers.
 

Attachments

  • slide.jpg
    slide.jpg
    17.1 KB · Views: 95,976
Last edited:



Staff online

Members online


Top