{"id":50801827,"url":"https://github.com/jackdoe/sfs","last_synced_at":"2026-06-12T21:01:42.096Z","repository":{"id":2103536,"uuid":"3044828","full_name":"jackdoe/sfs","owner":"jackdoe","description":"fuse based mysql backed file system","archived":false,"fork":false,"pushed_at":"2011-12-27T07:56:36.000Z","size":101,"stargazers_count":1,"open_issues_count":0,"forks_count":1,"subscribers_count":3,"default_branch":"master","last_synced_at":"2023-03-12T13:15:49.994Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"C","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/jackdoe.png","metadata":{"files":{"readme":"README","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2011-12-24T13:46:28.000Z","updated_at":"2014-02-05T07:18:03.000Z","dependencies_parsed_at":"2022-08-29T00:20:43.701Z","dependency_job_id":null,"html_url":"https://github.com/jackdoe/sfs","commit_stats":null,"previous_names":[],"tags_count":0,"template":null,"template_full_name":null,"purl":"pkg:github/jackdoe/sfs","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jackdoe%2Fsfs","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jackdoe%2Fsfs/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jackdoe%2Fsfs/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jackdoe%2Fsfs/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jackdoe","download_url":"https://codeload.github.com/jackdoe/sfs/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jackdoe%2Fsfs/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":34262157,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-26T15:22:16.424Z","status":"online","status_checked_at":"2026-06-12T02:00:06.859Z","response_time":109,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2026-06-12T21:01:41.324Z","updated_at":"2026-06-12T21:01:42.065Z","avatar_url":"https://github.com/jackdoe.png","language":"C","funding_links":[],"categories":[],"sub_categories":[],"readme":"*WARNING: experimental stage, work in progress, DOES NOT USE SSL, DO NOT USE IN PRODUCTION*\n\nvery basic mysql backed fuse file system.\n0: abstract\n\tfuse based, mysql backed file system\n\n1. requirements:\n\tfuse, mysql, pthreads, c compiler\n\n2. install:\n\tdownload from https://github.com/jackdoe/sfs\n\t$EDOTOR common.h #put proper mysql settings into common.h\n\tmake #DEBUG=1 if you want debug output\n\t./sfs /mnt/fuse\n\n3. info:\n\tthis is the table that is used:\n\t\n\tQ(\"CREATE TABLE IF NOT EXISTS `entries_%s` (\t\\\n\t`id` bigint(20) NOT NULL AUTO_INCREMENT,\t\\\n\t`path` varchar(255) NOT NULL,\t\t\t\\\n\t`data` longblob,\t\t\t\t\\\n\t`obj_type` int(11) NOT NULL,\t\t\t\\\n\t`uid` bigint(20) NOT NULL,\t\t\t\\\n\t`gid` bigint(20) NOT NULL,\t\t\t\\\n\t`mode` bigint(20) NOT NULL,\t\t\t\\\n\t`atime` bigint(20) NOT NULL,\t\t\t\\\n\t`mtime` bigint(20) NOT NULL,\t\t\t\\\n\t`ctime` bigint(20) NOT NULL,\t\t\t\\\n\t`btime` bigint(20) NOT NULL,\t\t\t\\\n\tPRIMARY KEY (`id`),\t\t\t\t\\\n\tUNIQUE KEY `path` (`path`))\",identifier);\n\t\n\tidentifier is a copy of the mysql username (for example root)\n\tand the table will be entries_root\n\ttable is automaticaly created at start, root directory is auto inserted as well\n\t\n\tmysql user needs to select/update/delete/insert and maybe create if you dont have\n\tthe table created.\n\n\t\n4. idea:\n\ti made this as proof of concept to be used in diskless linux based routers,\n\twhere i can edit their config files remotely - for example /etc or /usr/local/etc,\n\twith simple web based application.\n\n5. supported calls:\n\tsfs_oper.getattr\t= sfs_getattr;\n\tsfs_oper.readdir\t= sfs_readdir;\n\tsfs_oper.open\t\t= sfs_open;\n\tsfs_oper.write\t\t= sfs_write;\n\tsfs_oper.truncate\t= sfs_truncate;\n\tsfs_oper.read\t\t= sfs_read;\n\tsfs_oper.create\t\t= sfs_create;\n\tsfs_oper.unlink\t\t= sfs_delete;\n\tsfs_oper.chmod\t\t= sfs_chmod;\n\tsfs_oper.chown\t\t= sfs_chown;\n\tsfs_oper.statfs\t\t= sfs_statfs;\n\tsfs_oper.mkdir\t\t= sfs_mkdir;\n\tsfs_oper.readlink\t= sfs_readlink;\n\tsfs_oper.symlink\t= sfs_symlink;\n\tsfs_oper.rename\t\t= sfs_rename;\n\tsfs_oper.rmdir\t\t= sfs_rmdir;\n\tsfs_oper.utimens\t= sfs_utimens;\n\n6. limitations:\n\tMAX_PATH_SIZE: 256 chars\n\tmax data size: mysql's longblob 4gb\n\tread/write is extreamly slow on big files\n\tcurrently there is no locking\n\n7. example usage:\n\t\n\t$ mkdir ~/mysql_backed_fs\n\t$ ./sfs ~/mysql_backed_fs/\n\t$ cd ~/mysql_backed_fs\n\tmysql_backed_fs $ mkdir test_directory\n\tmysql_backed_fs $ cd test_directory/\n\ttest_directory $ ls -la\n\ttotal 0\n\tdrwxr-xr-x  1 jack  staff  0 Dec 27 09:24 .\n\tdrwxr-xr-x  1 jack  staff  0 Dec 24 15:35 ..\n\ttest_directory $ touch empty_file\n\ttest_directory $ cat empty_file\t\n\ttest_directory $ echo 'not empty anymore' \u003e\u003e empty_file\n\ttest_directory $ cat empty_file \n\tnot empty anymore\n\ttest_directory $ cd ..\n\tmysql_backed_fs $ ln -s test_directory/empty_file link\n\tmysql_backed_fs $ cat link\n\tnot empty anymore\n\tmysql_backed_fs $ ln -s test_directory link2\n\tmysql_backed_fs $ cat link2/empty_file \n\tnot empty anymore\n\tmysql_backed_fs $ cd ..\n\t$ dd if=/dev/random of=blob.dd bs=1m count=1 \u0026\u0026 md5 blob.dd \n\t1+0 records in\n\t1+0 records out\n\t1048576 bytes transferred in 0.080215 secs (13072073 bytes/sec)\n\tMD5 (blob.dd) = 7d84c26f72aa5440c778014b1c9d23fe\n\t$ cp blob.dd mysql_backed_fs/ \u0026\u0026 md5 mysql_backed_fs/blob.dd\n\tMD5 (mysql_backed_fs/blob.dd) = 7d84c26f72aa5440c778014b1c9d23fe\n\t$ cd mysql_backed_fs\n\nas you can see write is very very slow\n\n\tmysql_backed_fs $ dd if=/dev/zero of=./speed.blob.dd bs=1m count=5 \n\t5+0 records in\n\t5+0 records out\n\t5242880 bytes transferred in 14.620257 secs (358604 bytes/sec)\n\nreading is fine on not very large files tho, because it uses SUBSTRING() and \ngets only requested offset+size from the mysql\n\n\tmysql_backed_fs $ time cat speed.blob.dd \u003e /dev/null\n\treal\t0m0.005s\n\tuser\t0m0.001s\n\tsys\t0m0.004s\n\t\n\nmysql does not have a way for partial updates on blob fields so\nthere is download/modify (offset+size - usually 65k)/push the whole file and \nthe speed drops like a rock in water :)\n \n\tmysql_backed_fs$ dd if=/dev/zero of=./speed.blob.dd bs=65k count=1\n\t1+0 records in\n\t1+0 records out\n\t66560 bytes transferred in 0.004575 secs (14548589 bytes/sec)\n\tmysql_backed_fs$ dd if=/dev/zero of=./speed.blob.dd bs=256k count=1\n\t1+0 records in\n\t1+0 records out\n\t262144 bytes transferred in 0.015075 secs (17389082 bytes/sec)\n\tmysql_backed_fs$ dd if=/dev/zero of=./speed.blob.dd bs=512k count=1\n\t1+0 records in\n\t1+0 records out\n\t524288 bytes transferred in 0.046395 secs (11300513 bytes/sec)\n\tmysql_backed_fs$ dd if=/dev/zero of=./speed.blob.dd bs=1024k count=1\n\t1+0 records in\n\t1+0 records out\n\t1048576 bytes transferred in 0.301245 secs (3480808 bytes/sec)\n\tmysql_backed_fs$ dd if=/dev/zero of=./speed.blob.dd bs=2048k count=1\n\t1+0 records in\n\t1+0 records out\n\t2097152 bytes transferred in 1.876782 secs (1117419 bytes/sec)\n\nbut for small files it is fine\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjackdoe%2Fsfs","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjackdoe%2Fsfs","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjackdoe%2Fsfs/lists"}