RKFS -A new filesystem for Linux Operating System
from R.K.Raja (rajkanna_hcl@yahoo.com)
RKFS is the acronym for 'RK Filesystem'. It is a file system that has been designed and implemented from the scratch for small devices (the devices with less capacity). The main goal is to provide a simple but yet powerful file system that provides all the features as MinixFS and Ext2FS but for small devices. It is the only file system that has been designed and implemented, keeping the characteristics of small devices in mind. It shares many properties with the traditional UNIX file systems. It has the concept of blocks, inodes and directories. It is highly robust and provides excellent performance as Ext2 & Minix file systems.
RKFS is known to work on 2.4.x linux
kernels.
A feature wise comparison of RKFS, MinixFS
& Ext2FS is given below. This clearly shows one what RKFS is for.
Filesystem creation benchmarks
|
Feature |
RKFS |
MinixFS |
Ext2FS |
|
Filesystem creation |
Simple
& Fastest |
Simpe & less faster than RKFS |
Simpe & less faster than RKFS |
|
The benchmark was done on a 1.4 MB floppy disk |
1 secs |
2 secs |
5 secs |
Total metadata blocks used internally
|
Feature |
RKFS |
MinixFS |
Ext2FS |
|
Total metadata blocks used/reserved on a newly created FS on a device with 1440 blocks |
3
blocks ( 1 block for boot
sector, |
19 blocks |
28 blocks ( 1 block for boot sector, |
Total free blocks available on a newly created FS
|
Feature |
RKFS |
MinixFS |
Ext2FS |
|
Total free blocks (available to user to store data on a newly created FS on device with 1440 blocks ) |
1436 |
1420 |
1399 |
Total free inodes available
on a newly created FS
|
Feature |
RKFS |
MinixFS |
Ext2FS |
|
Total free inodes ( available to the user on a newly created FS on a device with 1440 blocks ) |
1436 ( This means user could create 1436 empty files! ) |
479 ( This means user could create only 479 files, even if the files are empty! ) |
173 ( This means user could create only 173 files, even if they are just 0 bytes file!! ) |
Inode block allocation strategy
|
Feature |
RKFS |
MinixFS |
Ext2FS |
|
Inode block allocation strategy |
Dynamic
( Inode blocks are allocated on demand ) |
Fixed allocation ( Inode blocks
are allocated at the time of filesystem |
Fixed allocation ( Inode blocks are allocated at the time of filesystem creation ) |
Inode block de-allocation strategy
|
Feature |
RKFS |
MinixFS |
Ext2FS |
|
Inode block de-allocation strategy |
Dynamic ( This means when all the inode in an inode block are freed, then that inode blocks will also be freed ) |
No de-allocation strategy ( This means that once the inode blocks are allocated during filesystem creation, they cannot be freed for ever! ) |
No de-allocation strategy ( This means that once the inode blocks are allocated during filesystem creation, they cannot be freed for ever! ) |
Comparison of other standard features
|
Feature |
RKFS |
MinixFS |
Ext2FS |
|
Support for all standard unix file types (like directories, regular files, device files, hard & soft links ) |
YES |
YES |
YES |
|
Max FS size |
65 MB |
65 MB |
2 TB |
|
Max file size |
65 MB |
65 MB |
2 GB |
|
Max filename length |
252 characters |
30 characters |
255 characters |
|
Total direct data blocks in inode |
39 ( This means a file of size 39K would be accessed more faster than a file with sizes greater than 39K ) |
7 |
12 |
|
Blocks reserved for superuser |
NO |
NO |
YES ( default 5 % ) |
|
User land program (mkfs) |
YES |
YES |
YES |
|
User land program (dumpfs) |
YES |
NO |
YES |
|
User land program (debugfs) |
NO ( Not really required ) |
NO |
YES |
|
User land program (fsck) |
NO (Under construction ) |
YES |
YES |
|
Access / Change / Delete time support |
NO ( all the three are same! ) |
YES |
YES |
|
Variable blocksize support |
NO ( Not really required for small devices ) |
NO |
YES |
|
Block sync read/write performance |
Same as MinixFS |
Better |
A bit advanced ( because of clusterred block allocation strategy ) |
|
Block async read/write performance |
Same as MinixFS |
Better |
A bit advanced ( because of the clusterred block allocation strategy ) |
|
Extensible |
YES |
YES |
YES |
Filesystem layout comparison
Ext2FS Layout
|
Boot Sector |
Block Group1 |
Block Group2 |
..... |
Block GroupN |
Number of blocks in each group = 8192
|
Super Block |
Group Descriptors |
Block Bitmap Block |
Inode Bitmap Block |
Inode Table Block1 |
..... |
Inode Table BlockN |
Data Block1 |
..... |
Data BlockN |
MinixFS Layout
|
Super Block |
Inode Bitmap Block |
Zone (Block) Bitmap Block |
Inode Table Block1 |
..... |
Inode Table BlockN |
Data Block1 |
..... |
Data BlockN |
RKFS Layout
|
Boot Sector |
Block Group1 |
Block Group2 |
..... |
Block GroupN |
Block size = 1K
Number of blocks in each group = 1440
|
Super Block |
Inode Table Block (Required for root inode ) |
Remaining blocks in the group are used for Inode table Blocks and Data blocks (Inode Table Blocks are allocated / de-allocated dynamically) |
RKFS use
cases
Since RKFS has been designed and implemented keeping the
characteristics of small
devices in mind, it would be an ideal candidate when we:
RKFS
in action
Total free blocks
available on a newly created filesystem
|
RKFS |
|
[root@localhost
rkfs]# ./mkrkfs -v
/dev/fd0 [root@localhost
rkfs]# mount -t rkfs
/dev/fd0 /mnt [root@localhost
rkfs]# cd /mnt [root@localhost
/mnt]# df
-k . |
|
Ext2FS |
|
[root@localhost
/root]# mke2fs -v -m 0 /dev/fd0 Writing inode tables: done [root@localhost
/root]# mount /dev/fd0 /mnt [root@localhost
/root]# cd /mnt [root@localhost
/mnt]# df
-k . |
Total number of free inodes available on a newly created filesystem
|
RKFS |
|
[root@localhost
/mnt]# stat -f . |
|
EXT2FS |
|
[root@localhost
/mnt]# stat -f . |
Dynamic Inode block allocation / de-allocation
|
RKFS |
|
[root@localhost
/mnt]# stat -f . [root@localhost
/mnt]# /tmp/test.sh [root@localhost
/mnt]# ls [root@localhost
/mnt]# stat -f . root@localhost /mnt]#
/opt1/rkfs/dumprkfs /dev/fd0 ***Superblock
at offset: 0 Filesystem ID: 1811 [root@localhost
/mnt]# df
-k . [root@localhost
/mnt]# rm -rf fil* [root@localhost
/mnt]# stat -f . [root@localhost
/mnt]# df
-k . [root@localhost
/mnt]# /opt1/rkfs/dumprkfs /dev/fd0 ***Superblock
at offset: 0 Filesystem ID: 1811 |
|
EXT2FS |
|
[root@localhost
/mnt]# stat -f . [root@localhost
/mnt]# /tmp/test.sh [root@localhost
/mnt]# ls [root@localhost
/mnt]# stat -f . [root@localhost
/mnt]# df
-k . [root@localhost
/mnt]#rm -rf file* [root@localhost
/mnt]# df
-k . [root@localhost
/mnt]# stat -f . |
Space optimization
(meta-data blocks design strategy)
|
RKFS |
|
[root@localhost
/mnt]# ls -al /root/test_file [root@localhost
/mnt]# cp /root/test_file . [root@localhost
/mnt]# sync [root@localhost
/mnt]# stat -f . [root@localhost
/mnt]# df
-k . [root@localhost
/mnt]# cksum /root/test_file |
|
EXT2FS |
|
[root@localhost
/mnt]# ls -al /root/test_file [root@localhost
/mnt]# cp /root/test_file . |
RKFS data structures
RKFS inode
struct rkfs_inode {
__u16 i_uid;
__u16 i_gid;
__u16 i_mode;
__u16 i_links_count;
__u32 i_time;
__u32 i_size;
__u16 i_blocks;
__u16 i_block[RKFS_N_BLOCKS];
};
struct rkfs_inode_info {
__u16 i_block[41];
};
RKFS
directory-entries
struct rkfs_dir_entry {
__u16 de_inode;
__u16 de_name_len;
char de_name[RKFS_MAX_FILENAME_LEN];
};
Hard and Soft links
in RKFS
RKFS superblock
struct rkfs_super_block {
__u16 s_fsid;
__u16 s_fsver;
__u16 s_block_map[RKFS_BLOCK_MAP_SIZE];
__u16 s_inode_map[RKFS_INODE_MAP_SIZE];
__u16 s_itable_map[RKFS_INODE_TABLES_MAP_SIZE][2];
__u16 s_state;
__u16 s_total_blocks;
};
Send your comments to: R.K.Raja (rajkanna_hcl@yahoo.com, rajark_hcl@yahoo.co.in)