diff --git a/common/nfs-services-server.nix b/common/nfs-services-server.nix index fe2fa97..6e8e935 100644 --- a/common/nfs-services-server.nix +++ b/common/nfs-services-server.nix @@ -121,8 +121,8 @@ in # Create readonly snapshot btrfs subvolume snapshot -r /persist/services "$SNAPSHOT_PATH" - # Find previous snapshot on sender - PREV_LOCAL=$(ls -t /persist/services@* 2>/dev/null | grep -v "^$SNAPSHOT_PATH$" | head -1 || true) + # Find previous snapshot on sender (sort by name since readonly snapshots have same mtime) + PREV_LOCAL=$(ls -1 /persist/services@* 2>/dev/null | grep -v "^$SNAPSHOT_PATH$" | sort -r | head -1 || true) # Try incremental send if we have a parent, fall back to full send if it fails if [ -n "$PREV_LOCAL" ]; then