Skip to content

Conversation

Copy link

Copilot AI commented Jan 8, 2026

Addresses feedback to validate device paths before passing them to potentially destructive commands like growpart and resize2fs.

Validation added:

  • Pattern matching: Ensures DISK matches expected block device patterns (/dev/sd[a-z]*, /dev/nvme[0-9]*n[0-9]*, /dev/mmcblk[0-9]*, /dev/vd[a-z])
  • Block device verification: Confirms both DISK and SSD_DEV exist and are block devices using -b test
  • Partition range check: Validates PART is within 1-128 range with error suppression

All validations occur before destructive operations:

# Validate device paths before proceeding with potentially destructive operations
case "$DISK" in
    /dev/sd[a-z]|/dev/sd[a-z][a-z]|/dev/nvme[0-9]*n[0-9]*|/dev/mmcblk[0-9]*|/dev/vd[a-z])
        # Valid block device pattern
        ;;
    *)
        echo "grow-ssd: device path '$DISK' does not match expected block device patterns; skipping for safety"
        sv down /var/service/grow-ssd >/dev/null 2>&1 || true
        exit 0
        ;;
esac

# Ensure DISK exists and is a block device
if ! [ -b "$DISK" ]; then
    echo "grow-ssd: '$DISK' is not a block device; skipping"
    sv down /var/service/grow-ssd >/dev/null 2>&1 || true
    exit 0
fi

Patterns support multi-digit device numbers (e.g., /dev/nvme10n1, /dev/mmcblk10).


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

@coderabbitai
Copy link

coderabbitai bot commented Jan 8, 2026

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Comment @coderabbitai help to get the list of available commands and usage tips.

Copilot AI changed the title [WIP] WIP Address feedback on growing SSD partition and filesystem Add device path validation before growpart and resize2fs operations Jan 8, 2026
Copilot AI requested a review from kristapsk January 8, 2026 00:12
@kristapsk
Copy link
Member

It's overkill.

@kristapsk kristapsk closed this Jan 8, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

2 participants