Crate auto_mount

Crate auto_mount 

Source
Expand description

§auto_mount

auto_mount provides both high-level smart mounting and fine-grained control for device management.

    use auto_mount::*;

    // Option 1: Smart auto-mount (automatically decides GPT based on disk size)
    smart_auto_mount()?;

    // Option 2: Simple auto-mount (no GPT conversion)
    simple_auto_mount()?;

    // Option 3: Force GPT for all devices
    gpt_auto_mount()?;

    // Option 4: Custom configuration
    let config = MountConfig {
        force_gpt: false,
        gpt_threshold_gb: 1000, // Use GPT for disks >= 1TB
        skip_gpt: false,
    };
    smart_auto_mount_with_config(config)?;

§Fine-grained Control

    use auto_mount::*;

    let devices = find_connected_satas()?;
    let devices = filter_unmounted_hdd_devices(devices)?;
     
    // Optional: Convert to GPT (only if needed)
    change_devices_to_gpt(&devices)?;
     
    let devices = create_partition(&devices)?;
    format_devices(&devices)?;
    mount_devices(&devices)?;

Structs§

DeviceInfo
Device information structure
FormatResult
Format result for a single device
MountConfig
Configuration for smart mounting
MountEntry
Mount entry information
MountManagerConfig
Mount configuration
MountResult
Result of mount operation
PartitionResult
Partition creation result

Enums§

DeviceDiscoveryError
Errors that can occur during device discovery
DeviceFilterError
Errors that can occur during device filtering
Error
FilesystemError
Errors that can occur during filesystem operations
FilesystemType
Supported filesystem types
MountError
Errors that can occur during mount operations
PartitionError
Errors that can occur during partition operations
SmartMountError
Errors that can occur during smart mounting

Functions§

change_devices_to_gpt
Convert devices to GPT partition table (supports devices larger than 4TB)
collect_device_infos
Collect detailed information about devices
create_partition
Create single partition on each device using modern parted command
filter_unmounted_hdd_devices
Filter unmounted HDD devices with proper error handling
find_connected_satas
Find connected SATA devices with robust error handling
format_devices
Format devices with ext4 filesystem (backward compatibility)
format_devices_with_type
Format devices with specified filesystem type
gpt_auto_mount
Auto-mount with forced GPT (for large disks or modern systems)
mount_devices
Safe mount devices with comprehensive error handling and backup
simple_auto_mount
Simple auto-mount without GPT conversion (for compatibility)
smart_auto_mount
Smart auto-mount with intelligent decisions
smart_auto_mount_with_config
Smart auto-mount with custom configuration