Skip to content
petterl edited this page Sep 13, 2010 · 3 revisions

FriendFS

Right now a hard drive is so cheap that I know several friends that have lot of hard drive space they dont use. The goal of FriendFS is to have a file system where redundancy is handled by the distribution of the same files to several places.

Spreading of files

All files stored in the FriendFS is spread out to the storage servers available in an even manner. The files are split into blocks and these are encrypted before being stored in a storage. The file system handles the file system information but this is replicated to storage servers as well.

Storage servers

A storage server can be any supported form of storage, remote or local.
The servers are configured in the FriendFSConf.
Each storage server configuration contains information on

  • how to reach the storage
  • verification interval
  • maximum storage capacity set.

Supported formats planned:

  • Local directory
  • FTP server
  • WebDAV server
  • SMB server
  • SSH server

File system

The file system is available as a FUSE file system that you can mount in any path.
The status if the file system is available in the file .friendfs_status in a mounted file system.
The file system is POSIX compatible and handles permission in the same way as ext2. All files are split into blocks and stored on the storage servers.

Each directory in the file system can have different configuration in regards to:

  • Replication level

Replication

The replication level for a file is determined by the setting of the directory where the file is stored. The FriendFS will store the blocks in that number of storage servers as the redundancy level is set to. If a storage server is unavailable replication of the blocks will be scheduled.

Flow

Create file

  1. call to FriendFS FUSE: create
  2. create an entry in the file system for the file in the directory
  3. Schedule replication of File system

Write to file

  1. Call to FUSE write
  2. If any data in that possition schedule removal of that block
  3. Split data into blocks
  4. Encrypt data with key
  5. Sign data using key
  6. Store signature for block in FS
  7. Store data in highest priority storage
  8. Store block data in file system
  9. Update mtime for file
  10. Schedule replication of file system
  11. Schedule replication of block

Read from file

  1. Call FUSE read
  2. Fetch block from highest priority storage
  3. return data

Store in storage

  1. connect to storage
  2. store block as file using signature as filename

Read from storage

  1. Connect to storage
  2. Fetch file using signature as filename

Verify storage

  1. Connect to storage
  2. List files in dir
  3. Compare to signature list for storage
  4. Schedule delete of removed blocks
  5. Schedule replication of missing blocks

Replicate block

  1. Find highest priority storage
  2. Read block from storage
  3. Write block to new storage

Scheduler

  1. Add verification interval for each storage in queue
  2. Perform action in queue.