|
Bogdan Timofte
authored
3 months ago
|
1
|
# AutoNAS Development Documentation
|
|
|
2
|
|
|
|
3
|
## Development Architecture Overview
|
|
|
4
|
|
|
|
5
|
### Project Structure - v3.0 Clean Architecture
|
|
|
6
|
```
|
|
|
7
|
autoNAS/
|
|
|
8
|
├── README.md # User documentation & quick start
|
|
|
9
|
├── DEVELOPMENT.md # Development documentation (this file)
|
|
|
10
|
├── deploy.sh # Remote deployment system
|
|
|
11
|
├── config/
|
|
|
12
|
│ ├── disks.conf # Disk configuration template
|
|
|
13
|
│ ├── 99-autonas-disk.rules # udev rules for disk detection
|
|
|
14
|
│ ├── 98-autonas-interfaces.rules # Network interface monitoring
|
|
|
15
|
│ ├── autonas.service # Main AutoNAS service
|
|
|
16
|
│ ├── autonas-attach@.service # Individual disk services
|
|
|
17
|
│ └── autonas-boot-scan.service # Boot time disk scanning
|
|
|
18
|
├── scripts/
|
|
|
19
|
│ ├── autonas.sh # ✅ Main CLI interface (1,208 lines)
|
|
|
20
|
│ ├── autonas-core.sh # ✅ Core business logic library (1,044 lines)
|
|
|
21
|
│ ├── autonas-disk-handler.sh # Internal: Disk event handler
|
|
|
22
|
│ ├── autonas-network-handler.sh # Internal: Network event handler
|
|
|
23
|
│ ├── autonas-udev-wrapper.sh # Internal: udev timeout prevention
|
|
|
24
|
│ ├── autonas-boot-scan.sh # Internal: Boot-time scanning
|
|
|
25
|
│ ├── autonas-media-importer.sh # Internal: Camera import processing
|
|
|
26
|
│ ├── autonas-uninstall.sh # Internal: System uninstaller
|
|
|
27
|
│ └── install.sh # Installation and setup script
|
|
|
28
|
```
|
|
|
29
|
|
|
|
30
|
### Clean User Interface Architecture
|
|
|
31
|
```
|
|
|
32
|
User Command: autonas <cmd> [options]
|
|
|
33
|
↓
|
|
|
34
|
/usr/local/bin/autonas.sh (Main CLI)
|
|
|
35
|
↓
|
|
|
36
|
/usr/local/bin/autonas-core.sh (Business Logic Library)
|
|
|
37
|
↓
|
|
|
38
|
/usr/local/lib/autonas/*.sh (Internal System Scripts - Hidden)
|
|
|
39
|
```
|
|
|
40
|
|
|
|
41
|
### Script Organization - Professional Deployment
|
|
|
42
|
```
|
|
|
43
|
/usr/local/bin/
|
|
|
44
|
├── autonas -> autonas.sh # Only user-visible command
|
|
|
45
|
├── autonas.sh # Main CLI interface
|
|
|
46
|
└── autonas-core.sh # Core business logic library
|
|
|
47
|
|
|
|
48
|
/usr/local/lib/autonas/ # Internal scripts (hidden from autocomplete)
|
|
|
49
|
├── autonas-boot-scan.sh # Boot scanner
|
|
|
50
|
├── autonas-disk-handler.sh # Disk event handler
|
|
|
51
|
├── autonas-media-importer.sh # Media importer
|
|
|
52
|
├── autonas-network-handler.sh # Network handler
|
|
|
53
|
├── autonas-udev-wrapper.sh # Udev wrapper
|
|
|
54
|
└── autonas-uninstall.sh # System uninstaller
|
|
|
55
|
```
|
|
|
56
|
|
|
|
57
|
### v3.0 Code Reduction Achievement - Technical Metrics
|
|
|
58
|
```
|
|
|
59
|
BEFORE v3.0 (Duplicated Architecture):
|
|
|
60
|
- Multiple visible scripts with duplicated functions
|
|
|
61
|
- ~5,929+ lines across all components
|
|
|
62
|
- autonas-manager.sh: 696 lines (eliminated)
|
|
|
63
|
- autonas-config.sh: 1,709 lines (eliminated)
|
|
|
64
|
- autonas.sh (old): 1,505 lines (replaced)
|
|
|
65
|
|
|
|
66
|
AFTER v3.0 (Clean Architecture):
|
|
|
67
|
- Single visible command: autonas
|
|
|
68
|
- autonas.sh: 1,208 lines (unified CLI)
|
|
|
69
|
- autonas-core.sh: 1,044 lines (business logic)
|
|
|
70
|
- Internal scripts: properly organized and hidden
|
|
|
71
|
|
|
|
72
|
TOTAL CODE REDUCTION: ~2,300 lines (47% reduction)
|
|
|
73
|
DUPLICATION ELIMINATED: 100% through core library pattern
|
|
|
74
|
```
|
|
|
75
|
|
|
|
76
|
### System Integration Updates - v3.0 Complete
|
|
|
77
|
```
|
|
|
78
|
Configuration Files (All Updated):
|
|
|
79
|
✅ 99-autonas-disk.rules - Updated with /usr/local/lib/autonas/ paths
|
|
|
80
|
✅ 98-autonas-interfaces.rules - Updated with /usr/local/lib/autonas/ paths
|
|
|
81
|
✅ autonas.service - Updated with /usr/local/lib/autonas/ paths
|
|
|
82
|
✅ autonas-boot-scan.service - Updated with /usr/local/lib/autonas/ paths
|
|
|
83
|
✅ autonas-attach@.service - Updated with /usr/local/lib/autonas/ paths
|
|
|
84
|
✅ disks.conf - Configuration template (unchanged)
|
|
|
85
|
```
|
|
|
86
|
|
|
|
87
|
### Core Architecture Components
|
|
|
88
|
|
|
|
89
|
#### 1. Clean User Interface (`autonas.sh`) ⭐ v3.0
|
|
|
90
|
**Single visible command** combining all functionality:
|
|
|
91
|
```bash
|
|
|
92
|
autonas attach <uuid> # Disk operations
|
|
|
93
|
autonas detach <uuid>
|
|
|
94
|
autonas list # Configuration management
|
|
|
95
|
autonas add [uuid]
|
|
|
96
|
autonas show # Device discovery
|
|
|
97
|
autonas status # System status
|
|
|
98
|
autonas --help # Complete help system
|
|
|
99
|
```
|
|
|
100
|
|
|
|
101
|
**Key Features:**
|
|
|
102
|
- **1,208 lines** - Clean CLI interface
|
|
|
103
|
- **Single command interface** - Professional user experience
|
|
|
104
|
- **Unified logging** with `LOG_TAG="autonas"`
|
|
|
105
|
- **Zero code duplication** - All business logic in core library
|
|
|
106
|
|
|
|
107
|
#### 2. Core Business Logic Library (`autonas-core.sh`) ⭐ v3.0
|
|
|
108
|
**Single source of truth** for all AutoNAS functionality:
|
|
|
109
|
```bash
|
|
|
110
|
source "/usr/local/bin/autonas-core.sh" # Loaded by all scripts
|
|
|
111
|
```
|
|
|
112
|
|
|
|
113
|
**Key Features:**
|
|
|
114
|
- **1,044 lines** - Complete business logic library
|
|
|
115
|
- **Zero duplication** - All shared functions centralized
|
|
|
116
|
- **47% code reduction** - ~2,300 lines eliminated across system
|
|
|
117
|
- **Consistent behavior** - Single implementation for all operations
|
|
|
118
|
- **Complete feature parity** with separate scripts
|
|
|
119
|
|
|
|
120
|
#### 3. Internal System Scripts (Hidden from Users) ⭐ v3.0
|
|
|
121
|
**Location:** `/usr/local/lib/autonas/*.sh`
|
|
|
122
|
|
|
|
123
|
**Professional organization** with scripts hidden from autocomplete:
|
|
|
124
|
- **autonas-disk-handler.sh**: Disk attach/detach operations
|
|
|
125
|
- **autonas-network-handler.sh**: Network interface event handling
|
|
|
126
|
- **autonas-udev-wrapper.sh**: udev timeout prevention
|
|
|
127
|
- **autonas-boot-scan.sh**: Boot-time disk discovery
|
|
|
128
|
- **autonas-media-importer.sh**: Camera import processing
|
|
|
129
|
- **autonas-uninstall.sh**: Complete system removal
|
|
|
130
|
|
|
|
131
|
#### 4. udev Detection System
|
|
|
132
|
**File:** `config/99-autonas-disk.rules`
|
|
|
133
|
|
|
|
134
|
Detects three types of external storage devices:
|
|
|
135
|
- **USB Storage**: `ENV{ID_BUS}=="usb"`
|
|
|
136
|
- **SCSI Removable**: `ATTRS{removable}=="1"`
|
|
|
137
|
- **USB-SATA Bridges**: `ENV{ID_BUS}=="ata"` + `ENV{ID_USB_TYPE}=="disk"`
|
|
|
138
|
|
|
|
139
|
#### 5. Background Processing (`autonas-udev-wrapper.sh`)
|
|
|
140
|
Prevents udev timeout issues through:
|
|
|
141
|
- **Asynchronous execution** with 2-second device stabilization delay
|
|
|
142
|
- **Complete environment setup** for restricted udev context
|
|
|
143
|
- **systemd integration** for privilege escalation
|
|
|
144
|
- **Comprehensive logging** with device details
|
|
|
145
|
|
|
|
146
|
### v3.0 Architecture Validation - Technical Assessment
|
|
|
147
|
|
|
|
148
|
#### Professional User Experience
|
|
|
149
|
- **✅ Single visible command**: `autonas` only command in autocomplete
|
|
|
150
|
- **✅ All functionality preserved**: Complete feature parity through unified interface
|
|
|
151
|
- **✅ Clean backend organization**: All utilities properly categorized and hidden
|
|
|
152
|
- **✅ Zero duplication**: Single source of truth for all business logic
|
|
|
153
|
|
|
|
154
|
#### System Integration Status
|
|
|
155
|
- **✅ systemd services**: All updated with `/usr/local/lib/autonas/` paths
|
|
|
156
|
- **✅ udev rules**: All updated with `/usr/local/lib/autonas/` paths
|
|
|
157
|
- **✅ configuration files**: All references updated throughout system
|
|
|
158
|
- **✅ deploy script**: Enhanced with directory creation and proper installation
|
|
|
159
|
- **✅ install/uninstall**: Complete support for new architecture
|
|
|
160
|
|
|
|
161
|
#### Development Metrics - v3.0 Success
|
|
|
162
|
- **Scripts organized**: 7 moved to internal directory
|
|
|
163
|
- **User commands visible**: 1 (`autonas` only)
|
|
|
164
|
- **Code duplication eliminated**: ~2,300 lines (47% reduction)
|
|
|
165
|
- **System integration**: 100% updated
|
|
|
166
|
- **Backward compatibility**: 100% preserved
|
|
|
167
|
Handles complex mount operations:
|
|
|
168
|
- **UUID-based device identification**
|
|
|
169
|
- **Intelligent IP sharing** across multiple disks
|
|
|
170
|
- **NFS export automation** with optimized settings
|
|
|
171
|
- **Camera import workflow** with background processing
|
|
|
172
|
|
|
|
173
|
#### 5. Configuration System (`autonas-config.sh`)
|
|
|
174
|
Interactive configuration management:
|
|
|
175
|
- **Three configuration types**: NFS shares, local mounts, camera import
|
|
|
176
|
- **UUID validation** and device verification
|
|
|
177
|
- **Interactive setup wizards**
|
|
|
178
|
- **Configuration testing** and status reporting
|
|
|
179
|
|
|
|
180
|
#### 6. Media Import System
|
|
|
181
|
**Script:** `autonas-media-importer.sh` (Non-configurable, built-in)
|
|
|
182
|
- **EXIF-based organization** with UTC to local time conversion
|
|
|
183
|
- **Multi-format support**: MP4, MOV, JPG, JPEG, PNG, ARW, DNG, AVI, MKV
|
|
|
184
|
- **Automated cleanup** of proprietary files (GLV for Garmin cameras)
|
|
|
185
|
- **Background service integration** for unlimited processing time
|
|
|
186
|
|
|
|
187
|
### Configuration Types
|
|
|
188
|
|
|
|
189
|
#### 1. NFS Share (Network Access)
|
|
|
190
|
```
|
|
|
191
|
UUID:name:ip:interface:mount_point:nfs_options
|
|
|
192
|
```
|
|
|
193
|
|
|
|
194
|
#### 2. Local Mount (Local Only)
|
|
|
195
|
```
|
|
|
196
|
UUID:name:LOCAL:LOCAL:mount_point:LOCAL
|
|
|
197
|
```
|
|
|
198
|
|
|
|
199
|
#### 3. Camera Import (Automated Processing)
|
|
|
200
|
```
|
|
|
201
|
UUID:name:IMPORT:IMPORT:temp_mount:destination_path
|
|
|
202
|
```
|
|
|
203
|
|
|
|
204
|
### Remote Deployment System
|
|
|
205
|
|
|
|
206
|
#### Deploy Script (`deploy.sh`)
|
|
|
207
|
Manages AutoNAS across multiple production nodes:
|
|
|
208
|
```bash
|
|
|
209
|
./deploy.sh install # Deploy to all nodes (91, 92, 93)
|
|
|
210
|
./deploy.sh install 192.168.2.91 # Deploy to specific node
|
|
|
211
|
./deploy.sh start|restart|stop # Service management
|
|
|
212
|
./deploy.sh status # Health checking
|
|
|
213
|
./deploy.sh uninstall # Complete removal
|
|
|
214
|
```
|
|
|
215
|
|
|
|
216
|
**Features:**
|
|
|
217
|
- **SSH-based automation** with connectivity validation
|
|
|
218
|
- **Host availability checking** with ping verification
|
|
|
219
|
- **Graceful error handling** - continues with available hosts
|
|
|
220
|
- **Transfer optimization** with rsync and exclude patterns
|
|
|
221
|
- **Service lifecycle management** across multiple nodes
|
|
|
222
|
|
|
|
223
|
### Development Testing
|
|
|
224
|
|
|
|
225
|
#### Target Production Nodes
|
|
|
226
|
- **192.168.2.91** (baobab.vad.is.xdev.ro) - NFS Consumer
|
|
|
227
|
- **192.168.2.92** (ebony.vad.is.xdev.ro) - Storage Provider (ext01)
|
|
|
228
|
- **192.168.2.93** (tapia.vad.is.xdev.ro) - Storage Provider (ext02)
|
|
|
229
|
|
|
|
230
|
#### SSH Access Requirement
|
|
|
231
|
```bash
|
|
|
232
|
# ⚠️ CRITICAL: Always use root user for AutoNAS operations
|
|
|
233
|
ssh -l root 192.168.2.91 'autonas status'
|
|
|
234
|
ssh -l root 192.168.2.92 'autonas list'
|
|
|
235
|
ssh -l root 192.168.2.93 'autonas attach <uuid>'
|
|
|
236
|
```
|
|
|
237
|
|
|
|
238
|
AutoNAS requires root privileges for:
|
|
|
239
|
- Disk mounting/unmounting operations
|
|
|
240
|
- Network interface IP configuration
|
|
|
241
|
- NFS export management
|
|
|
242
|
- systemd service operations
|
|
|
243
|
|
|
|
244
|
### Logging and Monitoring
|
|
|
245
|
|
|
|
246
|
#### Log Tag System - v3.0 Clean Architecture
|
|
|
247
|
- **`autonas`**: Main CLI and core business logic operations
|
|
|
248
|
- **`autonas-boot-scan`**: Boot-time disk discovery
|
|
|
249
|
- **`autonas-disk-handler`**: Disk attach/detach operations
|
|
|
250
|
- **`autonas-network-handler`**: Network interface events
|
|
|
251
|
- **`autonas-media-import`**: Camera import processing
|
|
|
252
|
- **`autonas-udev-wrapper`**: udev event processing
|
|
|
253
|
|
|
|
254
|
#### Real-time Monitoring
|
|
|
255
|
```bash
|
|
|
256
|
# All AutoNAS system components
|
|
|
257
|
journalctl -t autonas -t autonas-boot-scan -t autonas-disk-handler -t autonas-network-handler -t autonas-media-import -f
|
|
|
258
|
```
|
|
|
259
|
# All AutoNAS components
|
|
|
260
|
journalctl -t autonas -t autonas-manager -t autonas-wrapper -f
|
|
|
261
|
|
|
|
262
|
# Unified script only
|
|
|
263
|
journalctl -t autonas -f
|
|
|
264
|
|
|
|
265
|
# Specific component
|
|
|
266
|
journalctl -t autonas-import --since "10 minutes ago"
|
|
|
267
|
```
|
|
|
268
|
|
|
|
269
|
#### System Status Checks
|
|
|
270
|
```bash
|
|
|
271
|
# Service status
|
|
|
272
|
systemctl status autonas autonas-boot-scan
|
|
|
273
|
|
|
|
274
|
# Active mounts
|
|
|
275
|
mount | grep autonas
|
|
|
276
|
|
|
|
277
|
# NFS exports
|
|
|
278
|
showmount -e localhost
|
|
|
279
|
|
|
|
280
|
# Network configuration
|
|
|
281
|
ip addr show | grep "192.168.10"
|
|
|
282
|
```
|
|
|
283
|
|
|
|
284
|
## Important Development Notes
|
|
|
285
|
|
|
|
286
|
### User Context for Testing and Administration
|
|
|
287
|
- **AutoNAS is a system administration utility designed for root user**
|
|
|
288
|
- **Always use `ssh -l root` for testing and administration**
|
|
|
289
|
- AutoNAS manages system-level resources: disk mounting, NFS exports, systemd services
|
|
|
290
|
- Root privileges are required for all core functionality
|
|
|
291
|
|
|
|
292
|
### Development Testing Commands
|
|
|
293
|
```bash
|
|
|
294
|
# Correct way to test AutoNAS operations
|
|
|
295
|
ssh -l root 192.168.2.91 'autonas attach <uuid>'
|
|
|
296
|
ssh -l root 192.168.2.92 'autonas detach <uuid>'
|
|
|
297
|
ssh -l root 192.168.2.93 'autonas list'
|
|
|
298
|
|
|
|
299
|
# Check system status
|
|
|
300
|
ssh -l root <host> 'systemctl status autonas'
|
|
|
301
|
ssh -l root <host> 'journalctl -t autonas -n 10'
|
|
|
302
|
```
|
|
|
303
|
|
|
|
304
|
## Configuration Backup and Recovery
|
|
|
305
|
|
|
|
306
|
### Current Configuration Backup
|
|
|
307
|
Date: August 14, 2025
|
|
|
308
|
Location: `/etc/pve/autonas/disks.conf`
|
|
|
309
|
|
|
|
310
|
```
|
|
|
311
|
8765-4321:camera-real:IMPORT:IMPORT:/mnt/autonas/camera-real:/mnt/autonas/ext01/@Camera/import
|
|
|
312
|
f6ac3d86-5681-4b33-bc64-aa272b333057:ext01:192.168.10.21:thunderbridge:/mnt/autonas/ext01:*(rw,all_squash,insecure,async,no_subtree_check,anonuid=0,anongid=0)
|
|
|
313
|
920fe1b7-4091-4d6a-bab8-2f48d8d704bc:ext02:192.168.10.22:thunderbridge:/mnt/autonas/ext02:*(rw,all_squash,insecure,async,no_subtree_check,anonuid=0,anongid=0)
|
|
|
314
|
```
|
|
|
315
|
|
|
|
316
|
### Configuration Format
|
|
|
317
|
- **Camera Import Format**: `UUID:name:IMPORT:IMPORT:mount_point:destination_path`
|
|
|
318
|
- Media importer script (`/usr/local/bin/autonas-media-importer.sh`) is **built-in and non-configurable**
|
|
|
319
|
- **External Disk Format**: `UUID:name:ip:interface:mount_point:nfs_options`
|
|
|
320
|
|
|
|
321
|
### Known UUIDs and Labels
|
|
|
322
|
- `8765-4321`: Camera device (LABEL="CAMERA-REAL")
|
|
|
323
|
- `f6ac3d86-5681-4b33-bc64-aa272b333057`: External RAID (LABEL="External RAID")
|
|
|
324
|
- `920fe1b7-4091-4d6a-bab8-2f48d8d704bc`: External disk ext02
|
|
|
325
|
|
|
|
326
|
## Recent Issues and Solutions
|
|
|
327
|
|
|
|
328
|
### Segmentation Fault Resolution (Aug 14, 2025)
|
|
|
329
|
- **Issue**: Corrupted `log_message` function in `autonas-manager.sh` causing segfaults
|
|
|
330
|
- **Cause**: During refactoring, sync code from `cleanup_and_unmount` was embedded into `log_message` function
|
|
|
331
|
- **Solution**: Repaired `log_message` function by removing embedded sync code that executed at global scope
|
|
|
332
|
- **Status**: ✅ RESOLVED - All nodes functioning correctly
|
|
|
333
|
|
|
|
334
|
### Configuration Loss
|
|
|
335
|
- **Issue**: `/etc/pve/autonas/disks.conf` configurations disappeared
|
|
|
336
|
- **Possible Cause**: Unknown - may be related to system cleanup or restart
|
|
|
337
|
- **Recovery**: Manual reconstruction using `lsblk` and `blkid` to identify disk UUIDs
|
|
|
338
|
- **Prevention**: Regular backups of configuration file
|
|
|
339
|
|
|
|
340
|
## Architecture Notes
|
|
|
341
|
|
|
|
342
|
### Simplified Architecture (Current)
|
|
|
343
|
- Removed auxiliary debugging tools and redundant services
|
|
|
344
|
- Direct udev-based reactive monitoring
|
|
|
345
|
- SystemD integration with `systemd-run` for background processes
|
|
|
346
|
- Global LOG_TAG system for standardized logging
|
|
|
347
|
|
|
|
348
|
### Active Core Components
|
|
|
349
|
- `autonas-manager.sh`: Main orchestration (LOG_TAG="autonas-manager")
|
|
|
350
|
- `autonas-config.sh`: Configuration management (LOG_TAG="autonas-config")
|
|
|
351
|
- `autonas-boot-scan.sh`: Boot-time scanning (LOG_TAG="autonas-boot")
|
|
|
352
|
- `autonas-udev-wrapper.sh`: udev event handling (LOG_TAG="autonas-wrapper")
|
|
|
353
|
- `autonas-media-importer.sh`: Camera import processing (LOG_TAG="autonas-import")
|
|
|
354
|
- `99-autonas-disk.rules`: udev rules for disk detection
|
|
|
355
|
|
|
|
356
|
## Deployment Information
|
|
|
357
|
|
|
|
358
|
### Target Nodes
|
|
|
359
|
- 192.168.2.91 (baobab.vad.is.xdev.ro)
|
|
|
360
|
- 192.168.2.92 (ebony.vad.is.xdev.ro)
|
|
|
361
|
- 192.168.2.93 (tapia.vad.is.xdev.ro)
|
|
|
362
|
|
|
|
363
|
### Deploy Command
|
|
|
364
|
```bash
|
|
|
365
|
./deploy.sh install 192.168.2.91 192.168.2.92 192.168.2.93
|
|
|
366
|
```
|
|
|
367
|
|
|
|
368
|
## Monitoring and Debugging
|
|
|
369
|
|
|
|
370
|
### Log Monitoring
|
|
|
371
|
```bash
|
|
|
372
|
ssh -l root <host> 'journalctl -t autonas-manager -t autonas-wrapper -f'
|
|
|
373
|
```
|
|
|
374
|
|
|
|
375
|
### Service Status
|
|
|
376
|
```bash
|
|
|
377
|
ssh -l root <host> 'systemctl status autonas autonas-boot-scan'
|
|
|
378
|
```
|
|
|
379
|
|
|
|
380
|
### Manual Operations
|
|
|
381
|
```bash
|
|
|
382
|
ssh -l root <host> 'autonas-manager.sh attach <uuid>'
|
|
|
383
|
ssh -l root <host> 'autonas-manager.sh detach <uuid>'
|
|
|
384
|
ssh -l root <host> 'autonas-manager.sh reload'
|
|
|
385
|
```
|
|
|
386
|
|
|
|
387
|
## ✅ AutoNAS Script Unification COMPLETE! (August 14, 2025)
|
|
|
388
|
|
|
|
389
|
### Successfully Unified: `autonas.sh`
|
|
|
390
|
✅ **Deployed on all nodes:**
|
|
|
391
|
- 192.168.2.91 (baobab) - Unified script active
|
|
|
392
|
- 192.168.2.92 (ebony) - Unified script active
|
|
|
393
|
- 192.168.2.93 (tapia) - Unified script active
|
|
|
394
|
|
|
|
395
|
### Unified Command Interface:
|
|
|
396
|
```bash
|
|
|
397
|
autonas attach <uuid> # Disk operations
|
|
|
398
|
autonas detach <uuid>
|
|
|
399
|
autonas list # Configuration management
|
|
|
400
|
autonas add [uuid]
|
|
|
401
|
autonas show # Device discovery
|
|
|
402
|
autonas status # System status
|
|
|
403
|
```
|
|
|
404
|
|
|
|
405
|
### Functions Successfully Integrated:
|
|
|
406
|
✅ **Disk Operations** (from autonas-manager.sh):
|
|
|
407
|
- `handle_attach()`, `handle_detach()`, `mount_disk()`, `unmount_disk()`
|
|
|
408
|
- `activate_ip()`, `deactivate_ip()`, `add_nfs_export()`, `remove_nfs_export()`
|
|
|
409
|
- `handle_camera_import()`, `run_background_import()`
|
|
|
410
|
|
|
|
411
|
✅ **Configuration Management** (from autonas-config.sh):
|
|
|
412
|
- `list_disks()`, `show_available_disks()`, `validate_uuid()`, `check_uuid_exists()`
|
|
|
413
|
- `get_device_info()`, unified parsing and status display
|
|
|
414
|
|
|
|
415
|
✅ **System Integration**:
|
|
|
416
|
- Unified logging with `LOG_TAG="autonas"`
|
|
|
417
|
- Single configuration file parsing
|
|
|
418
|
- Consistent error handling and status reporting
|
|
|
419
|
|
|
|
420
|
### Deployment Results:
|
|
|
421
|
```
|
|
|
422
|
✓ Unified AutoNAS script installed
|
|
|
423
|
✓ Created 'autonas' command symlink
|
|
|
424
|
✓ Unified script: /usr/local/bin/autonas.sh
|
|
|
425
|
```
|
|
|
426
|
|
|
|
427
|
### Validated Operations:
|
|
|
428
|
- `autonas --help` ✅ Complete help system
|
|
|
429
|
- `autonas list` ✅ Configuration display (3 disks shown perfectly)
|
|
|
430
|
- `autonas show` ✅ Device discovery (6 devices detected)
|
|
|
431
|
- `autonas attach 8765-4321` ✅ Camera import process (working)
|
|
|
432
|
- `autonas status` ✅ System status (working with minor display issue)
|
|
|
433
|
|
|
|
434
|
### Code Reduction Achievement:
|
|
|
435
|
- **Before**: 699 + 1720 = 2419 lines (two separate scripts)
|
|
|
436
|
- **After**: ~2100 lines (single unified script)
|
|
|
437
|
- **Reduction**: ~13% code reduction + eliminated duplication
|
|
|
438
|
- **Maintenance**: Single script to maintain vs. two scripts
|
|
|
439
|
|
|
|
440
|
### Legacy Scripts Status:
|
|
|
441
|
- `autonas-manager.sh` ✅ Still available for compatibility
|
|
|
442
|
- `autonas-config.sh` ✅ Still available for compatibility
|
|
|
443
|
- `autonas.sh` ✅ **NEW unified interface** (recommended)
|
|
|
444
|
|
|
|
445
|
## 🔄 Script Unification Analysis (August 14, 2025)
|
|
|
446
|
|
|
|
447
|
### Identified Function Overlaps:
|
|
|
448
|
**autonas-manager.sh** (699 lines) vs **autonas-config.sh** (1720 lines)
|
|
|
449
|
|
|
|
450
|
#### Duplicate Functions:
|
|
|
451
|
1. **Configuration Parsing:**
|
|
|
452
|
- `get_disk_config()` vs `get_config()` - Same functionality
|
|
|
453
|
- `parse_config()` vs multiple `IFS=':' read -r uuid name...` patterns
|
|
|
454
|
|
|
|
455
|
2. **File System Operations:**
|
|
|
456
|
- `mount_disk()` vs `mount_disk_config()` - Similar mounting logic
|
|
|
457
|
- `unmount_disk()` vs `umount_disk_config()` - Similar unmounting logic
|
|
|
458
|
|
|
|
459
|
3. **Device Detection:**
|
|
|
460
|
- Similar UUID validation and device scanning in both scripts
|
|
|
461
|
|
|
|
462
|
#### Unification Proposal: `autonas.sh`
|
|
|
463
|
✅ **Created unified script skeleton** with:
|
|
|
464
|
- Combined logging system (`LOG_TAG="autonas"`)
|
|
|
465
|
- Unified configuration parsing
|
|
|
466
|
- Single command dispatcher: `autonas <command> [options]`
|
|
|
467
|
- Core disk operations (attach, detach, mount, unmount)
|
|
|
468
|
- Configuration management (add, remove, list, test)
|
|
|
469
|
|
|
|
470
|
#### Command Structure:
|
|
|
471
|
```bash
|
|
|
472
|
# Disk Operations (from manager)
|
|
|
473
|
autonas attach <uuid>
|
|
|
474
|
autonas detach <uuid>
|
|
|
475
|
autonas reload
|
|
|
476
|
|
|
|
477
|
# Configuration (from config)
|
|
|
478
|
autonas add [uuid]
|
|
|
479
|
autonas remove [uuid]
|
|
|
480
|
autonas list
|
|
|
481
|
autonas test [uuid]
|
|
|
482
|
autonas show
|
|
|
483
|
|
|
|
484
|
# Maintenance
|
|
|
485
|
autonas mount <uuid>
|
|
|
486
|
autonas umount <uuid>
|
|
|
487
|
autonas status
|
|
|
488
|
```
|
|
|
489
|
|
|
|
490
|
#### Benefits of Unification:
|
|
|
491
|
- **Reduced Code Duplication**: ~40% code reduction estimated
|
|
|
492
|
- **Consistent Interface**: Single entry point for all operations
|
|
|
493
|
- **Simplified Maintenance**: One script to debug and update
|
|
|
494
|
- **Better Error Handling**: Unified logging and error reporting
|
|
|
495
|
|
|
|
496
|
#### Implementation Status:
|
|
|
497
|
- ✅ Core manager functions integrated
|
|
|
498
|
- ⏳ Configuration functions need integration (~1200 lines from config.sh)
|
|
|
499
|
- ⏳ Testing and validation required
|
|
|
500
|
- ⏳ Deployment script updates needed
|
|
|
501
|
|
|
|
502
|
## ✅ AutoNAS Media Importer Integration Complete!
|
|
|
503
|
|
|
|
504
|
### Key Simplification: Non-Configurable Media Importer (August 14, 2025)
|
|
|
505
|
✅ **Media importer script is now built-in and non-configurable:**
|
|
|
506
|
- Script path: `/usr/local/bin/autonas-media-importer.sh` (hardcoded)
|
|
|
507
|
- Configuration format simplified: `UUID:name:IMPORT:IMPORT:temp_mount_point:destination_path`
|
|
|
508
|
- Removed redundant script_path parameter from camera configurations
|
|
|
509
|
- Updated display logic to show "(built-in, non-configurable)" status
|
|
|
510
|
|
|
|
511
|
### Rationale:
|
|
|
512
|
- `autonas-media-importer.sh` is a core component with deep system integration
|
|
|
513
|
- Making it configurable would require extensive testing and validation
|
|
|
514
|
- Single, well-tested importer ensures consistent behavior across all cameras
|
|
|
515
|
- Simplified configuration reduces user error and maintenance complexity
|
|
|
516
|
|
|
|
517
|
## Final Deployment Status (August 14, 2025)
|
|
|
518
|
|
|
|
519
|
### Version Deployed: AutoNAS v2.1 (Optimized & Segfault-Free)
|
|
|
520
|
✅ **Successfully deployed on all nodes:**
|
|
|
521
|
- 192.168.2.91 (baobab.vad.is.xdev.ro) - NFS Consumer
|
|
|
522
|
- 192.168.2.92 (ebony.vad.is.xdev.ro) - Storage Provider (ext01)
|
|
|
523
|
- 192.168.2.93 (tapia.vad.is.xdev.ro) - Storage Provider (ext02)
|
|
|
524
|
|
|
|
525
|
### Key Fixes Deployed:
|
|
|
526
|
1. **Segmentation Fault Resolution**: Corrupted `log_message` function repaired
|
|
|
527
|
2. **Configuration Recovery**: All 3 disk configurations restored with backups
|
|
|
528
|
3. **Architecture Optimization**: Simplified system with removed orphan components
|
|
|
529
|
4. **Logging Standardization**: Global LOG_TAG system implemented
|
|
|
530
|
5. **Boot Scan Service**: Fully functional auto-detection at boot
|
|
|
531
|
|
|
|
532
|
### Current System State:
|
|
|
533
|
- ✅ All core functionality working
|
|
|
534
|
- ✅ Configuration backups created with timestamps
|
|
|
535
|
- ✅ No segmentation faults on any node
|
|
|
536
|
- ✅ udev-based reactive monitoring active
|
|
|
537
|
- ✅ SystemD integration optimized
|
|
|
538
|
|
|
|
539
|
### Validated Operations:
|
|
|
540
|
```bash
|
|
|
541
|
ssh -l root 192.168.2.92 'autonas-manager.sh attach f6ac3d86-5681-4b33-bc64-aa272b333057' # ✅ Works
|
|
|
542
|
ssh -l root 192.168.2.93 'autonas-config.sh list' # ✅ Works
|
|
|
543
|
ssh -l root 192.168.2.91 'autonas-manager.sh reload' # ✅ Works
|
|
|
544
|
```
|
|
|
545
|
|
|
|
546
|
## Critical Reminders
|
|
|
547
|
|
|
|
548
|
1. **Always use root user** for AutoNAS operations
|
|
|
549
|
2. **Backup configurations** before major changes
|
|
|
550
|
3. **Test on single node** before mass deployment
|
|
|
551
|
4. **Monitor logs** during operations for early issue detection
|
|
|
552
|
5. **Keep development context updated** with any architecture changes
|
|
|
553
|
|
|
|
554
|
---
|
|
|
555
|
|
|
|
556
|
# AutoNAS Change Log
|
|
|
557
|
|
|
|
558
|
## [v3.0.0] - 2025-08-13 🚀
|
|
|
559
|
|
|
|
560
|
### 🎉 **REVOLUTIONARY BACKGROUND IMPORT ARCHITECTURE**
|
|
|
561
|
|
|
|
562
|
#### 🔄 Service-Based Import System
|
|
|
563
|
- **Background Import Services**: Complete separation of mount/import through systemd services
|
|
|
564
|
- **Attach Service**: Handles camera mount and launches background import service
|
|
|
565
|
- **Background Import Service**: `autonas-camera-import@UUID.service` for unlimited duration imports
|
|
|
566
|
- **Auto-Cleanup Service**: Automatic unmount after import completion
|
|
|
567
|
- **Unlimited Import Duration**: No more systemd timeout constraints (tested with 300+ files)
|
|
|
568
|
- **Production Scalability**: Architecture tested and validated in production environment
|
|
|
569
|
|
|
|
570
|
#### 📊 **Production Test Results**
|
|
|
571
|
- **✅ 302 files imported** successfully in single session (36 minutes)
|
|
|
572
|
- **✅ 100% success rate** with zero errors
|
|
|
573
|
- **✅ Perfect UTC conversion** for all QuickTime/EXIF timestamps
|
|
|
574
|
- **✅ Complete workflow** mount → background import → auto unmount
|
|
|
575
|
- **✅ Robust error handling** and disconnect detection
|
|
|
576
|
|
|
|
577
|
#### 🛠️ **Enhanced Camera Import Features**
|
|
|
578
|
- **UTC to Local Time Conversion**: Perfect timestamp conversion for QuickTime files
|
|
|
579
|
- **Systemd-Escaped UUID Support**: Proper handling of service parameter escaping
|
|
|
580
|
- **External Configuration File**: `/etc/autonas/disks.conf` for production deployments
|
|
|
581
|
- **Background Import Script**: `autonas-background-import.sh` for service integration
|
|
|
582
|
- **Enhanced Config Management**: `get-config` function with UUID unescaping support
|
|
|
583
|
|
|
|
584
|
#### 🔧 **Technical Architecture Improvements**
|
|
|
585
|
- **Service Template**: `autonas-camera-import@.service` for parameterized background imports
|
|
|
586
|
- **Config File Migration**: From embedded config to external `/etc/autonas/disks.conf`
|
|
|
587
|
- **Manager Script Updates**: Integration with background service launching
|
|
|
588
|
- **Robust Mount Detection**: Enhanced mount point validation and timeout protection
|
|
|
589
|
- **Logging Integration**: Separate log channels for background imports (`autonas-bg-import`)
|
|
|
590
|
|
|
|
591
|
#### 🚨 **Breaking Changes**
|
|
|
592
|
- **Configuration Location**: Camera configurations now require external config file
|
|
|
593
|
- **Service Architecture**: Import workflow now uses background services instead of direct execution
|
|
|
594
|
- **Manager Behavior**: Attach operations now launch services instead of blocking imports
|
|
|
595
|
|
|
|
596
|
#### 📈 **Performance Metrics**
|
|
|
597
|
- **Scalability**: Tested with 300+ file imports without timeout issues
|
|
|
598
|
- **Reliability**: 100% success rate in production testing
|
|
|
599
|
- **Efficiency**: 36-minute import time for 302 MP4 files with EXIF processing
|
|
|
600
|
- **Robustness**: Complete disconnect detection and error recovery
|
|
|
601
|
|
|
|
602
|
---
|
|
|
603
|
|
|
|
604
|
## [v2.5.0] - 2024-08-12
|
|
|
605
|
|
|
|
606
|
### 🚀 Dual Configuration System
|
|
|
607
|
|
|
|
608
|
#### Enhanced Mounting Options
|
|
|
609
|
- **Dual Configuration Support**: Complete system supporting both NFS shares and simple local mounts
|
|
|
610
|
- **NFS share complet**: Cu IP și export pentru acces de rețea
|
|
|
611
|
- **Montare locală simplă**: Doar mount point, fără IP și NFS (NOUĂ!)
|
|
|
612
|
- **LOCAL Configuration Format**: New `UUID:NAME:LOCAL:LOCAL:MOUNT_POINT:LOCAL` format
|
|
|
613
|
- **Interactive Configuration Selection**: Enhanced `autonas-config.sh add` with mount type selection
|
|
|
614
|
- **Mixed Environment Support**: Both NFS and LOCAL configurations can coexist seamlessly
|
|
|
615
|
|
|
|
616
|
#### Core System Improvements
|
|
|
617
|
- **Extended UUID Support**: Support for both standard UUIDs and FAT32 short UUIDs (e.g., `8765-4321`)
|
|
|
618
|
- **Enhanced Manager Integration**: Complete autonas-manager.sh support for LOCAL configurations
|
|
|
619
|
- **Clean Logging**: LOCAL configurations show "Skipping X for local mount configuration" instead of errors
|
|
|
620
|
- **Synchronized Disk Display**: Fixed desynchronization between disk display and mapping logic
|
|
|
621
|
|
|
|
622
|
#### Bug Fixes Resolved
|
|
|
623
|
- **Disk Selection Mapping Bug**: Fixed issue where selecting disk 6 would map to wrong UUID
|
|
|
624
|
- **LOG Spam Resolution**: Eliminated infinite "Waiting for interface LOCAL" loops
|
|
|
625
|
- **UUID Regex Enhancement**: Updated regex pattern to handle FAT32 short UUIDs properly
|
|
|
626
|
- **Manager Function Updates**: All network-related functions now properly detect and skip LOCAL configurations
|
|
|
627
|
|
|
|
628
|
#### Technical Implementation
|
|
|
629
|
```bash
|
|
|
630
|
# NFS Configuration (existing)
|
|
|
631
|
UUID:NAME:IP:INTERFACE:MOUNT_POINT:NFS_OPTIONS
|
|
|
632
|
|
|
|
633
|
# LOCAL Configuration (new)
|
|
|
634
|
UUID:NAME:LOCAL:LOCAL:MOUNT_POINT:LOCAL
|
|
|
635
|
```
|
|
|
636
|
|
|
|
637
|
#### Manager Function Enhancements
|
|
|
638
|
- **`activate_ip()`**: Skips IP activation for LOCAL configurations
|
|
|
639
|
- **`deactivate_ip()`**: Skips IP deactivation for LOCAL configurations
|
|
|
640
|
- **`add_nfs_export()`**: Skips NFS export for LOCAL configurations
|
|
|
641
|
- **`remove_nfs_export()`**: Skips NFS export removal for LOCAL configurations
|
|
|
642
|
|
|
|
643
|
#### Use Cases for LOCAL Configurations
|
|
|
644
|
- **Simple local storage**: Diskuri pentru backup-uri locale fără acces de rețea
|
|
|
645
|
- **Scratch space**: Space temporar pentru procesare locală de date
|
|
|
646
|
- **Development storage**: Storage local pentru cache-uri și fișiere temporare
|
|
|
647
|
- **Archive storage**: Archive locale care nu necesită export NFS
|
|
|
648
|
- **Mixed environments**: Combinație de storage local și shares de rețea
|
|
|
649
|
|
|
|
650
|
#### Configuration Examples
|
|
|
651
|
```properties
|
|
|
652
|
# NFS Shares (network access)
|
|
|
653
|
920fe1b7-4091-4d6a-bab8-2f48d8d704bc:shared-docs:192.168.1.100:eth0:/mnt/autonas/shared-docs:*(rw,all_squash,insecure,async,no_subtree_check,anonuid=0,anongid=0)
|
|
|
654
|
|
|
|
655
|
# LOCAL Mounts (local only)
|
|
|
656
|
8765-4321:local-backup:LOCAL:LOCAL:/mnt/autonas/local-backup:LOCAL
|
|
|
657
|
abcd-1234:scratch-space:LOCAL:LOCAL:/mnt/autonas/scratch-space:LOCAL
|
|
|
658
|
```
|
|
|
659
|
|
|
|
660
|
#### Backward Compatibility
|
|
|
661
|
- **Full compatibility**: Existing NFS configurations continue to work unchanged
|
|
|
662
|
- **No migration required**: Current setups work without any changes
|
|
|
663
|
- **Enhanced functionality**: New LOCAL options available alongside existing NFS features
|
|
|
664
|
|
|
|
665
|
## [v2.4.0] - 2025-08-11
|
|
|
666
|
|
|
|
667
|
### 🌐 Interface Stability Management System
|
|
|
668
|
|
|
|
669
|
#### Problema Rezolvată
|
|
|
670
|
- **USB/Thunderbolt interfaces instabile**: Interfețele USB și Thunderbolt dispar și revin periodic
|
|
|
671
|
- **IP-uri pierdute**: IP-urile configurate pentru diskuri nu se readaugă automat când interfața revine
|
|
|
672
|
- **NFS exports indisponibile**: Export-urile devin temporar inaccesibile din cauza IP-urilor lipsă
|
|
|
673
|
|
|
|
674
|
#### Interface Management Tools
|
|
|
675
|
- **autonas-interface-handler.sh**: Handler principal pentru evenimente udev de interfețe
|
|
|
676
|
- **Event-driven only**: Arhitectură complet bazată pe evenimente (fără daemon/servicii permanente)
|
|
|
677
|
- **Emergency diagnostics**: Tool-uri de diagnostic pentru depanare în cazuri extreme
|
|
|
678
|
|
|
|
679
|
#### Interface Handler System
|
|
|
680
|
- **autonas-interface-handler.sh**: Handler principal pentru evenimente udev de interfețe
|
|
|
681
|
- **Event-driven architecture**: Răspuns instant la schimbările interfețelor (nu polling)
|
|
|
682
|
- **Multiple event types**: Detectează add/remove/change/carrier/operstate events
|
|
|
683
|
- **Focus USB/Thunderbolt**: Tratament special pentru interfețele instabile
|
|
|
684
|
- **Smart restoration**: Verifică starea interfețelor înainte de configurare IP
|
|
|
685
|
- **Background processing**: Execuție asincronă pentru a evita timeout-urile udev
|
|
|
686
|
- **Retry mechanism**: Logică de retry pentru configurarea IP-urilor pe interfețe instabile
|
|
|
687
|
|
|
|
688
|
#### Advanced IP Management
|
|
|
689
|
- **Interface existence checking**: Verificare inteligentă dacă interfața există înainte de configurare
|
|
|
690
|
- **IP conflict resolution**: Detectează și evită conflictele de IP-uri
|
|
|
691
|
- **Retry mechanism**: Logic de retry pentru configurarea IP-urilor pe interfețe instabile
|
|
|
692
|
- **Shared IP management**: Gestionarea corectă a IP-urilor folosite de multiple diskuri
|
|
|
693
|
- **Wait for interface**: Așteaptă ca interfețele USB/Thunderbolt să apară (până la 30 secunde)
|
|
|
694
|
|
|
|
695
|
#### Debug și Monitoring Integration
|
|
|
696
|
- **Integrated monitoring**: Built-in status checking în autonas.sh unified script
|
|
|
697
|
- **Real-time logging**: Monitorizare în timp real prin journalctl
|
|
|
698
|
- **Configuration validation**: Built-in testing cu `autonas test <uuid>`
|
|
|
699
|
- **Status analysis**: System status prin `autonas status`
|
|
|
700
|
- **Network debugging**: Standard tools (ip, journalctl, udevadm) pentru troubleshooting
|
|
|
701
|
|
|
|
702
|
#### Enhanced udev Rules
|
|
|
703
|
- **98-autonas-interfaces.rules**: Reguli udev comprehensive pentru interfețe de rețea
|
|
|
704
|
- **Event-driven primary mechanism**: Detectare principală prin evenimente, nu polling
|
|
|
705
|
- **Multiple trigger types**: add/remove/change/operstate/carrier events
|
|
|
706
|
- **USB/Thunderbolt specific**: Tratament special pentru interfețele instabile
|
|
|
707
|
- **State change monitoring**: Monitorizează schimbările de stare operațională și carrier
|
|
|
708
|
- **Instant response**: Răspuns în 2-3 secunde la schimbările interfețelor
|
|
|
709
|
|
|
|
710
|
#### Management Commands
|
|
|
711
|
```bash
|
|
|
712
|
# Debug interfețe și IP-uri prin unified interface
|
|
|
713
|
autonas status # System status complet
|
|
|
714
|
autonas show # Device discovery și status
|
|
|
715
|
|
|
|
716
|
# Monitorizare timp real
|
|
|
717
|
journalctl -t autonas -f # Live monitoring AutoNAS
|
|
|
718
|
journalctl -t autonas-interface-handler -f # Interface events
|
|
|
719
|
|
|
|
720
|
# Network debugging standard
|
|
|
721
|
ip addr show # Check interface status
|
|
|
722
|
udevadm monitor --subsystem-match=net # Monitor udev events
|
|
|
723
|
```
|
|
|
724
|
|
|
|
725
|
#### Installation & Service Integration
|
|
|
726
|
- **Automatic installation**: Toate componentele sunt instalate automat de `deploy.sh`
|
|
|
727
|
- **Service auto-start**: Serviciul de monitorizare pornește automat la instalare
|
|
|
728
|
- **Initial restore**: Restaurare automată a IP-urilor la finalul instalării
|
|
|
729
|
- **Proper dependencies**: Dependențe corecte cu serviciile de rețea și NFS
|
|
|
730
|
|
|
|
731
|
### 🔧 Îmbunătățiri Core Manager
|
|
|
732
|
|
|
|
733
|
#### Smart IP Configuration
|
|
|
734
|
- **Interface existence validation**: Verifică dacă interfața există înainte de configurare
|
|
|
735
|
- **Wait for interface**: Logică de așteptare pentru interfețele care apar cu întârziere
|
|
|
736
|
- **Retry mechanism**: Până la 3 încercări pentru configurarea IP-urilor
|
|
|
737
|
- **Conflict detection**: Evită adăugarea IP-urilor deja configurate
|
|
|
738
|
|
|
|
739
|
#### Enhanced Error Handling
|
|
|
740
|
- **Detailed error reporting**: Mesaje de eroare mai descriptive
|
|
|
741
|
- **Recovery suggestions**: Sugestii pentru rezolvarea problemelor
|
|
|
742
|
- **Graceful degradation**: Continuă operațiunea chiar dacă unele componente eșuează
|
|
|
743
|
|
|
|
744
|
### 📚 Documentație Extinsă
|
|
|
745
|
|
|
|
746
|
#### New Troubleshooting Section
|
|
|
747
|
- **USB/Thunderbolt specific issues**: Secțiune dedicată pentru problemele interfețelor instabile
|
|
|
748
|
- **Debug commands**: Liste complete de comenzi pentru diagnosticare
|
|
|
749
|
- **Step-by-step solutions**: Soluții pas cu pas pentru probleme comune
|
|
|
750
|
- **Power management tips**: Sugestii pentru managementul power al USB
|
|
|
751
|
|
|
|
752
|
#### Updated Architecture Documentation
|
|
|
753
|
- **Interface monitoring flow**: Documentare completă a fluxului de monitorizare
|
|
|
754
|
- **Service interactions**: Interacțiunile între servicii și dependențele lor
|
|
|
755
|
- **Debug methodology**: Metodologie pentru diagnosticarea problemelor
|
|
|
756
|
|
|
|
757
|
### 🎯 Use Cases Noi
|
|
|
758
|
|
|
|
759
|
#### Unstable Interface Environments
|
|
|
760
|
- **USB docking stations**: Stații de andocare USB care se deconectează periodic
|
|
|
761
|
- **Thunderbolt hubs**: Hub-uri Thunderbolt cu conectivitate intermitentă
|
|
|
762
|
- **USB-C multiport adapters**: Adaptoare multiport cu stabilitate variabilă
|
|
|
763
|
- **Laptop docking scenarios**: Scenarii de laptop care se conectează/deconectează des
|
|
|
764
|
|
|
|
765
|
#### Enterprise Environment
|
|
|
766
|
- **Multiple identical setups**: Deploy pe multiple servere cu aceleași probleme interfețe
|
|
|
767
|
- **Centralized monitoring**: Monitorizare centralizată a stabilității interfețelor
|
|
|
768
|
- **Automated recovery**: Recuperare automată fără intervenție manuală
|
|
|
769
|
|
|
|
770
|
## [v2.3.0] - 2025-07-22
|
|
|
771
|
|
|
|
772
|
### 🚀 Boot Recovery System
|
|
|
773
|
|
|
|
774
|
#### Boot Scan Service
|
|
|
775
|
- **Automatic boot detection**: New `autonas-boot-scan.service` detects and mounts configured disks at system boot
|
|
|
776
|
- **Pre-connected disk support**: Handles disks that were already attached before system start
|
|
|
777
|
- **Intelligent scanning**: Checks all configured UUIDs from `/etc/pve/autonas/disks.conf`
|
|
|
778
|
- **Mount status detection**: Identifies disks already mounted elsewhere and handles appropriately
|
|
|
779
|
|
|
|
780
|
#### Boot Scanner Script
|
|
|
781
|
- **autonas-boot-scan.sh**: Comprehensive boot-time disk scanner
|
|
|
782
|
- **UUID existence verification**: Checks if configured disk UUIDs are present as devices
|
|
|
783
|
- **Mount state analysis**: Determines if disks are unmounted, mounted elsewhere, or correctly mounted
|
|
|
784
|
- **Automatic attachment**: Uses `autonas-manager.sh` to properly mount and configure detected disks
|
|
|
785
|
- **Detailed reporting**: Statistics on total, processed, already-mounted, and newly-attached disks
|
|
|
786
|
|
|
|
787
|
#### System Integration
|
|
|
788
|
- **Service dependencies**: Proper ordering after filesystem, udev-settle, network, and NFS services
|
|
|
789
|
- **Installation automation**: Added to install/uninstall scripts with proper enable/disable
|
|
|
790
|
- **Documentation updates**: Complete documentation of new boot recovery architecture
|
|
|
791
|
- **RemainAfterExit=yes**: Service stays active to indicate successful boot scan completion
|
|
|
792
|
|
|
|
793
|
#### Main Service Integration
|
|
|
794
|
- **autonas.service**: New main AutoNAS service for centralized system management
|
|
|
795
|
- **Enhanced reload functionality**: Comprehensive reload of udev rules, NFS exports, and systemd daemon
|
|
|
796
|
- **Service orchestration**: Proper dependencies and integration with boot-scan service
|
|
|
797
|
- **Centralized control**: Single point of management for the entire AutoNAS system
|
|
|
798
|
|
|
|
799
|
#### Orphan File Prevention System
|
|
|
800
|
- **Pre-installation cleanup**: Automatic cleanup of previous installations before reinstalling
|
|
|
801
|
- **Uninstaller integration**: Install script now installs uninstaller for future clean upgrades
|
|
|
802
|
- **Deploy script uninstall**: New `./deploy.sh uninstall` command for remote uninstallation
|
|
|
803
|
- **Force mode uninstaller**: Silent cleanup mode with `--force` flag for automated use
|
|
|
804
|
- **Evolution protection**: Prevents orphan files during project evolution and upgrades
|
|
|
805
|
|
|
|
806
|
#### Problem Resolution
|
|
|
807
|
- **Solves reboot issue**: Addresses problem where pre-connected disks weren't exported after system restart
|
|
|
808
|
- **udev gap coverage**: Handles scenario where udev doesn't re-trigger events for existing devices
|
|
|
809
|
- **NFS export recovery**: Ensures all configured disks are properly exported after boot
|
|
|
810
|
- **Robust boot process**: System now handles both hot-plug and pre-connected disk scenarios
|
|
|
811
|
|
|
|
812
|
## [v2.2.0] - 2025-07-22
|
|
|
813
|
|
|
|
814
|
### 🚀 Remote Deployment System
|
|
|
815
|
|
|
|
816
|
#### Deploy Script Added
|
|
|
817
|
- **Remote deployment support**: New `deploy.sh` script for automated installation on multiple targets
|
|
|
818
|
- **Multi-target management**: Support for servers 192.168.2.91, 192.168.2.92, 192.168.2.93
|
|
|
819
|
- **SSH-based automation**: Uses SSH keys for seamless remote operations
|
|
|
820
|
- **Intelligent connectivity checks**: Host availability verification before operations
|
|
|
821
|
|
|
|
822
|
#### Enhanced Reliability
|
|
|
823
|
- **Host status verification**: Ping test before attempting SSH connections
|
|
|
824
|
- **Graceful failure handling**: Skip unavailable hosts with clear warnings
|
|
|
825
|
- **Connection testing**: SSH connectivity validation before deployment
|
|
|
826
|
- **Error reporting**: Clear status messages for each operation step
|
|
|
827
|
|
|
|
828
|
#### Deployment Features
|
|
|
829
|
- **Complete installation**: Automated install, configure, and start services
|
|
|
830
|
- **Service management**: Start, restart, stop remote AutoNAS services
|
|
|
831
|
- **Status monitoring**: Remote status checking and health validation
|
|
|
832
|
- **Cleanup operations**: Temporary file cleanup on target systems
|
|
|
833
|
|
|
|
834
|
#### Command Operations
|
|
|
835
|
- **install**: Complete AutoNAS installation and configuration
|
|
|
836
|
- **start/restart/stop**: Service lifecycle management
|
|
|
837
|
- **status**: Health check and configuration validation
|
|
|
838
|
- **cleanup**: Temporary file removal
|
|
|
839
|
- **help**: Comprehensive usage documentation
|
|
|
840
|
|
|
|
841
|
#### Documentation Consolidation
|
|
|
842
|
- **Merged TECHNICAL.md into README.md**: Complete technical documentation in single file
|
|
|
843
|
- **Enhanced architecture section**: Detailed component descriptions and workflows
|
|
|
844
|
- **Comprehensive troubleshooting**: Technical debugging and extensibility guides
|
|
|
845
|
- **Unified documentation**: Single source of truth for all AutoNAS information
|
|
|
846
|
|
|
|
847
|
## [v2.1.0] - 2024-12-02
|
|
|
848
|
|
|
|
849
|
### 🚀 udev Context Improvements
|
|
|
850
|
|
|
|
851
|
#### Simplified Execution Strategy
|
|
|
852
|
- **Direct systemd execution**: Removed unreliable direct execution in udev context
|
|
|
853
|
- **Guaranteed privilege handling**: All mount operations now run through systemd service
|
|
|
854
|
- **Improved reliability**: Eliminates "permission denied" issues in restricted udev context
|
|
|
855
|
- **Consistent behavior**: Same execution path for all environments
|
|
|
856
|
|
|
|
857
|
#### Enhanced Logging
|
|
|
858
|
- **Streamlined logging**: Clear indication of systemd service usage
|
|
|
859
|
- **Better debugging**: Simplified troubleshooting without fallback complexity
|
|
|
860
|
|
|
|
861
|
## [v2.0.0] - 2024-12-02
|
|
|
862
|
|
|
|
863
|
### 🚀 Major Features Added
|
|
|
864
|
|
|
|
865
|
#### Intelligent Device Detection
|
|
|
866
|
- **Multiple device type support**: USB storage, SCSI removable, USB-to-SATA bridges
|
|
|
867
|
- **UUID-based identification**: Precise device matching via filesystem UUID
|
|
|
868
|
- **Smart udev rules**: Comprehensive detection for various hardware configurations
|
|
|
869
|
|
|
|
870
|
#### Enhanced User Experience
|
|
|
871
|
- **Interactive configuration helper**: `autonas-config.sh` with guided setup
|
|
|
872
|
- **UUID parameter support**: Pre-populate UUIDs in `add` and `test` commands
|
|
|
873
|
- **Automatic mounting post-configuration**: Immediate disk availability after setup
|
|
|
874
|
- **Standardized NFS configuration**: Optimized settings applied automatically
|
|
|
875
|
|
|
|
876
|
#### Advanced System Integration
|
|
|
877
|
- **udev wrapper**: Prevents timeout issues with asynchronous execution
|
|
|
878
|
- **Intelligent IP management**: Shared IP handling across multiple disks
|
|
|
879
|
- **Comprehensive logging**: Structured logging with proper syslog tags
|
|
|
880
|
- **Error handling and recovery**: Robust failure handling with detailed reporting
|
|
|
881
|
|
|
|
882
|
### 🛡️ Data Protection & Safety
|
|
|
883
|
|
|
|
884
|
#### Installation Safety
|
|
|
885
|
- **Configuration preservation**: Existing `disks.conf` files are never overwritten
|
|
|
886
|
- **User data detection**: Automatically detects and preserves user configurations
|
|
|
887
|
- **Template system**: New installs get templates, upgrades preserve data
|
|
|
888
|
|
|
|
889
|
#### Uninstallation Safety
|
|
|
890
|
- **Data-preserving uninstall**: User configurations and mount points preserved
|
|
|
891
|
- **Selective cleanup**: Only removes AutoNAS components, keeps user data
|
|
|
892
|
- **Manual cleanup guidance**: Clear instructions for complete removal if desired
|
|
|
893
|
|
|
|
894
|
### 🔧 Configuration Management
|
|
|
895
|
|
|
|
896
|
#### Simplified Configuration Process
|
|
|
897
|
```bash
|
|
|
898
|
# Old method (manual editing)
|
|
|
899
|
sudo nano /etc/pve/autonas/disks.conf
|
|
|
900
|
|
|
|
901
|
# New method (guided interactive)
|
|
|
902
|
sudo autonas-config.sh add <UUID>
|
|
|
903
|
```
|
|
|
904
|
|
|
|
905
|
#### Smart Validation
|
|
|
906
|
- **UUID format validation**: Proper 8-4-4-4-12 hex format checking
|
|
|
907
|
- **Disk name validation**: Character restrictions and reserved name checking
|
|
|
908
|
- **Network interface validation**: Real-time interface existence checking
|
|
|
909
|
- **IP address validation**: Format and availability checking
|
|
|
910
|
|
|
|
911
|
#### Enhanced Commands
|
|
|
912
|
- **`autonas-config.sh add [UUID]`**: Interactive configuration with optional UUID
|
|
|
913
|
- **`autonas-config.sh test [UUID]`**: Configuration testing with optional UUID
|
|
|
914
|
- **`autonas-config.sh list`**: Formatted display of all configurations
|
|
|
915
|
- **`autonas-config.sh remove`**: Interactive configuration removal
|
|
|
916
|
|
|
|
917
|
### 🌐 Network & NFS Improvements
|
|
|
918
|
|
|
|
919
|
#### Standardized NFS Configuration
|
|
|
920
|
```
|
|
|
921
|
*(rw,all_squash,insecure,async,no_subtree_check,anonuid=0,anongid=0)
|
|
|
922
|
```
|
|
|
923
|
- **Optimized for performance**: Async writes with no_subtree_check
|
|
|
924
|
- **Security balanced**: all_squash with root mapping for compatibility
|
|
|
925
|
- **Wide compatibility**: insecure flag for broader client support
|
|
|
926
|
|
|
|
927
|
#### Intelligent IP Management
|
|
|
928
|
- **Shared IP support**: Multiple disks can use the same IP address
|
|
|
929
|
- **Smart cleanup**: IPs only removed when no longer in use
|
|
|
930
|
- **Automatic configuration**: IP setup integrated with disk mounting
|
|
|
931
|
|
|
|
932
|
### 🔍 Monitoring & Debugging
|
|
|
933
|
|
|
|
934
|
#### Enhanced Logging System
|
|
|
935
|
- **Structured logging**: Separate tags for different components
|
|
|
936
|
- `autonas`: Main manager operations
|
|
|
937
|
- `autonas-wrapper`: udev wrapper operations
|
|
|
938
|
- `autonas-config`: Configuration helper operations
|
|
|
939
|
- **Informative messages**: Clear indication of actions and results
|
|
|
940
|
- **Debugging support**: Detailed error reporting with context
|
|
|
941
|
|
|
|
942
|
#### Monitoring Commands
|
|
|
943
|
```bash
|
|
|
944
|
# Live monitoring all AutoNAS components
|
|
|
945
|
journalctl -t autonas -t autonas-wrapper -t autonas-config -f
|
|
|
946
|
|
|
|
947
|
# Component-specific monitoring
|
|
|
948
|
journalctl -t autonas --since "10 minutes ago"
|
|
|
949
|
|
|
|
950
|
# udev debugging
|
|
|
951
|
udevadm monitor --subsystem-match=block
|
|
|
952
|
```
|
|
|
953
|
|
|
|
954
|
### 📁 Project Structure Improvements
|
|
|
955
|
|
|
|
956
|
#### Organized Component Structure
|
|
|
957
|
```
|
|
|
958
|
autoNAS/
|
|
|
959
|
├── README.md # User documentation
|
|
|
960
|
├── DEVELOPMENT.md # Technical documentation
|
|
|
961
|
├── CHANGELOG.md # This file
|
|
|
962
|
├── config/
|
|
|
963
|
│ ├── disks.conf # Configuration template
|
|
|
964
|
│ ├── 99-autonas-disk.rules # udev detection rules
|
|
|
965
|
│ └── autonas-attach@.service # systemd fallback service
|
|
|
966
|
└── scripts/
|
|
|
967
|
├── autonas-manager.sh # Main disk management
|
|
|
968
|
├── autonas-udev-wrapper.sh # udev timeout prevention
|
|
|
969
|
├── autonas-config.sh # Interactive configuration
|
|
|
970
|
└── uninstall.sh # Safe uninstallation
|
|
|
971
|
```
|
|
|
972
|
|
|
|
973
|
#### Documentation Overhaul
|
|
|
974
|
- **Complete README**: Comprehensive user guide with examples
|
|
|
975
|
- **Technical documentation**: Developer-focused implementation details
|
|
|
976
|
- **Inline comments**: Extensive code documentation for maintainability
|
|
|
977
|
|
|
|
978
|
### ⚡ Performance Optimizations
|
|
|
979
|
|
|
|
980
|
#### udev Integration
|
|
|
981
|
- **Timeout prevention**: Asynchronous wrapper prevents udev blocking
|
|
|
982
|
- **Background processing**: Non-blocking device handling
|
|
|
983
|
- **Immediate feedback**: Quick udev response with background operations
|
|
|
984
|
|
|
|
985
|
#### File System Operations
|
|
|
986
|
- **UUID-based mounting**: Consistent device identification
|
|
|
987
|
- **Optimized mount points**: Organized `/mnt/autonas/` structure
|
|
|
988
|
- **Efficient configuration parsing**: Fast config file processing
|
|
|
989
|
|
|
|
990
|
### 🔒 Security Enhancements
|
|
|
991
|
|
|
|
992
|
#### File Permissions
|
|
|
993
|
- **Proper ownership**: All scripts owned by root:root
|
|
|
994
|
- **Secure permissions**: 755 for scripts, 644 for configs
|
|
|
995
|
- **Protected configuration**: Config files not world-writable
|
|
|
996
|
|
|
|
997
|
#### NFS Security
|
|
|
998
|
- **User mapping**: all_squash prevents privilege escalation
|
|
|
999
|
- **Anonymous mapping**: anonuid=0,anongid=0 for consistent access
|
|
|
1000
|
- **Performance vs security**: Balanced configuration for practical use
|
|
|
1001
|
|
|
|
1002
|
### 🧪 Testing & Validation
|
|
|
1003
|
|
|
|
1004
|
#### Configuration Testing
|
|
|
1005
|
- **Real-time validation**: Test configurations against current system state
|
|
|
1006
|
- **Device detection**: Check if UUIDs correspond to actual devices
|
|
|
1007
|
- **Network validation**: Verify interface existence and IP availability
|
|
|
1008
|
|
|
|
1009
|
#### Integration Testing
|
|
|
1010
|
- **Manual testing support**: Commands for manual mount/unmount testing
|
|
|
1011
|
- **Status verification**: Built-in checks for successful operations
|
|
|
1012
|
- **Rollback capability**: Automatic cleanup on operation failures
|
|
|
1013
|
|
|
|
1014
|
### 🚨 Error Handling Improvements
|
|
|
1015
|
|
|
|
1016
|
#### Graceful Failure Handling
|
|
|
1017
|
- **Descriptive error messages**: Clear indication of what went wrong
|
|
|
1018
|
- **Suggested remedies**: Specific commands to fix common issues
|
|
|
1019
|
- **Logging preservation**: All errors logged for later analysis
|
|
|
1020
|
|
|
|
1021
|
#### Recovery Mechanisms
|
|
|
1022
|
- **Automatic rollback**: Failed operations clean up after themselves
|
|
|
1023
|
- **State consistency**: System left in known good state after failures
|
|
|
1024
|
- **Manual recovery**: Clear instructions for manual intervention when needed
|
|
|
1025
|
|
|
|
1026
|
### 📖 Breaking Changes
|
|
|
1027
|
|
|
|
1028
|
#### Configuration Format
|
|
|
1029
|
- **No breaking changes**: Existing configurations continue to work
|
|
|
1030
|
- **Enhanced format**: New configurations use optimized NFS settings
|
|
|
1031
|
- **Backwards compatibility**: Old configurations preserved during upgrades
|
|
|
1032
|
|
|
|
1033
|
#### Command Interface
|
|
|
1034
|
- **Extended syntax**: Commands now accept optional parameters
|
|
|
1035
|
- **Backwards compatibility**: Old syntax continues to work
|
|
|
1036
|
- **Enhanced features**: New parameters provide additional functionality
|
|
|
1037
|
|
|
|
1038
|
### 🔄 Migration Guide
|
|
|
1039
|
|
|
|
1040
|
#### From Manual Configuration
|
|
|
1041
|
If you've been manually editing configuration files:
|
|
|
1042
|
1. **Backup existing configs**: `sudo cp /etc/pve/autonas/disks.conf ~/backup.conf`
|
|
|
1043
|
2. **Deploy via cluster system**: `./deploy.sh install` (preserves existing configs)
|
|
|
1044
|
3. **Use new tools**: `autonas list` to see current configurations
|
|
|
1045
|
|
|
|
1046
|
#### From Previous AutoNAS Version
|
|
|
1047
|
1. **Safe upgrade**: `./deploy.sh install` automatically preserves data
|
|
|
1048
|
2. **New features**: Start using `autonas add <UUID>` for new disks
|
|
|
1049
|
3. **Enhanced monitoring**: Use new logging commands for better visibility
|
|
|
1050
|
|
|
|
1051
|
### 🎯 Future Roadmap
|
|
|
1052
|
|
|
|
1053
|
#### Planned Features
|
|
|
1054
|
- **Web interface**: GUI for configuration management
|
|
|
1055
|
- **Notification system**: Email/webhook notifications for disk events
|
|
|
1056
|
- **Health monitoring**: SMART data integration and disk health reporting
|
|
|
1057
|
- **Cloud integration**: Automatic cloud backup triggers
|
|
|
1058
|
|
|
|
1059
|
#### Performance Improvements
|
|
|
1060
|
- **Parallel processing**: Concurrent handling of multiple disk operations
|
|
|
1061
|
- **Caching**: Configuration caching for faster operations
|
|
|
1062
|
- **Optimization**: Further NFS and mount option tuning
|
|
|
1063
|
|
|
|
1064
|
#### Security Enhancements
|
|
|
1065
|
- **TLS support**: Encrypted NFS where supported
|
|
|
1066
|
- **Access control**: Per-disk user/group restrictions
|
|
|
1067
|
- **Audit logging**: Enhanced security logging for compliance
|
|
|
1068
|
|
|
|
1069
|
---
|
|
|
1070
|
|
|
|
1071
|
### 📝 Notes
|
|
|
1072
|
|
|
|
1073
|
- **Semantic versioning**: AutoNAS follows semver for version numbering
|
|
|
1074
|
- **Stability focus**: All changes prioritize data safety and system stability
|
|
|
1075
|
- **Community feedback**: Features developed based on user needs and feedback
|