Virtual File System

File management on a virtual partition implemented with PHP, MYSQL with an HTML, DHTML, JavaScript CSS user interface.

Partition database tables

  • FAT (File Allocation Table) specifying the file id, file begin, file offset, file part
  • File table specifying all the file id, and file properties including file rights
  • Free space table specifying the free space intervals, speeds up the procedure of searching for free space

File manager features

  • Create file
  • Delete file (the user is asked for a confirm)
  • Secure delete file (replaces file contents with some random bytes)
  • Copy file
  • Move file
  • Edit file contents
  • Highlight file contents (for source code)
  • File rights
  • Rename file or directory
  • Create directory
  • Copy directory (recursively copies all the sub directories and files)
  • Move / rename directory (recursively moves all the sub directories and
    files)
  • Multiple file upload
  • Simple space usage analysis
  • Unauthorized access protection

Virtual partition features

  • Partition image storied to a single real binary file
  • File fragmenting
  • File hashing (own algorithm randomly permuting all the bytes according to the key)
  • File compression using gzlib library used only when the compressed contents occupy less space than uncompressed ones

When a file is created or updated a procedure searching for the free space is called. The procedure is constructed in such way, that it prevents unneeded file fragmenting.

  • If there is enough space, first is searches for a uniform free space of exactly the same size as the given file.
  • If such interval is not found, then is searches for the largest uniform free interval
  • If not found, then it searches for the smallest number of free intervals fitting the file size.

When a file is deleted, all the file parts are marked as “deleted” for eventual file recovery, the freed interval is added to a free space table, then the free space table is compacted. In the common case, the file contents are not removed from the partition image.

Virtual files are read according to the file allocation table. Before to read a file that is fragmented, all the file contents are composed into a one stream according to the part number.

Additional information

The current API can be adopted to any protocol or a file system since it overwrites the PHP file system functions. This interface is based on a remote file manager for Linux developed by me in years 2004-2006.

Sources

Sources available upon request.

Powered by PepisCMS