Database filesystem: #Contains directory information: Directory DB : CREATE TABLE Dir(Id INTEGER PRIMARY KEY AUTOINCREMENT UNIQUE, Path TEXT, Parent INTEGER) INSERT INTO "Dir" VALUES(1,'/',NULL); INSERT INTO "Dir" VALUES(2,'/Test Directory',1); INSERT INTO "Dir" VALUES(3,''/Test Directory/Subdirectory',2); #We store "FullPath" so we can do Select * from dir where fullpath='dirname'; #Contains information about file names, and which directory they are in File DB : CREATE TABLE File(Id INTEGER PRIMARY KEY AUTOINCREMENT UNIQUE, Path TEXT, Size INTEGER, Dir INTEGER) INSERT INTO "File" VALUES(1,'/Test Directory/FileA.ext',0,2); INSERT INTO "File" VALUES(2,'/Test Directory/Subdirectory/FileB.ext',0,3); #Store full path so we can do select * from dir where name="wherever" #For readdir we will need to use basename() on all parameters. #Contains information on which blocks belong to which file. CREATE TABLE Block(File INTEGER, Block INTEGER, Location INTEGER) INSERT INTO "Block" VALUES(1,2,0); INSERT INTO "Block" VALUES(1,3,1024); INSERT INTO "Block" VALUES(1,4,2048); CREATE TABLE XATTR(File INTEGER, Name TEXT, Data BLOB) INSERT INTO "XATTR" VALUES(1,"-Internal-Symlink",TRUE); INSERT INTO "XATTR" VALUES(1,"-Internal-Bits",022); #Contains information on which blocks are contained in a file. Block DB : CREATE TABLE BlockData(id INTEGER PRIMARY KEY AUTOINCREMENT UNIQUE, Data BLOB, DataChecksum INTEGER, Compressed INTEGER) INSERT INTO "BlockData" Values(1,,,