Showing 7 changed files with 149 additions and 285 deletions
+14 -1
CHANGELOG.md
@@ -1,5 +1,18 @@
1 1
 # AutoNAS - Change Log
2 2
 
3
+## [v3.0.1] - 2026-03-02
4
+
5
+### 🔧 CLI Simplification
6
+
7
+#### Removed Redundant Disk Commands
8
+- **Removed** `autonas mount` and `autonas unmount/umount` from user-facing CLI
9
+- **Standardized disk operations** on `autonas attach` and `autonas detach`
10
+- **Updated help output and documentation** to reflect the simplified command set
11
+
12
+#### Why This Change
13
+- Reduced command redundancy and ambiguity between attach/detach vs mount/unmount
14
+- Clearer operational model for both manual and automated workflows
15
+
3 16
 ## [v3.0.0] - 2025-08-15 🚀
4 17
 
5 18
 ### 🎉 **CLEAN USER INTERFACE & SCRIPT ORGANIZATION**
@@ -538,4 +551,4 @@ If you've been manually editing configuration files:
538 551
 - **Community feedback**: Features developed based on user needs and feedback
539 552
 
540 553
 For detailed technical information, see [TECHNICAL.md](TECHNICAL.md).
541
-For user documentation, see [README.md](README.md).
554
+For user documentation, see [README.md](README.md).
+0 -2
DEVELOPMENT.md
@@ -482,8 +482,6 @@ autonas test [uuid]
482 482
 autonas show
483 483
 
484 484
 # Maintenance
485
-autonas mount <uuid>
486
-autonas umount <uuid>
487 485
 autonas status
488 486
 ```
489 487
 
+1 -0
Madagascar
@@ -0,0 +1 @@
1
+/Users/bogdan/Documents/Workspaces/Xdev/Madagascar
+4 -6
README.md
@@ -20,8 +20,8 @@ autonas <command> [options]
20 20
 ### Operațiuni Disponibile
21 21
 ```bash
22 22
 # Operațiuni Diskuri
23
-autonas attach <uuid>         # Montează disk automat
24
-autonas detach <uuid>         # Demontează disk
23
+autonas attach <uuid|name|mount_point>   # Montează disk automat
24
+autonas detach <uuid|name|mount_point>   # Demontează disk
25 25
 autonas list                  # Listează diskurile configurate
26 26
 
27 27
 # Management Configurații  
@@ -30,8 +30,6 @@ autonas show                  # Afișează toate device-urile detectate
30 30
 autonas status               # Status sistem complet
31 31
 
32 32
 # Utilități
33
-autonas mount <uuid>         # Montare manuală
34
-autonas umount <uuid>        # Demontare manuală
35 33
 autonas --help              # Ajutor complet
36 34
 ```
37 35
 
@@ -213,7 +211,7 @@ systemctl status nfs-kernel-server
213 211
 ### Probleme de Montare
214 212
 ```bash
215 213
 autonas list                   # Verifică configurațiile
216
-autonas test <uuid>           # Testează configurația specifică
214
+autonas test <uuid|name|mount_point>  # Testează configurația specifică
217 215
 mount | grep autonas          # Verifică mount-urile active
218 216
 ```
219 217
 
@@ -391,4 +389,4 @@ autonas-camera-import.sh /mnt/camera /dest/path camera-name --dry-run --verbose
391 389
 
392 390
 *Doar comanda `autonas` vizibilă - interfață profesională și curată*
393 391
 
394
-*Dezvoltat pentru ecosistemul Proxmox/Debian cu focus pe automatizare și siguranța datelor*
392
+*Dezvoltat pentru ecosistemul Proxmox/Debian cu focus pe automatizare și siguranța datelor*
+58 -33
scripts/autonas-core.sh
@@ -96,6 +96,33 @@ get_config_by_name() {
96 96
     grep ":${name}:" "$CONFIG_FILE" 2>/dev/null
97 97
 }
98 98
 
99
+# Function to get configuration for a specific mount point
100
+get_config_by_mount_point() {
101
+    local mount_point="$1"
102
+
103
+    if [ -z "$mount_point" ] || [ ! -f "$CONFIG_FILE" ]; then
104
+        return 1
105
+    fi
106
+
107
+    awk -F':' -v target="$mount_point" '
108
+        $1 !~ /^[[:space:]]*#/ && $5 == target { print; exit }
109
+    ' "$CONFIG_FILE" 2>/dev/null
110
+}
111
+
112
+# Resolve an entry identifier as UUID, name, or mount point
113
+resolve_config_identifier() {
114
+    local identifier="$1"
115
+
116
+    if [ -z "$identifier" ]; then
117
+        return 1
118
+    fi
119
+
120
+    # Try UUID first (supports escaped UUIDs from systemd), then name, then mount point.
121
+    get_config "$identifier" \
122
+        || get_config_by_name "$identifier" \
123
+        || get_config_by_mount_point "$identifier"
124
+}
125
+
99 126
 # ============================================================================
100 127
 # VALIDATION FUNCTIONS
101 128
 # ============================================================================
@@ -880,22 +907,20 @@ cleanup_and_unmount() {
880 907
 
881 908
 # Function to handle disk attachment
882 909
 handle_attach() {
883
-    local uuid="$1"
884
-    
885
-    log_message "AutoNAS attach operation started for UUID: $uuid"
886
-    
887
-    # Get configuration for this UUID
910
+    local identifier="$1"
911
+
912
+    log_message "AutoNAS attach operation started for identifier: $identifier"
913
+
914
+    # Get configuration by UUID, name, or mount point
888 915
     local config
889
-    config=$(get_disk_config "$uuid")
890
-    
916
+    config=$(resolve_config_identifier "$identifier")
917
+
891 918
     if [[ -z "$config" ]]; then
892
-        log_message "No configuration found for UUID: $uuid - disk will be ignored"
919
+        log_message "No configuration found for identifier: $identifier - disk will be ignored"
893 920
         log_message "To configure this disk, run: autonas add"
894 921
         return 1
895 922
     fi
896
-    
897
-    log_message "Handling disk attachment for UUID: $uuid"
898
-    
923
+
899 924
     # Parse configuration
900 925
     local parsed
901 926
     parsed=($(parse_config "$config"))
@@ -905,18 +930,19 @@ handle_attach() {
905 930
     local interface="${parsed[3]}"
906 931
     local mount_point="${parsed[4]}"
907 932
     local nfs_options="${parsed[5]}"
908
-    
933
+
934
+    log_message "Handling disk attachment for UUID: $cfg_uuid"
909 935
     log_message "Processing disk: $name (IP: $ip, Mount: $mount_point)"
910
-    
936
+
911 937
     # Handle different disk types
912 938
     if [[ "$ip" == "IMPORT" && "$interface" == "IMPORT" ]]; then
913 939
         # Camera import workflow: mount temporarily, import, then unmount
914
-        log_message "Detected camera import configuration for UUID: $uuid"
915
-        
940
+        log_message "Detected camera import configuration for UUID: $cfg_uuid"
941
+
916 942
         # Mount disk for import
917
-        if mount_disk "$uuid" "$mount_point"; then
943
+        if mount_disk "$cfg_uuid" "$mount_point"; then
918 944
             # Start import process
919
-            handle_camera_import "$uuid" "$mount_point" "$nfs_options"
945
+            handle_camera_import "$cfg_uuid" "$mount_point" "$nfs_options"
920 946
             return $?
921 947
         else
922 948
             log_message "Error: Failed to mount camera device" "err"
@@ -924,7 +950,7 @@ handle_attach() {
924 950
         fi
925 951
     elif [[ "$ip" == "LOCAL" ]]; then
926 952
         # Local mount only (no network sharing)
927
-        if mount_disk "$uuid" "$mount_point"; then
953
+        if mount_disk "$cfg_uuid" "$mount_point"; then
928 954
             log_message "Local disk mounted successfully at $mount_point"
929 955
             return 0
930 956
         else
@@ -933,8 +959,8 @@ handle_attach() {
933 959
     else
934 960
         # Regular NFS workflow: activate IP, mount, export via NFS
935 961
         if activate_ip "$ip" "$interface"; then
936
-            if mount_disk "$uuid" "$mount_point"; then
937
-                if add_nfs_export "$mount_point" "$nfs_options" "$uuid" "$name"; then
962
+            if mount_disk "$cfg_uuid" "$mount_point"; then
963
+                if add_nfs_export "$mount_point" "$nfs_options" "$cfg_uuid" "$name"; then
938 964
                     log_message "Disk attached successfully: $name"
939 965
                     return 0
940 966
                 else
@@ -953,21 +979,19 @@ handle_attach() {
953 979
 
954 980
 # Function to handle disk detachment
955 981
 handle_detach() {
956
-    local uuid="$1"
957
-    
958
-    log_message "AutoNAS detach operation started for UUID: $uuid"
959
-    
960
-    # Get configuration for this UUID
982
+    local identifier="$1"
983
+
984
+    log_message "AutoNAS detach operation started for identifier: $identifier"
985
+
986
+    # Get configuration by UUID, name, or mount point
961 987
     local config
962
-    config=$(get_disk_config "$uuid")
963
-    
988
+    config=$(resolve_config_identifier "$identifier")
989
+
964 990
     if [[ -z "$config" ]]; then
965
-        log_message "No configuration found for UUID: $uuid"
991
+        log_message "No configuration found for identifier: $identifier"
966 992
         return 1
967 993
     fi
968
-    
969
-    log_message "Handling disk detachment for UUID: $uuid"
970
-    
994
+
971 995
     # Parse configuration
972 996
     local parsed
973 997
     parsed=($(parse_config "$config"))
@@ -977,12 +1001,13 @@ handle_detach() {
977 1001
     local interface="${parsed[3]}"
978 1002
     local mount_point="${parsed[4]}"
979 1003
     local nfs_options="${parsed[5]}"
980
-    
1004
+
1005
+    log_message "Handling disk detachment for UUID: $cfg_uuid"
981 1006
     log_message "Processing disk: $name (Mount: $mount_point)"
982 1007
     
983 1008
     # Remove NFS export (if applicable)
984 1009
     if [[ "$ip" != "LOCAL" && "$ip" != "IMPORT" ]]; then
985
-        remove_nfs_export "$mount_point" "$uuid" "$name" "$nfs_options"
1010
+        remove_nfs_export "$mount_point" "$cfg_uuid" "$name" "$nfs_options"
986 1011
     fi
987 1012
     
988 1013
     # Unmount disk
+9 -22
scripts/autonas-disk-handler.sh
@@ -34,27 +34,15 @@ case "$1" in
34 34
         ;;
35 35
     "detach")
36 36
         if [ -z "$2" ]; then
37
-            log_message "Error: UUID or disk name required for detach operation" "err"
37
+            log_message "Error: UUID, disk name, or mount point required for detach operation" "err"
38 38
             exit 1
39 39
         fi
40 40
         log_message "AutoNAS detach operation started for identifier: $2" "info"
41
-        
42
-        # Check if identifier is UUID (contains hyphens and matches UUID pattern) or name
43
-        if [[ "$2" =~ ^[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}$ ]] || [[ "$2" =~ ^[0-9a-fA-F]{4}-[0-9a-fA-F]{4}$ ]]; then
44
-            # It's a UUID - use directly
45
-            handle_detach "$2"
46
-        else
47
-            # It's a name - get UUID from config
48
-            local config_line
49
-            config_line=$(get_config_by_name "$2" 2>/dev/null)
50
-            if [ -n "$config_line" ]; then
51
-                local uuid=$(echo "$config_line" | cut -d: -f1)
52
-                handle_detach "$uuid"
53
-            else
54
-                log_message "No configuration found for name: $2 - detach skipped" "info"
55
-                log_message "This may be normal if the disk was not configured for AutoNAS" "info"
56
-                exit 0
57
-            fi
41
+
42
+        if ! handle_detach "$2"; then
43
+            log_message "No configuration found for identifier: $2 - detach skipped" "info"
44
+            log_message "This may be normal if the disk was not configured for AutoNAS" "info"
45
+            exit 0
58 46
         fi
59 47
         ;;
60 48
     "import")
@@ -69,14 +57,13 @@ case "$1" in
69 57
         handle_reload
70 58
         ;;
71 59
     *)
72
-        echo "Usage: $0 {attach|attach-deferred|detach|import|reload} <UUID|name> [args...]"
60
+        echo "Usage: $0 {attach|attach-deferred|detach|import|reload} <UUID|name|mount_point> [args...]"
73 61
         echo "  attach <UUID>         - Attach disk by UUID (direct)"
74 62
         echo "  attach-deferred <UUID> - Attach disk by UUID (via systemd)"
75
-        echo "  detach <UUID>         - Detach disk by UUID (via udev)"
76
-        echo "  detach <name>         - Detach disk by name (for manual/clean unmount)"
63
+        echo "  detach <UUID|name|mount_point> - Detach configured disk"
77 64
         echo "  import <UUID> <mount> <dest> [script] - Run background camera import"
78 65
         echo "This script is typically called by udev rules or systemd"
79 66
         log_message "Invalid arguments provided: $*" "err"
80 67
         exit 1
81 68
         ;;
82
-esac
69
+esac
+63 -221
scripts/autonas.sh
@@ -14,22 +14,20 @@ fi
14 14
 
15 15
 # Function to handle disk attachment
16 16
 handle_attach() {
17
-    local uuid="$1"
18
-    
19
-    log_message "AutoNAS attach operation started for UUID: $uuid"
20
-    
21
-    # Get configuration for this UUID
17
+    local identifier="$1"
18
+
19
+    log_message "AutoNAS attach operation started for identifier: $identifier"
20
+
21
+    # Get configuration by UUID, name, or mount point
22 22
     local config
23
-    config=$(get_disk_config "$uuid")
24
-    
23
+    config=$(resolve_config_identifier "$identifier")
24
+
25 25
     if [[ -z "$config" ]]; then
26
-        log_message "No configuration found for UUID: $uuid - disk will be ignored"
26
+        log_message "No configuration found for identifier: $identifier - disk will be ignored"
27 27
         log_message "To configure this disk, run: autonas-config.sh add"
28 28
         return 1
29 29
     fi
30
-    
31
-    log_message "Handling disk attachment for UUID: $uuid"
32
-    
30
+
33 31
     # Parse configuration
34 32
     local parsed
35 33
     parsed=($(parse_config "$config"))
@@ -39,18 +37,19 @@ handle_attach() {
39 37
     local interface="${parsed[3]}"
40 38
     local mount_point="${parsed[4]}"
41 39
     local nfs_options="${parsed[5]}"
42
-    
40
+
41
+    log_message "Handling disk attachment for UUID: $cfg_uuid"
43 42
     log_message "Processing disk: $name (IP: $ip, Mount: $mount_point)"
44
-    
43
+
45 44
     # Handle different disk types
46 45
     if [[ "$ip" == "IMPORT" && "$interface" == "IMPORT" ]]; then
47 46
         # Camera import workflow: mount temporarily, import, then unmount
48
-        log_message "Detected camera import configuration for UUID: $uuid"
49
-        
47
+        log_message "Detected camera import configuration for UUID: $cfg_uuid"
48
+
50 49
         # Mount disk for import
51
-        if mount_disk "$uuid" "$mount_point"; then
50
+        if mount_disk "$cfg_uuid" "$mount_point"; then
52 51
             # Start import process
53
-            handle_camera_import "$uuid" "$mount_point" "$nfs_options"
52
+            handle_camera_import "$cfg_uuid" "$mount_point" "$nfs_options"
54 53
             return $?
55 54
         else
56 55
             log_message "Error: Failed to mount camera device" "err"
@@ -58,7 +57,7 @@ handle_attach() {
58 57
         fi
59 58
     elif [[ "$ip" == "LOCAL" ]]; then
60 59
         # Local mount only (no network sharing)
61
-        if mount_disk "$uuid" "$mount_point"; then
60
+        if mount_disk "$cfg_uuid" "$mount_point"; then
62 61
             log_message "Local disk mounted successfully at $mount_point"
63 62
             return 0
64 63
         else
@@ -67,7 +66,7 @@ handle_attach() {
67 66
     else
68 67
         # Regular NFS workflow: activate IP, mount, export via NFS
69 68
         if activate_ip "$ip" "$interface"; then
70
-            if mount_disk "$uuid" "$mount_point"; then
69
+            if mount_disk "$cfg_uuid" "$mount_point"; then
71 70
                 if add_nfs_export "$mount_point" "$nfs_options"; then
72 71
                     log_message "Disk attached successfully: $name"
73 72
                     return 0
@@ -87,21 +86,19 @@ handle_attach() {
87 86
 
88 87
 # Function to handle disk detachment
89 88
 handle_detach() {
90
-    local uuid="$1"
91
-    
92
-    log_message "AutoNAS detach operation started for UUID: $uuid"
93
-    
94
-    # Get configuration for this UUID
89
+    local identifier="$1"
90
+
91
+    log_message "AutoNAS detach operation started for identifier: $identifier"
92
+
93
+    # Get configuration by UUID, name, or mount point
95 94
     local config
96
-    config=$(get_disk_config "$uuid")
97
-    
95
+    config=$(resolve_config_identifier "$identifier")
96
+
98 97
     if [[ -z "$config" ]]; then
99
-        log_message "No configuration found for UUID: $uuid"
98
+        log_message "No configuration found for identifier: $identifier"
100 99
         return 1
101 100
     fi
102
-    
103
-    log_message "Handling disk detachment for UUID: $uuid"
104
-    
101
+
105 102
     # Parse configuration
106 103
     local parsed
107 104
     parsed=($(parse_config "$config"))
@@ -111,7 +108,8 @@ handle_detach() {
111 108
     local interface="${parsed[3]}"
112 109
     local mount_point="${parsed[4]}"
113 110
     local nfs_options="${parsed[5]}"
114
-    
111
+
112
+    log_message "Handling disk detachment for UUID: $cfg_uuid"
115 113
     log_message "Processing disk: $name (Mount: $mount_point)"
116 114
     
117 115
     # Remove NFS export (if applicable)
@@ -152,147 +150,6 @@ handle_reload() {
152 150
     return 0
153 151
 }
154 152
 
155
-# Function to manually mount a configured disk
156
-handle_manual_mount() {
157
-    local identifier="$1"  # UUID or name
158
-    
159
-    if [[ -z "$identifier" ]]; then
160
-        echo "Error: UUID or disk name required"
161
-        return 1
162
-    fi
163
-    
164
-    echo "Looking for disk configuration: $identifier"
165
-    
166
-    # Try to find configuration by UUID first, then by name
167
-    local config
168
-    config=$(get_disk_config "$identifier") || config=$(get_config_by_name "$identifier")
169
-    
170
-    if [[ -z "$config" ]]; then
171
-        echo "Error: No configuration found for '$identifier'"
172
-        echo "Use 'autonas list' to see configured disks"
173
-        return 1
174
-    fi
175
-    
176
-    # Parse configuration
177
-    local parsed
178
-    parsed=($(parse_config "$config"))
179
-    local uuid="${parsed[0]}"
180
-    local name="${parsed[1]}"
181
-    local ip="${parsed[2]}"
182
-    local interface="${parsed[3]}"
183
-    local mount_point="${parsed[4]}"
184
-    local nfs_options="${parsed[5]}"
185
-    
186
-    echo "Found configuration: $name (UUID: $uuid)"
187
-    
188
-    # Check if already mounted
189
-    if mountpoint -q "$mount_point" 2>/dev/null; then
190
-        echo "✅ Disk already mounted at: $mount_point"
191
-        return 0
192
-    fi
193
-    
194
-    # Handle different disk types for mounting
195
-    if [[ "$ip" == "IMPORT" ]]; then
196
-        echo "⚠️  Camera import disks are not meant for manual mounting"
197
-        echo "   They are automatically imported when connected"
198
-        return 1
199
-    elif [[ "$ip" == "LOCAL" ]]; then
200
-        # Local mount only
201
-        echo "🔵 Mounting local disk..."
202
-        if mount_disk "$uuid" "$mount_point"; then
203
-            echo "✅ Local disk mounted successfully at: $mount_point"
204
-            return 0
205
-        else
206
-            echo "❌ Failed to mount local disk"
207
-            return 1
208
-        fi
209
-    else
210
-        # Network mount - need to activate IP first
211
-        echo "🌐 Mounting network disk..."
212
-        if activate_ip "$ip" "$interface"; then
213
-            if mount_disk "$uuid" "$mount_point"; then
214
-                if add_nfs_export "$mount_point" "$nfs_options" "$uuid" "$name"; then
215
-                    echo "✅ Network disk mounted and exported successfully"
216
-                    echo "   Mount point: $mount_point"
217
-                    echo "   NFS export: $mount_point $nfs_options"
218
-                    return 0
219
-                else
220
-                    echo "⚠️  Disk mounted but NFS export failed"
221
-                    return 1
222
-                fi
223
-            else
224
-                deactivate_ip "$ip" "$interface"
225
-                echo "❌ Failed to mount network disk"
226
-                return 1
227
-            fi
228
-        else
229
-            echo "❌ Failed to activate network interface"
230
-            return 1
231
-        fi
232
-    fi
233
-}
234
-
235
-# Function to manually unmount a configured disk
236
-handle_manual_unmount() {
237
-    local identifier="$1"  # UUID or name
238
-    
239
-    if [[ -z "$identifier" ]]; then
240
-        echo "Error: UUID or disk name required"
241
-        return 1
242
-    fi
243
-    
244
-    echo "Looking for disk configuration: $identifier"
245
-    
246
-    # Try to find configuration by UUID first, then by name  
247
-    local config
248
-    config=$(get_disk_config "$identifier") || config=$(get_config_by_name "$identifier")
249
-    
250
-    if [[ -z "$config" ]]; then
251
-        echo "Error: No configuration found for '$identifier'"
252
-        echo "Use 'autonas list' to see configured disks"
253
-        return 1
254
-    fi
255
-    
256
-    # Parse configuration
257
-    local parsed
258
-    parsed=($(parse_config "$config"))
259
-    local uuid="${parsed[0]}"
260
-    local name="${parsed[1]}"
261
-    local ip="${parsed[2]}"
262
-    local interface="${parsed[3]}"
263
-    local mount_point="${parsed[4]}"
264
-    local nfs_options="${parsed[5]}"
265
-    
266
-    echo "Found configuration: $name (UUID: $uuid)"
267
-    
268
-    # Check if actually mounted
269
-    if ! mountpoint -q "$mount_point" 2>/dev/null; then
270
-        echo "ℹ️  Disk is not currently mounted: $mount_point"
271
-        return 0
272
-    fi
273
-    
274
-    echo "🔽 Unmounting disk..."
275
-    
276
-    # Remove NFS export first (if applicable)
277
-    if [[ "$ip" != "LOCAL" && "$ip" != "IMPORT" ]]; then
278
-        remove_nfs_export "$mount_point" "$uuid" "$name" "$nfs_options"
279
-    fi
280
-    
281
-    # Unmount disk
282
-    if unmount_disk "$mount_point"; then
283
-        # Deactivate IP if network disk
284
-        if [[ "$ip" != "LOCAL" && "$ip" != "IMPORT" ]]; then
285
-            deactivate_ip "$ip" "$interface"
286
-        fi
287
-        
288
-        echo "✅ Disk unmounted successfully: $name"
289
-        return 0
290
-    else
291
-        echo "❌ Failed to unmount disk: $name"
292
-        return 1
293
-    fi
294
-}
295
-
296 153
 # Show usage information
297 154
 show_usage() {
298 155
     cat << EOF
@@ -301,18 +158,16 @@ AutoNAS - Unified AutoNAS Management Tool
301 158
 Usage: $0 <command> [options]
302 159
 
303 160
 DISK OPERATIONS:
304
-  attach <uuid>              - Attach disk with specified UUID
305
-  detach <uuid>              - Detach disk with specified UUID
306
-  mount <uuid|name>          - Manually mount configured disk
307
-  unmount <uuid|name>        - Manually unmount configured disk
161
+  attach <uuid|name|mount>   - Attach configured disk
162
+  detach <uuid|name|mount>   - Detach configured disk
308 163
   import <uuid> <source> <dest> [script] - Run background import (internal use)
309 164
   reload                     - Reload AutoNAS configuration
310 165
 
311 166
 CONFIGURATION MANAGEMENT:
312 167
   add [uuid]                 - Add new disk configuration
313
-  remove [uuid]              - Remove disk configuration
168
+  remove [uuid|name|mount]   - Remove disk configuration
314 169
   list                       - List all configured disks
315
-  test [uuid]                - Test disk configuration
170
+  test [uuid|name|mount]     - Test disk configuration
316 171
   show                       - Show available disks
317 172
 
318 173
 MAINTENANCE:
@@ -875,10 +730,10 @@ configure_import_disk() {
875 730
 
876 731
 # Function to remove disk configuration
877 732
 remove_disk() {
878
-    local uuid="$1"
733
+    local identifier="$1"
879 734
     
880
-    if [[ -z "$uuid" ]]; then
881
-        echo "Usage: autonas remove <uuid>"
735
+    if [[ -z "$identifier" ]]; then
736
+        echo "Usage: autonas remove <uuid|name|mount_point>"
882 737
         return 1
883 738
     fi
884 739
     
@@ -887,17 +742,19 @@ remove_disk() {
887 742
         return 1
888 743
     fi
889 744
     
890
-    # Check if UUID exists
891
-    if ! check_uuid_exists "$uuid"; then
892
-        echo "Error: UUID '$uuid' not found in configuration."
745
+    local config
746
+    config=$(resolve_config_identifier "$identifier")
747
+    if [[ -z "$config" ]]; then
748
+        echo "Error: Entry '$identifier' not found in configuration."
893 749
         return 1
894 750
     fi
895
-    
751
+
752
+    local parsed=($(parse_config "$config"))
753
+    local uuid="${parsed[0]}"
754
+
896 755
     # Show current configuration
897
-    echo "Current configuration for UUID: $uuid"
756
+    echo "Current configuration for identifier: $identifier"
898 757
     echo "=================================="
899
-    local config=$(get_disk_config "$uuid")
900
-    local parsed=($(parse_config "$config"))
901 758
     echo "Name: ${parsed[1]}"
902 759
     echo "Type: ${parsed[2]}:${parsed[3]}"
903 760
     echo "Mount: ${parsed[4]}"
@@ -921,10 +778,10 @@ remove_disk() {
921 778
 
922 779
 # Function to test disk configuration
923 780
 test_config() {
924
-    local uuid="$1"
925
-    
926
-    if [[ -z "$uuid" ]]; then
927
-        echo "Usage: autonas test <uuid>"
781
+    local identifier="$1"
782
+
783
+    if [[ -z "$identifier" ]]; then
784
+        echo "Usage: autonas test <uuid|name|mount_point>"
928 785
         return 1
929 786
     fi
930 787
     
@@ -934,18 +791,16 @@ test_config() {
934 791
     
935 792
     # Check if configuration exists
936 793
     local config
937
-    config=$(get_disk_config "$uuid")
938
-    
794
+    config=$(resolve_config_identifier "$identifier")
795
+
939 796
     if [[ -z "$config" ]]; then
940
-        echo "❌ Configuration not found for UUID: $uuid"
797
+        echo "❌ Configuration not found for identifier: $identifier"
941 798
         echo ""
942 799
         echo "Available configurations:"
943 800
         list_disks
944 801
         return 1
945 802
     fi
946 803
     
947
-    echo "✅ Configuration found for UUID: $uuid"
948
-    
949 804
     # Parse configuration
950 805
     local parsed=($(parse_config "$config"))
951 806
     local cfg_uuid="${parsed[0]}"
@@ -954,7 +809,10 @@ test_config() {
954 809
     local interface="${parsed[3]}"
955 810
     local mount_point="${parsed[4]}"
956 811
     local nfs_options="${parsed[5]}"
957
-    
812
+
813
+    echo "✅ Configuration found"
814
+    echo "   UUID: $cfg_uuid"
815
+    echo "   Identifier used: $identifier"
958 816
     echo "   Name: $name"
959 817
     echo "   Type: $ip:$interface"
960 818
     echo "   Mount Point: $mount_point"
@@ -963,7 +821,7 @@ test_config() {
963 821
     # Test device detection
964 822
     echo "🔍 Testing device detection..."
965 823
     local device_info
966
-    if device_info=$(get_device_info "$uuid" 2>/dev/null); then
824
+    if device_info=$(get_device_info "$cfg_uuid" 2>/dev/null); then
967 825
         local device=$(echo "$device_info" | grep "^device:" | cut -d: -f2)
968 826
         echo "✅ Device found: $device"
969 827
         
@@ -973,7 +831,7 @@ test_config() {
973 831
         done
974 832
     else
975 833
         echo "❌ Device not found or not connected"
976
-        echo "   Make sure the device with UUID $uuid is connected"
834
+        echo "   Make sure the device with UUID $cfg_uuid is connected"
977 835
         return 1
978 836
     fi
979 837
     echo ""
@@ -1055,7 +913,7 @@ test_config() {
1055 913
     
1056 914
     echo "🎉 Configuration test completed successfully!"
1057 915
     echo ""
1058
-    echo "You can now attach this disk with: autonas attach $uuid"
916
+    echo "You can now attach this disk with: autonas attach $cfg_uuid"
1059 917
     return 0
1060 918
 }
1061 919
 
@@ -1065,7 +923,7 @@ test_config() {
1065 923
 case "${1:-}" in
1066 924
     "attach")
1067 925
         if [[ -z "$2" ]]; then
1068
-            echo "Error: UUID required for attach command"
926
+            echo "Error: UUID, disk name, or mount point required for attach command"
1069 927
             show_usage
1070 928
             exit 1
1071 929
         fi
@@ -1073,28 +931,12 @@ case "${1:-}" in
1073 931
         ;;
1074 932
     "detach")
1075 933
         if [[ -z "$2" ]]; then
1076
-            echo "Error: UUID required for detach command"
934
+            echo "Error: UUID, disk name, or mount point required for detach command"
1077 935
             show_usage
1078 936
             exit 1
1079 937
         fi
1080 938
         handle_detach "$2"
1081 939
         ;;
1082
-    "mount")
1083
-        if [[ -z "$2" ]]; then
1084
-            echo "Error: UUID or disk name required for mount command"
1085
-            show_usage
1086
-            exit 1
1087
-        fi
1088
-        handle_manual_mount "$2"
1089
-        ;;
1090
-    "unmount"|"umount")
1091
-        if [[ -z "$2" ]]; then
1092
-            echo "Error: UUID or disk name required for unmount command"
1093
-            show_usage
1094
-            exit 1
1095
-        fi
1096
-        handle_manual_unmount "$2"
1097
-        ;;
1098 940
     "import")
1099 941
         # Internal use only - background import process
1100 942
         if [[ -z "$4" ]]; then
@@ -1111,7 +953,7 @@ case "${1:-}" in
1111 953
         ;;
1112 954
     "remove")
1113 955
         if [[ -z "$2" ]]; then
1114
-            echo "Error: UUID required for remove command"
956
+            echo "Error: UUID, disk name, or mount point required for remove command"
1115 957
             show_usage
1116 958
             exit 1
1117 959
         fi
@@ -1122,7 +964,7 @@ case "${1:-}" in
1122 964
         ;;
1123 965
     "test")
1124 966
         if [[ -z "$2" ]]; then
1125
-            echo "Error: UUID required for test command"
967
+            echo "Error: UUID, disk name, or mount point required for test command"
1126 968
             show_usage
1127 969
             exit 1
1128 970
         fi