Index: /branches/amp_3_7_2/scripts/export_es_snapshot.sh
===================================================================
--- /branches/amp_3_7_2/scripts/export_es_snapshot.sh	(revision 2893)
+++ /branches/amp_3_7_2/scripts/export_es_snapshot.sh	(working copy)
@@ -199,33 +199,45 @@
 # ============================================================
 if [[ -n "$REMOTE_IP" ]]; then
     command -v sshpass >/dev/null 2>&1 || fail "sshpass not installed"
-    command -v rsync >/dev/null 2>&1 || fail "rsync not installed"
 
     log "Transferring snapshot to ${REMOTE_USER}@${REMOTE_IP}:${REMOTE_PATH}"
 
-    sshpass -p "$REMOTE_PASS" rsync -avzh --progress \
-        -e "ssh -o StrictHostKeyChecking=no -o ServerAliveInterval=60 -o ServerAliveCountMax=5" \
-        "$SNAPSHOT_DIR/" "$REMOTE_USER@$REMOTE_IP:${REMOTE_PATH}/" \
-        2>&1 | tee -a "$EXPORT_LOG"
+    # PRIMARY: Use tar+ssh (much faster for many small files)
+    log "Using tar+ssh for transfer (optimized for large file counts)..."
+    
+    TAR_OUTPUT=$(cd "$SNAPSHOT_DIR" && tar czf - . 2>/dev/null | \
+        sshpass -p "$REMOTE_PASS" ssh -o StrictHostKeyChecking=no \
+        -o ServerAliveInterval=60 -o ServerAliveCountMax=5 \
+        "$REMOTE_USER@$REMOTE_IP" "cd ${REMOTE_PATH} && tar xzf -" 2>&1)
+    
+    TAR_RET=$?
+    echo "$TAR_OUTPUT" >> "$EXPORT_LOG"
 
-    RSYNC_RET=${PIPESTATUS[0]}
-
-    if [[ $RSYNC_RET -eq 0 ]]; then
-        log "Snapshot transferred to remote successfully (rsync)"
+    if [ $TAR_RET -eq 0 ]; then
+        log "Snapshot transferred to remote successfully (tar+ssh)"
     else
-        log "ERROR: rsync failed. Attempting fallback to SCP..."
+        log "ERROR: tar+ssh failed. Attempting fallback to rsync..."
+        echo "Tar Output: $TAR_OUTPUT"
 
-        sshpass -p "$REMOTE_PASS" scp -rv \
-            -o StrictHostKeyChecking=no \
-            -o ServerAliveInterval=60 \
-            -o ServerAliveCountMax=5 \
-            "$SNAPSHOT_DIR"/. "$REMOTE_USER@$REMOTE_IP:${REMOTE_PATH}/" \
-            2>&1 | tee -a "$EXPORT_LOG"
+        # FALLBACK TO RSYNC (slower but more robust)
+        if command -v rsync >/dev/null 2>&1; then
+            RSYNC_OUTPUT=$(sshpass -p "$REMOTE_PASS" rsync -avzh --progress \
+                -e "ssh -o StrictHostKeyChecking=no -o ServerAliveInterval=60 -o ServerAliveCountMax=5" \
+                "$SNAPSHOT_DIR/" "$REMOTE_USER@$REMOTE_IP:${REMOTE_PATH}/" 2>&1)
+            
+            RSYNC_RET=$?
+            echo "$RSYNC_OUTPUT" >> "$EXPORT_LOG"
 
-        SCP_RET=${PIPESTATUS[0]}
-
-        [[ $SCP_RET -eq 0 ]] || fail "Remote transfer failed (rsync and scp)"
-        log "Snapshot transferred to remote successfully (scp)"
+            if [ $RSYNC_RET -eq 0 ]; then
+                log "Snapshot transferred to remote successfully (rsync)"
+            else
+                log "ERROR: rsync fallback failed"
+                echo "Rsync Output: $RSYNC_OUTPUT"
+                fail "Remote transfer failed (tar+ssh and rsync)"
+            fi
+        else
+            fail "Remote transfer failed (tar+ssh) and rsync not available"
+        fi
     fi
 fi
 
Index: /branches/amp_3_7_2/scripts/import_es_snapshot.sh
===================================================================
--- /branches/amp_3_7_2/scripts/import_es_snapshot.sh	(revision 2893)
+++ /branches/amp_3_7_2/scripts/import_es_snapshot.sh	(working copy)
@@ -127,28 +127,66 @@
 # ----------------------------------------------------------
 log "[3/9] Copying snapshot directory..."
 
-sshpass -p "$AMP_PASS" rsync -avzh --progress \
-    -e "ssh $SSH_OPTS" \
-    "$AMP_USER@$AMP_IP:$DIR/" "$IMPORT_DIR/" \
-    2>&1 | tee -a "$LOG_FILE"
+# PRIMARY: Use tar+ssh (much faster for many small files)
+log "Using tar+ssh for transfer (optimized for large file counts)..."
 
-RSYNC_RET=${PIPESTATUS[0]}
+# Create a temp file to capture SSH errors
+SSH_ERR_FILE=$(mktemp)
+TAR_ERR_FILE=$(mktemp)
 
-if [[ $RSYNC_RET -eq 0 ]]; then
-    log "Snapshot directory copied successfully (rsync)"
-else
-    log "ERROR: rsync failed. Attempting fallback to SCP..."
+# Run tar+ssh and capture exit codes IMMEDIATELY (PIPESTATUS resets after any command)
+sshpass -p "$AMP_PASS" ssh $SSH_OPTS \
+    "$AMP_USER@$AMP_IP" "cd $DIR && tar czf - ." 2>"$SSH_ERR_FILE" | \
+    tar xzf - -C "$IMPORT_DIR" 2>"$TAR_ERR_FILE"
 
-    sshpass -p "$AMP_PASS" scp -rv $SSH_OPTS \
-        "$AMP_USER@$AMP_IP:$DIR"/. "$IMPORT_DIR/" \
-        2>&1 | tee -a "$LOG_FILE"
+# IMPORTANT: Capture PIPESTATUS immediately - it resets after any command!
+PIPE_STATUS=("${PIPESTATUS[@]}")
+TAR_RET=${PIPE_STATUS[0]}  # Exit code from ssh command (first in pipe)
+TAR_EXTRACT_RET=${PIPE_STATUS[1]}  # Exit code from tar extract (second in pipe)
 
-    SCP_RET=${PIPESTATUS[0]}
-    [[ $SCP_RET -eq 0 ]] || fail "Remote copy failed (rsync and scp)"
+# Capture any errors
+SSH_ERRORS=$(cat "$SSH_ERR_FILE" 2>/dev/null)
+TAR_ERRORS=$(cat "$TAR_ERR_FILE" 2>/dev/null)
+rm -f "$SSH_ERR_FILE" "$TAR_ERR_FILE"
 
-    log "Snapshot directory copied successfully (scp)"
+# Log any errors
+if [ -n "$SSH_ERRORS" ]; then
+    echo "SSH/Remote tar errors: $SSH_ERRORS" >> "$LOG_FILE"
 fi
+if [ -n "$TAR_ERRORS" ]; then
+    echo "Local tar extraction errors: $TAR_ERRORS" >> "$LOG_FILE"
+fi
 
+log "tar+ssh exit codes: ssh=$TAR_RET, tar=$TAR_EXTRACT_RET"
+
+# Check both exit codes
+if [ $TAR_RET -eq 0 ] && [ $TAR_EXTRACT_RET -eq 0 ]; then
+    log "Snapshot directory copied successfully (tar+ssh)"
+else
+    log "ERROR: tar+ssh failed. Attempting fallback to rsync..."
+    echo "Tar Output: $TAR_OUTPUT"
+
+    # FALLBACK TO RSYNC (slower but more robust)
+    if command -v rsync >/dev/null 2>&1; then
+        RSYNC_OUTPUT=$(sshpass -p "$AMP_PASS" rsync -avzh --progress \
+            -e "ssh $SSH_OPTS" \
+            "$AMP_USER@$AMP_IP:$DIR/" "$IMPORT_DIR/" 2>&1)
+
+        RSYNC_RET=$?
+        echo "$RSYNC_OUTPUT" >> "$LOG_FILE"
+
+        if [ $RSYNC_RET -eq 0 ]; then
+            log "Snapshot directory copied successfully (rsync)"
+        else
+            log "ERROR: rsync fallback failed"
+            echo "Rsync Output: $RSYNC_OUTPUT"
+            fail "Remote copy failed (tar+ssh and rsync)"
+        fi
+    else
+        fail "Remote copy failed (tar+ssh) and rsync not available"
+    fi
+fi
+
 log "Fixing snapshot directory ownership..."
 chown -R elasticsearch:elasticsearch "$IMPORT_DIR"
 chmod -R 755 "$IMPORT_DIR"
Index: /branches/amp_3_7_2/src/webui/webui/htdocs/new/src/hive/controller/snapshot_controller.py
===================================================================
--- /branches/amp_3_7_2/src/webui/webui/htdocs/new/src/hive/controller/snapshot_controller.py	(revision 2893)
+++ /branches/amp_3_7_2/src/webui/webui/htdocs/new/src/hive/controller/snapshot_controller.py	(working copy)
@@ -223,8 +223,8 @@
             break
     # If no marker found, consider entire log
     relevant_lines = lines[start_idx:] if start_idx is not None else lines
-    # Only inspect last N lines of the CURRENT run
-    relevant_lines = relevant_lines[-50:]
+
+    # Check ALL lines from current run for success/failure markers
     result = {"status": "In Progress"}
     for line in relevant_lines:
         line_lower = line.lower()
@@ -247,13 +247,34 @@
                 "status": "Successful",
                 "completed_at": ts
             }
-    # PID VALIDATION — ONLY AFTER LOG PARSING
-    if result["status"] == "In Progress":
-        if not is_job_really_running(PID_FILE_IMPORT):
-            return {
-                "status": "Failed",
-                "message": "Import operation was interrupted (system reboot or process termination)"
-            }
+    
+    # If still "In Progress", verify the import process is actually running
+    if result.get("status") == "In Progress":
+        import subprocess
+        try:
+            # Check if import_es_snapshot.sh is running
+            ps_result = subprocess.run(
+                ["pgrep", "-f", "import_es_snapshot.sh"],
+                capture_output=True,
+                text=True
+            )
+            if ps_result.returncode != 0:
+                # Process not running but no completion marker found
+                # Get last timestamp from log
+                last_ts = None
+                for line in reversed(relevant_lines):
+                    last_ts = extract_timestamp(line)
+                    if last_ts:
+                        break
+                result = {
+                    "status": "Failed",
+                    "failed_at": last_ts,
+                    "message": "Import process ended unexpectedly. Check /var/log/es_import.log for details"
+                }
+        except Exception:
+            # If pgrep fails, keep the In Progress status
+            pass
+    
     return result
 
 
@@ -282,7 +303,7 @@
         }
     with open(LOG_FILE_EXPORT, "r") as f:
         lines = f.readlines()
-    # Find last import start marker
+    # Find last export start marker
     start_idx = None
     for i in range(len(lines) - 1, -1, -1):
         if "STARTING ELASTICSEARCH SNAPSHOT EXPORT" in lines[i]:
@@ -290,8 +311,8 @@
             break
     # If no marker found, consider entire log
     relevant_lines = lines[start_idx:] if start_idx is not None else lines
-    # Only inspect last N lines of the CURRENT run
-    relevant_lines = relevant_lines[-50:]
+
+    # Check ALL lines from current run for success/failure markers
     result = {"status": "In Progress"}
     for line in relevant_lines:
         line_lower = line.lower()
@@ -312,13 +333,34 @@
                 "status": "Successful",
                 "completed_at": ts
             }
-    # PID VALIDATION — ONLY AFTER LOG PARSING
-    if result["status"] == "In Progress":
-        if not is_job_really_running(PID_FILE_EXPORT):
-            return {
-                "status": "Failed",
-                "message": "Export operation was interrupted (system reboot or process termination)"
-            }
+
+    # If still "In Progress", verify the export process is actually running
+    if result.get("status") == "In Progress":
+        import subprocess
+        try:
+            # Check if export_es_snapshot.sh is running
+            ps_result = subprocess.run(
+                ["pgrep", "-f", "export_es_snapshot.sh"],
+                capture_output=True,
+                text=True
+            )
+            if ps_result.returncode != 0:
+                # Process not running but no completion marker found
+                # Get last timestamp from log
+                last_ts = None
+                for line in reversed(relevant_lines):
+                    last_ts = extract_timestamp(line)
+                    if last_ts:
+                        break
+                result = {
+                    "status": "Failed",
+                    "failed_at": last_ts,
+                    "message": "Export process ended unexpectedly. Check /var/log/es_export.log for details"
+                }
+        except Exception:
+            # If pgrep fails, keep the In Progress status
+            pass
+    
     return result
 
 
