Skip to content

Dev Docs Config Volumes

Andy Lemin edited this page Aug 16, 2025 · 2 revisions

WIP - ALL LINKS IN THIS WIKI STRUCTURE ARE CURRENTLY BROKEN DURING WIKI MIGRATION

THESE ARE COMMUNITY DOCS

Volume Configuration Reference

Overview

This document provides detailed information about configuring AFP volumes in Netatalk, including volume types, access controls, performance settings, and advanced features like Time Machine and Spotlight integration. This includes both the configuration interface and the underlying architectural implementation.

Implementation Files:

  • etc/afpd/volume.c - Core volume management, mounting, and access control
  • include/atalk/volume.h - Volume structure definitions and capability flags
  • libatalk/util/netatalk_conf.c - Volume configuration parsing and validation
  • etc/afpd/afp_config.c - Volume configuration processing and integration
  • libatalk/vfs/ - Virtual File System layer for volume operations

Volume Lifecycle Management

The volume system implements a comprehensive lifecycle state machine to manage volume states from initialization to shutdown:

Implementation Files:

  • etc/afpd/volume.c - Volume lifecycle state management and transitions
  • etc/afpd/main.c - Volume initialization during AFP daemon startup
  • libatalk/util/server_child.c - Per-client volume state management
  • etc/afpd/afp_config.c - Configuration-driven volume lifecycle control
stateDiagram-v2
    [*] --> VOLUME_INIT
    
    VOLUME_INIT --> VOLUME_CONFIG_LOADED: Load configuration
    VOLUME_CONFIG_LOADED --> VOLUME_PATH_VALIDATED: Validate path
    VOLUME_PATH_VALIDATED --> VOLUME_PERMISSIONS_SET: Set permissions
    VOLUME_PERMISSIONS_SET --> VOLUME_CNID_INITIALIZED: Initialize CNID
    VOLUME_CNID_INITIALIZED --> VOLUME_SPOTLIGHT_READY: Setup Spotlight
    VOLUME_SPOTLIGHT_READY --> VOLUME_ACTIVE: Volume ready
    
    VOLUME_ACTIVE --> VOLUME_MAINTENANCE: Maintenance mode
    VOLUME_MAINTENANCE --> VOLUME_ACTIVE: Maintenance complete
    
    VOLUME_ACTIVE --> VOLUME_READONLY: Force read-only
    VOLUME_READONLY --> VOLUME_ACTIVE: Restore write access
    
    VOLUME_ACTIVE --> VOLUME_OFFLINE: Take offline
    VOLUME_OFFLINE --> VOLUME_ACTIVE: Bring online
    
    VOLUME_ACTIVE --> VOLUME_SHUTDOWN: Shutdown request
    VOLUME_MAINTENANCE --> VOLUME_SHUTDOWN: Emergency shutdown
    VOLUME_READONLY --> VOLUME_SHUTDOWN: Shutdown request
    VOLUME_OFFLINE --> VOLUME_SHUTDOWN: Shutdown request
    
    VOLUME_SHUTDOWN --> VOLUME_CLEANUP: Cleanup resources
    VOLUME_CLEANUP --> [*]: Volume destroyed
    
    note right of VOLUME_CNID_INITIALIZED
        CNID database ready
        File IDs available
    end note
    
    note right of VOLUME_SPOTLIGHT_READY
        Search indexing active
        Metadata tracking enabled
    end note
    
    note right of VOLUME_MAINTENANCE
        CNID maintenance
        Index rebuilding
        Consistency checks
    end note
Loading

Volume State Management Flow

sequenceDiagram
    participant AFP as AFP Server
    participant VM as Volume Manager
    participant FS as File System
    participant CNID as CNID System
    participant Spotlight as Spotlight
    participant Config as Configuration
    
    Note over AFP,Config: Volume Initialization
    
    AFP->>VM: Initialize volume
    VM->>Config: Load volume config
    Config-->>VM: Volume parameters
    VM->>FS: Validate volume path
    FS-->>VM: Path status
    VM->>FS: Set permissions/ownership
    VM->>CNID: Initialize CNID database
    CNID-->>VM: CNID ready
    VM->>Spotlight: Setup indexing
    Spotlight-->>VM: Indexing ready
    VM-->>AFP: Volume active
    
    Note over AFP,Config: Volume Operations
    
    AFP->>VM: Client mount request
    VM->>VM: Check access permissions
    VM->>CNID: Allocate session
    VM-->>AFP: Mount successful
    
    AFP->>VM: File operation
    VM->>FS: Execute operation
    VM->>CNID: Update metadata
    VM->>Spotlight: Update index
    VM-->>AFP: Operation complete
    
    Note over AFP,Config: Volume Shutdown
    
    AFP->>VM: Shutdown volume
    VM->>VM: Flush pending operations
    VM->>CNID: Close database
    VM->>Spotlight: Stop indexing
    VM->>FS: Sync filesystem
    VM-->>AFP: Shutdown complete
Loading

Volume Architecture

Implementation Files:

  • include/atalk/volume.h - Central volume structure definitions and macros
  • etc/afpd/volume.c - Volume structure management and operations
  • libatalk/vfs/vfs.c - Virtual File System integration layer
  • etc/afpd/directory.c - Directory-volume integration and caching

Core Volume Structure

Netatalk's volume system is built around the central struct vol data structure (defined in include/atalk/volume.h), which encapsulates all volume state and capabilities:

// Core volume structure (276 lines of implementation detail)
struct vol {
    struct vol      *v_next;        // Linked list of volumes
    AFPObj          *v_obj;         // AFP connection object
    uint16_t        v_vid;          // Volume ID
    int             v_flags;        // Volume capability flags (28+ flags)
    char            *v_path;        // Filesystem path
    struct dir      *v_root;        // Root directory object
    time_t          v_mtime;        // Volume modification time
    
    // Character set handling
    charset_t       v_volcharset;   // Volume filesystem encoding
    charset_t       v_maccharset;   // Mac client encoding
    uint16_t        v_mtou_flags;   // Mac-to-Unix conversion flags
    uint16_t        v_utom_flags;   // Unix-to-Mac conversion flags
    uint32_t        v_kTextEncoding;// Mac text encoding (network order)
    size_t          max_filename;   // Maximum filename length
    
    // CNID database integration
    struct _cnid_db *v_cdb;         // CNID database handle
    char            v_stamp[ADEDLEN_PRIVSYN]; // Volume stamp
    
    // VFS layer integration
    struct vfs_ops  *vfs;           // VFS operations pointer
    const struct vfs_ops *vfs_modules[4]; // Pluggable VFS modules
    int             v_vfs_ea;       // Extended attributes flag
    
    // Time Machine support
    VolSpace        v_tm_used;      // Used bytes on TM volume
    time_t          v_tm_cachetime; // Cache calculation time
    VolSpace        v_appended;     // Amount of appended data
    
    // Volume limits and permissions
    VolSpace        v_limitsize;    // Size limit in MiB
    mode_t          v_umask;        // Default umask
    mode_t          v_dperm;        // Default directory permissions
    mode_t          v_fperm;        // Default file permissions
    
    // Unicode name handling
    ucs2_t          *v_u8mname;     // UTF8-Mac name in UCS2
    ucs2_t          *v_macname;     // Legacy longname in UCS2
    ucs2_t          *v_name;        // Either v_u8mname or v_macname
    
    // Configuration strings
    char            *v_configname;  // Config file volume name
    char            *v_localname;   // Expanded local path
    char            *v_password;    // Volume password
    char            *v_cnidscheme;  // CNID scheme (dbd, mysql, etc.)
    char            *v_dbpath;      // CNID database path
    char            *v_uuid;        // Time Machine UUID
    
    // Access control and execution hooks
    char            *v_preexec;     // Pre-execution command
    char            *v_postexec;    // Post-execution command
    uint32_t        v_ignattr;      // Ignored AFP attributes
};

Volume Capability Flags

The volume system uses an extensive bitfield flag system (v_flags) with 28+ capability flags:

// Basic operation flags
#define AFPVOL_OPEN              (1<<0)   // Volume is open
#define AFPVOL_RO                (1<<8)   // Read-only volume

// Feature capability flags
#define AFPVOL_SPOTLIGHT         (1<<6)   // Spotlight indexing enabled
#define AFPVOL_TM                (1<<23)  // Time Machine support
#define AFPVOL_ACLS              (1<<24)  // Access Control Lists support
#define AFPVOL_UNIX_PRIV         (1<<17)  // Unix privileges support
#define AFPVOL_SEARCHDB          (1<<25)  // Fast CNID database search

// Character handling flags
#define AFPVOL_EILSEQ            (1<<20)  // Encode illegal sequences as-is
#define AFPVOL_INV_DOTS          (1<<22)  // Dots files are invisible
#define AFPVOL_CASESENS          (1<<4)   // Case sensitive volume

// Performance optimization flags
#define AFPVOL_NODEV             (1<<18)  // Always use 0 for device number
#define AFPVOL_FOLLOWSYM         (1<<27)  // Follow symlinks on server

// Extended attributes backend selection
#define AFPVOL_EA_NONE           0        // No extended attributes
#define AFPVOL_EA_AUTO           1        // Try sys, fallback to ad
#define AFPVOL_EA_SYS            2        // System extended attributes
#define AFPVOL_EA_AD             3        // AppleDouble files

// Security and access control flags
#define AFPVOL_CHMOD_PRESERVE_ACL (1<<9)   // Preserve ACLs on chmod
#define AFPVOL_CHMOD_IGNORE      (1<<10)  // Ignore chmod requests
#define AFPVOL_NONETIDS          (1<<26)  // Signal client to do privilege mapping

Character Set Architecture

Netatalk implements sophisticated character set conversion with case folding support:

// Character conversion control flags
#define AFPVOL_MTOUUPPER         (1<<0)   // Mac-to-Unix uppercase
#define AFPVOL_MTOULOWER         (1<<1)   // Mac-to-Unix lowercase
#define AFPVOL_UTOMUPPER         (1<<2)   // Unix-to-Mac uppercase
#define AFPVOL_UTOMLOWER         (1<<3)   // Unix-to-Mac lowercase

// Combined case folding modes
#define AFPVOL_UMLOWER           (AFPVOL_MTOULOWER | AFPVOL_UTOMLOWER)
#define AFPVOL_UMUPPER           (AFPVOL_MTOUUPPER | AFPVOL_UTOMUPPER)
#define AFPVOL_UUPPERMLOWER      (AFPVOL_MTOUUPPER | AFPVOL_UTOMLOWER)
#define AFPVOL_ULOWERMUPPER      (AFPVOL_MTOULOWER | AFPVOL_UTOMUPPER)

// UTF-8 encoding detection
#define utf8_encoding(obj)       ((obj)->afp_version >= 30)

VFS Layer Integration and Architecture

Each volume integrates with Netatalk's sophisticated Virtual File System layer through pluggable modules. From include/atalk/vfs.h:

Implementation Files:

  • include/atalk/vfs.h - VFS operations interface and function pointers
  • libatalk/vfs/vfs.c - Core VFS implementation and module loading
  • libatalk/vfs/sys_ea.c - System extended attributes VFS backend
  • libatalk/vfs/vfs_adouble.c - AppleDouble VFS operations
  • libatalk/vfs/vfs_acl.c - Access Control Lists VFS integration
// Core VFS operations structure (127-line implementation)
struct vfs_ops {
    // Basic file system operations
    int (*vfs_validupath)(const struct vol *vol, const char *name);
    int (*vfs_chown)(const struct vol *vol, const char *path, uid_t uid, gid_t gid);
    int (*vfs_deletefile)(const struct vol *vol, int dirfd, const char *file);
    int (*vfs_renamefile)(const struct vol *vol, int dirfd, const char *src, const char *dst);
    int (*vfs_copyfile)(const struct vol *vol, int sfd, const char *src, const char *dst);
    
    // Directory operations
    int (*vfs_renamedir)(const struct vol *vol, int dirfd, const char *oldpath, const char *newpath);
    int (*vfs_deletecurdir)(const struct vol *vol);
    int (*vfs_setdirmode)(const struct vol *vol, const char *name, mode_t mode, struct stat *st);
    int (*vfs_setdirunixmode)(const struct vol *vol, const char *name, mode_t mode, struct stat *st);
    int (*vfs_setdirowner)(const struct vol *vol, const char *name, uid_t uid, gid_t gid);
    
    // Permission management
    int (*vfs_setfilmode)(const struct vol *vol, const char *name, mode_t mode, struct stat *st);
    
    // ACL support (Access Control Lists) - both NFSv4 and POSIX
    #ifdef HAVE_ACLS
    int (*vfs_acl)(const struct vol *vol, const char *path, ...);  // Conditional compilation
    int (*vfs_remove_acl)(const struct vol *vol, const char *path, int dir);
    #endif
    
    // Extended Attributes (EA) operations
    int (*vfs_ea_getsize)(const struct vol *vol, char *rbuf, size_t *rbuflen,
                          const char *uname, int oflag, const char *attruname, int fd);
    int (*vfs_ea_getcontent)(const struct vol *vol, char *rbuf, size_t *rbuflen,
                             const char *uname, int oflag, const char *attruname,
                             int maxreply, int fd);
    int (*vfs_ea_list)(const struct vol *vol, char *attrnamebuf, size_t *buflen,
                       const char *uname, int oflag, int fd);
    int (*vfs_ea_set)(const struct vol *vol, const char *uname, const char *attruname,
                      const char *ibuf, size_t attrsize, int oflag, int fd);
    int (*vfs_ea_remove)(const struct vol *vol, const char *uname, const char *attruname,
                         int oflag, int fd);
};

// VFS initialization per volume
extern void initvol_vfs(struct vol *restrict vol);

VFS Plugin Architecture Features

The VFS layer provides comprehensive filesystem abstraction:

  1. Pluggable Backends: Function pointer-based architecture enables custom filesystem implementations
  2. Multi-Module Support: Up to 4 VFS modules per volume for layered functionality
  3. ACL Integration: Support for both NFSv4 ACLs (HAVE_NFSV4_ACLS) and POSIX ACLs (HAVE_POSIX_ACLS)
  4. Extended Attributes: Complete EA support with atomic get/set/list/remove operations
  5. Directory Operations: Advanced directory management with ownership and permission control
  6. Per-Volume Customization: Each volume can have different VFS implementations

VFS Function Interface Patterns

The VFS system uses standardized macro patterns for consistent interfaces:

// File operations with comprehensive parameter sets
#define VFS_FUNC_ARGS_CHOWN const struct vol *vol, const char *path, uid_t uid, gid_t gid
#define VFS_FUNC_ARGS_RENAMEFILE const struct vol *vol, int dirfd, const char *src, const char *dst

// Extended Attributes with full parameter specification
#define VFS_FUNC_ARGS_EA_SET const struct vol *vol, const char *uname, const char *attruname, \
                            const char *ibuf, size_t attrsize, int oflag, int fd

// ACL operations with conditional compilation support
#ifdef HAVE_NFSV4_ACLS
#define VFS_FUNC_ARGS_ACL const struct vol *vol, const char *path, int cmd, int count, void *aces
#endif
#ifdef HAVE_POSIX_ACLS
#define VFS_FUNC_ARGS_ACL const struct vol *vol, const char *path, acl_type_t type, int count, acl_t acl
#endif

VFS Integration in Volume Structure

// VFS layer components in struct vol (from include/atalk/volume.h)
struct vfs_ops v_vfs_ea;             // Extended Attributes VFS operations
const struct vfs_ops *vfs_modules[4]; // Up to 4 pluggable VFS modules

// VFS convenience macros
#define vol_nodev(vol)           (((vol)->v_flags & AFPVOL_NODEV) ? 1 : 0)
#define vol_unix_priv(vol)       ((vol)->v_obj->afp_version >= 30 && ((vol)->v_flags & AFPVOL_UNIX_PRIV))
#define vol_syml_opt(vol)        (((vol)->v_flags & AFPVOL_FOLLOWSYM) ? 0 : O_NOFOLLOW)

This VFS architecture enables Netatalk to support:

  • Multiple Filesystems: HFS+, ext4, ZFS, APFS compatibility layers
  • Platform-Specific Optimizations: Linux, macOS, FreeBSD VFS backends
  • Advanced Features: ACLs, Extended Attributes, custom file operations
  • Pluggable Extensions: Custom VFS modules for specialized requirements

Volume Parameter Bits

AFP protocol-level volume attributes are managed through parameter bits:

// Volume attribute advertisement to clients
#define VOLPBIT_ATTR_RO          (1<<0)   // Read-only volume
#define VOLPBIT_ATTR_PASSWD      (1<<1)   // Password protected
#define VOLPBIT_ATTR_FILEID      (1<<2)   // File ID support
#define VOLPBIT_ATTR_CATSEARCH   (1<<3)   // Catalog search support
#define VOLPBIT_ATTR_UNIXPRIV    (1<<5)   // Unix privileges
#define VOLPBIT_ATTR_UTF8        (1<<6)   // UTF-8 names support
#define VOLPBIT_ATTR_EXT_ATTRS   (1<<10)  // Extended attributes
#define VOLPBIT_ATTR_ACLS        (1<<11)  // Access Control Lists
#define VOLPBIT_ATTR_TM          (1<<13)  // Time Machine support

// Volume parameter request types
#define VOLPBIT_ATTR             0        // Volume attributes
#define VOLPBIT_SIG              1        // Volume signature
#define VOLPBIT_CDATE            2        // Creation date
#define VOLPBIT_MDATE            3        // Modification date
#define VOLPBIT_VID              5        // Volume ID
#define VOLPBIT_BFREE            6        // Bytes free
#define VOLPBIT_BTOTAL           7        // Total bytes
#define VOLPBIT_NAME             8        // Volume name
#define VOLPBIT_XBFREE           9        // Extended bytes free (>4GB)
#define VOLPBIT_XBTOTAL          10       // Extended total bytes (>4GB)
#define VOLPBIT_BSIZE            11       // Block size

Volume Definition Syntax

Implementation Files:

  • libatalk/iniparser/ - INI-style configuration parsing for volume definitions
  • libatalk/util/netatalk_conf.c - Volume syntax parsing and validation
  • etc/afpd/afp_config.c - Volume definition processing and structure population

Basic Volume Syntax

[VolumeName]
path = /path/to/directory
# Additional options...

Volume Name Rules

  • Case Sensitive: Volume names are case-sensitive
  • Special Characters: Avoid spaces and special characters in volume names
  • Reserved Names: Avoid system reserved names like Global, Homes
  • Unicode Support: UTF-8 characters supported in volume names

Volume Types

Implementation Files:

  • etc/afpd/volume.c - Volume type detection and handling logic
  • libatalk/util/netatalk_conf.c - Volume type configuration processing
  • etc/afpd/afp_config.c - Volume type validation and setup

1. Static Volumes

Standard fixed-path volumes for shared directories.

[SharedDocuments]
path = /srv/documents
valid users = @staff
read only = no
vol charset = UTF8

2. User Home Directories

Automatically generated volumes for user home directories.

[Homes]
basedir regex = /home
home name = "Home Directory"
valid users = @users
path = ~

Home Directory Options

Option Description Example
basedir regex Base directory pattern /home, /Users
home name Display name template "$u's Home"
path Path template (~ = user home) ~, /home/$u

3. Dynamic Volumes

Volumes created based on directory contents or patterns.

[ProjectDirs]
basedir regex = /srv/projects
vol preset = project_template
valid users = @developers

Access Control

Implementation Files:

  • etc/afpd/volume.c - Volume access control enforcement and user validation
  • etc/afpd/auth.c - Authentication integration with volume access control
  • libatalk/util/netatalk_conf.c - Access control configuration parsing
  • etc/afpd/file.c - File-level access control integration

User and Group Access

[RestrictedVolume]
path = /srv/restricted

# User access control
valid users = alice bob @managers
invalid users = guest @interns
admin users = @admin alice

# Group-based access
valid groups = @staff @contractors
invalid groups = @guests

Access Control Syntax

  • Individual Users: alice bob charlie
  • Groups: @groupname (with @ prefix)
  • Mixed: alice @staff bob @managers
  • Wildcards: @* (all groups), * (all users)

Permission Models

Unix Permissions Model

[UnixVolume]
path = /srv/unix-style
unix priv = yes
inherit perms = yes

# Default permissions
file perm = 0644
directory perm = 0755
umask = 022

# Force ownership
force user = webserver
force group = www-data

Mac Permissions Model

[MacVolume]
path = /srv/mac-style
unix priv = no

# Simplified Mac-style permissions
file perm = 0666
directory perm = 0777
umask = 000

Advanced Access Control

[SecureVolume]
path = /srv/confidential

# Hierarchical access
valid users = @level1 @level2 @level3
admin users = @security-admin

# Time-based access (requires external scripts)
preexec = /usr/local/bin/check-business-hours.sh
postexec = /usr/local/bin/log-access.sh %u %v

# Read-only enforcement
read only = yes
delete readonly = no

Volume Attributes

Implementation Files:

  • etc/afpd/volume.c - Volume attribute management and AFP parameter handling
  • include/atalk/afp.h - AFP volume attribute constants and flags
  • etc/afpd/afp_volume.c - AFP volume parameter request processing
  • libatalk/util/netatalk_conf.c - Volume attribute configuration parsing

Basic Attributes

[BasicVolume]
path = /srv/basic

# Volume properties
vol size limit = 50000     # 50GB limit in MB
password = secretpass      # Volume password
read only = no             # Read/write access
guest ok = yes             # Allow guest access

Character Encoding

[EncodingVolume]
path = /srv/international

# Character set handling
vol charset = UTF8         # Volume filesystem encoding
mac charset = MAC_ROMAN    # Mac client encoding

Supported Character Sets

Charset Description Use Case
UTF8 Unicode UTF-8 Modern filesystems
ISO-8859-1 Latin-1 Western European
MAC_ROMAN Mac Roman Classic Mac compatibility
CP1252 Windows-1252 Windows compatibility

Extended Attributes

[ExtendedVolume]
path = /srv/extended

# Extended attribute storage
ea = ad                    # Use AppleDouble files
# ea = sys                 # Use system extended attributes
# ea = none                # Disable extended attributes

# AppleDouble options
ad options = upriv,usedots # Unix privileges, use dot files

Time Machine Configuration

Basic Time Machine Volume

[TimeMachine]
path = /srv/timemachine
time machine = yes

# Essential Time Machine settings
vol size limit = 1000000   # 1TB limit
tm used size = yes         # Report used space accurately
spotlight = no             # Disable Spotlight indexing

Advanced Time Machine Settings

[TimeMachineAdvanced]
path = /srv/timemachine-advanced
time machine = yes

# Size management
vol size limit = 2000000   # 2TB limit
quota = yes                # Enable quota enforcement

# Performance optimization
cache size = 131072        # 128MB cache
stat vol = no              # Don't update volume stats

# Multi-user Time Machine
valid users = @backup-users
directory perm = 0700      # Secure per-user directories

Time Machine Best Practices

[TimeMachineBestPractice]
path = /srv/timemachine-bp
time machine = yes

# Recommended settings
vol size limit = 3000000   # 3x largest client disk
tm used size = yes
spotlight = no
ea = ad
vol charset = UTF8

# Security
valid users = @mac-users
unix priv = yes
inherit perms = yes

# Performance
tcp rcvbuf = 131072
tcp sndbuf = 131072

Spotlight Integration

Basic Spotlight Configuration

[SpotlightVolume]
path = /srv/searchable
spotlight = yes

# Spotlight settings
spotlight size limit = 10000  # 10GB indexing limit
spotlight expr = "kMDItemFSName != '.*'"  # Exclude hidden files

Advanced Spotlight Configuration

[SpotlightAdvanced]
path = /srv/documents
spotlight = yes

# Indexing control
spotlight size limit = 50000
spotlight expr = "kMDItemContentType != 'public.folder'"

# Performance tuning
cache size = 65536         # Larger cache for search
vol charset = UTF8         # Ensure proper text indexing

Spotlight Expressions

# Common Spotlight filter expressions

# Exclude hidden files and system files
spotlight expr = "kMDItemFSName != '.*' && kMDItemFSName != 'Thumbs.db'"

# Include only documents
spotlight expr = "kMDItemContentTypeTree == 'public.text' || kMDItemContentTypeTree == 'public.image'"

# Exclude large files
spotlight expr = "kMDItemFSSize < 104857600"  # Less than 100MB

# Date-based filtering
spotlight expr = "kMDItemContentModificationDate > $time.now(-2592000)"  # Last 30 days

Performance Optimization

Caching Configuration

[HighPerformanceVolume]
path = /srv/high-perf

# Memory caching
cache size = 131072        # 128MB cache
stat vol = no              # Reduce stat() calls

# I/O optimization
ea = ad                    # Efficient extended attributes
vol charset = UTF8         # Optimal character handling

Network Optimization

[NetworkOptimized]
path = /srv/network-opt

# TCP settings (applied globally)
tcp rcvbuf = 262144        # 256KB receive buffer
tcp sndbuf = 262144        # 256KB send buffer
dsireadbuf = 16384         # 16KB DSI read buffer

Database Optimization

[DatabaseOptimized]
path = /srv/db-opt

# CNID database settings
cnid scheme = dbd
vol dbpath = /var/lib/netatalk/CNID/DatabaseOptimized

# Berkeley DB tuning (via environment variables)
# DB_CONFIG file in vol dbpath directory

File Type Handling

File Extension Mapping

[TypeMappedVolume]
path = /srv/typed

# Veto (hide) certain files
veto files = *.tmp/~*/.*/.DS_Store

# File type associations
# Configured via application-specific settings

Mac File Type Support

[MacTypeVolume]
path = /srv/mac-files

# Enable Mac file type/creator support
ea = ad                    # Required for type/creator storage
mac charset = MAC_ROMAN    # Classic Mac compatibility

Volume Security

Encryption and Security

[SecureVolume]
path = /srv/secure

# Access restrictions
password = volume-password
valid users = @secure-team
admin users = @security-admin

# File system security
unix priv = yes
inherit perms = yes
umask = 027

# Audit trail
preexec = /usr/local/bin/log-volume-access.sh %u %v
postexec = /usr/local/bin/log-volume-disconnect.sh %u %v

Guest Access Control

[PublicVolume]
path = /srv/public
guest ok = yes

# Guest restrictions
read only = yes            # Guests can only read
delete readonly = no       # Prevent deletion
unix priv = no             # Simplified permissions

# Security measures
veto files = *.exe/*.bat/*.cmd  # Block executable files

Troubleshooting Volumes

Debug Volume Configuration

[DebugVolume]
path = /tmp/debug-vol

# Minimal restrictions for testing
guest ok = yes
read only = no
unix priv = no
file perm = 0666
directory perm = 0777

# Debug settings
log level = default:debug9
stat vol = yes             # Enable volume statistics

Volume Validation

# Test volume accessibility
afpd -d -f /etc/netatalk/afp.conf

# Check volume permissions
ls -la /path/to/volume

# Test guest access
# Connect as guest and verify access

# Monitor volume usage
df -h /path/to/volume

Volume Templates

Standard Office Volume

[Office]
path = /srv/office
valid users = @staff
read only = no

# Office-friendly settings
vol charset = UTF8
mac charset = MAC_ROMAN
ea = ad
spotlight = yes
cache size = 32768

# Reasonable permissions
file perm = 0644
directory perm = 0755
unix priv = yes

Media Archive Volume

[MediaArchive]
path = /srv/media
read only = yes
guest ok = yes

# Media optimization
spotlight = yes
cache size = 65536
vol charset = UTF8

# Large file handling
stat vol = no

Development Volume

[Development]
path = /srv/dev
valid users = @developers
admin users = @dev-leads

# Developer-friendly settings
unix priv = yes
inherit perms = yes
case sensitive = yes

# Version control friendly
veto files = .git/*/node_modules/*/target/*
spotlight = no             # Avoid indexing build artifacts

This volume configuration reference provides comprehensive guidance for setting up various types of AFP volumes to meet different organizational needs, from simple file sharing to complex multi-user environments with advanced security and performance requirements.

Clone this wiki locally