Expand description
§auto_mount
auto_mount provides both high-level smart mounting and fine-grained control for device management.
§High-level Smart Mounting (Recommended)
ⓘ
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§
- Device
Info - Device information structure
- Format
Result - Format result for a single device
- Mount
Config - Configuration for smart mounting
- Mount
Entry - Mount entry information
- Mount
Manager Config - Mount configuration
- Mount
Result - Result of mount operation
- Partition
Result - Partition creation result
Enums§
- Device
Discovery Error - Errors that can occur during device discovery
- Device
Filter Error - Errors that can occur during device filtering
- Error
- Filesystem
Error - Errors that can occur during filesystem operations
- Filesystem
Type - Supported filesystem types
- Mount
Error - Errors that can occur during mount operations
- Partition
Error - Errors that can occur during partition operations
- Smart
Mount Error - 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