3.2 KiB
3.2 KiB
SSD Detection Module
Übersicht
Das SSD Detection Module ist verantwortlich für die automatische Erkennung und Identifikation von USB-C SSDs im System. Es bietet robuste Hardware-Erkennung mit NTFS-Partition-Support.
Hauptkomponenten
ssd-detect.sh
Zweck: Automatische USB-C SSD Identifikation und NTFS-Partition Erkennung
Hauptfunktionen:
- Erkennung neu angeschlossener USB-Storage-Devices
- NTFS-Dateisystem Validierung
- UUID-basierte Geräte-Identifikation
- Hardware-Kompatibilitätsprüfung
- Logging aller Erkennungsvorgänge
Verwendung
Grundlegende Erkennung
# Automatische SSD-Erkennung
./ssd-detect.sh
# Verbose-Modus mit detailliertem Output
./ssd-detect.sh --verbose
# Nur NTFS-Partitionen anzeigen
./ssd-detect.sh --ntfs-only
Erweiterte Optionen
# Spezifisches Device prüfen
./ssd-detect.sh --device /dev/sdb1
# JSON-Output für Automation
./ssd-detect.sh --output json
# Kontinuierliche Überwachung
./ssd-detect.sh --monitor
Ausgabe-Format
Standard-Output
[INFO] USB-C SSD detected: /dev/sdb1
[INFO] Filesystem: NTFS
[INFO] UUID: 1234-5678-9ABC-DEF0
[INFO] Size: 500GB
[INFO] Label: BACKUP_SSD
[SUCCESS] Device ready for mounting
JSON-Output
{
"device": "/dev/sdb1",
"filesystem": "ntfs",
"uuid": "1234-5678-9ABC-DEF0",
"size": "500GB",
"label": "BACKUP_SSD",
"status": "ready"
}
Konfiguration
Environment Variables
# Standardmäßige Erkennungszeit (Sekunden)
export SSD_DETECT_TIMEOUT=30
# Log-Level (DEBUG, INFO, WARN, ERROR)
export SSD_LOG_LEVEL=INFO
# Unterstützte Dateisysteme
export SSD_SUPPORTED_FS="ntfs,exfat,ext4"
Fehlerbehandlung
Häufige Probleme
- Keine SSD erkannt: USB-Verbindung prüfen, Device-Permissions kontrollieren
- NTFS nicht unterstützt:
ntfs-3g
Package installieren - Permission denied: Script mit
sudo
ausführen
Debug-Modus
# Erweiterte Diagnose
./ssd-detect.sh --debug
# System-Logs prüfen
journalctl -f | grep ssd-detect
Integration
Systemd-Service
# Automatische Erkennung bei Boot
sudo systemctl enable ssd-detect.service
Udev-Rules
# Automatische Erkennung bei USB-Events
# Siehe examples/udev-rules/
Abhängigkeiten
Erforderliche Packages
util-linux
- Device-Managementntfs-3g
- NTFS-Supportparted
- Partitionstabellenudev
- Hardware-Events
Installation
# Ubuntu/Debian
sudo apt install util-linux ntfs-3g parted udev
# CentOS/RHEL
sudo yum install util-linux ntfs-3g parted systemd-udev
Sicherheit
Best Practices
- Immer UUID-basierte Identifikation verwenden
- Device-Permissions vor Zugriff prüfen
- Logging für Audit-Trails aktivieren
- Read-Only Modus für kritische Prüfungen
Berechtigungen
# Minimale Berechtigungen für Detection
sudo usermod -a -G disk $USER
Entwicklung
Testing
# Unit-Tests ausführen
./test-ssd-detect.sh
# Integration-Tests
./test-ssd-detect-integration.sh
Debugging
# Trace-Modus
bash -x ./ssd-detect.sh
# Profiling
time ./ssd-detect.sh --benchmark
Changelog
Version 0.1.0
- Initiale Implementierung
- NTFS-Support
- UUID-basierte Erkennung
- JSON-Output Format