This tutorial will guide you through the process of creating flists using the RFS tool. We'll cover creating flists from directories, configuring storage backends, and managing flist metadata.
Before you begin, make sure you have:
- RFS installed (see the Getting Started tutorial)
- A basic understanding of RFS concepts (see the Concepts documentation)
The most basic way to create an flist is from a directory:
rfs pack -m output.fl -s dir:///tmp/store /path/to/directoryThis command:
- Creates an flist named
output.flin the current directory - Uses a directory store at
/tmp/storeto store the file content - Processes all files in
/path/to/directoryrecursively
After running the command, you should see output similar to:
Processing directory: /path/to/directory
Found 42 files, 5 directories
Processed 42 files, 10.5 MB total
Created 37 unique blocks, 10.2 MB total
Flist created successfully: output.fl
The flist file (output.fl) contains:
- The directory structure
- File metadata (permissions, ownership, timestamps)
- References to the content blocks in the store
You can use multiple storage backends to shard or replicate content:
# Sharding across two stores
rfs pack -m output.fl -s 00-80=dir:///tmp/store1 -s 81-ff=dir:///tmp/store2 /path/to/directory
# Replicating to two stores
rfs pack -m output.fl -s dir:///tmp/store1 -s dir:///tmp/store2 /path/to/directoryFor production use, you'll typically want to use a remote storage backend:
# Using a ZDB backend
rfs pack -m output.fl -s zdb://zdb.example.com:9900/namespace /path/to/directory
# Using an S3 backend
rfs pack -m output.fl -s s3://username:password@s3.example.com:9000/bucket /path/to/directoryBy default, RFS strips passwords from store URLs when creating flists. This is a security feature to prevent unauthorized write access. If you need to preserve the password, use the --no-strip-password flag:
rfs pack -m output.fl -s s3://username:password@s3.example.com:9000/bucket --no-strip-password /path/to/directoryWarning: Using --no-strip-password means that anyone with access to the flist can extract the password and potentially gain write access to your store.
You can add custom tags to an flist:
rfs config -m output.fl tag add -t key=valueTags can be used to store arbitrary metadata about the flist, such as:
- Version information
- Creation date
- Author information
- Description
To list the tags in an flist:
rfs config -m output.fl tag listTo delete a tag from an flist:
rfs config -m output.fl tag delete -k keyYou can also manage the stores associated with an flist:
# List stores
rfs config -m output.fl store list
# Add a store
rfs config -m output.fl store add -s dir:///tmp/store3
# Delete a store
rfs config -m output.fl store delete -s dir:///tmp/store1When creating flists, consider how to organize your content:
- Group related files: Create flists for logically related sets of files
- Consider size: Very large flists may be unwieldy; consider splitting them
- Consider usage patterns: Group files that are likely to be accessed together
Choose storage backends based on your requirements:
- Local development: Use directory stores for simplicity
- Production: Use ZDB or S3 for reliability and accessibility
- Distribution: Ensure your storage backend is accessible to users of the flist
Use tags to document your flists:
rfs config -m output.fl tag add -t version=1.0.0
rfs config -m output.fl tag add -t created=$(date +%Y-%m-%d)
rfs config -m output.fl tag add -t author="Your Name"
rfs config -m output.fl tag add -t description="Description of the flist"# Create a directory store
mkdir -p /tmp/webapp-store
# Create an flist from the web application directory
rfs pack -m webapp.fl -s dir:///tmp/webapp-store /path/to/webapp
# Add metadata
rfs config -m webapp.fl tag add -t app=webapp
rfs config -m webapp.fl tag add -t version=1.0.0
rfs config -m webapp.fl tag add -t description="Web application flist"# Create an flist with content sharded across two ZDB instances
rfs pack -m distributed.fl \
-s 00-7f=zdb://zdb1.example.com:9900/namespace \
-s 80-ff=zdb://zdb2.example.com:9900/namespace \
/path/to/directory# Create an flist using an S3 backend with public read access
rfs pack -m public.fl -s s3://username:password@s3.example.com:9000/public-bucket /path/to/directory
# Add a public HTTP store for read access
rfs config -m public.fl store add -s http://s3.example.com:9000/public-bucketAfter creating an flist, you can explore its contents and inspect file details without mounting it.
You can view the contents of an flist as a tree structure:
# Display contents of a local flist
rfs flist tree output.fl
# Display contents of a flist from a server using its hash
rfs flist tree abc123... --server-url http://localhost:8080The output shows the directory structure and file types:
/
├── bin/
├── etc/
│ ├── passwd
│ └── hosts
└── usr/
└── bin/
You can inspect the details of an entire flist, showing metadata for all files and directories:
# Inspect a local flist
rfs flist inspect output.fl
# Inspect a flist from a server using its hash
rfs flist inspect abc123... --server-url http://localhost:8080The output includes detailed information for each file and directory in the flist:
Path: /etc/passwd
Type: Regular File
Inode: 12345
Name: passwd
Size: 1234 bytes
UID: 0
GID: 0
Mode: 0100644
Permissions: 0644
Device: 0
Created: 1609459200
Modified: 1609459200
---
At the end, a summary is displayed:
Flist Inspection: output.fl
==================
Files: 236
Directories: 42
Symlinks: 15
Total size: 5834752 bytes
This is particularly useful for verifying the contents of an flist before distributing it or for troubleshooting issues.
Now that you know how to create flists, you might want to learn:
For more detailed information about flists and storage backends, see the Concepts documentation.