Skip to content

fix: accurately determine disk mount for upgrade disk xvdp #1740

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Aug 8, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 21 additions & 3 deletions ansible/files/admin_api_scripts/pg_upgrade_scripts/initiate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -348,10 +348,28 @@ function initiate_upgrade {
locale-gen

if [ -z "$IS_CI" ] && [ -z "$IS_LOCAL_UPGRADE" ]; then
# awk NF==3 prints lines with exactly 3 fields, which are the block devices currently not mounted anywhere
# excluding nvme0 since it is the root disk
# DATABASE_UPGRADE_DATA_MIGRATION_DEVICE_NAME = '/dev/xvdp' can be derived from the worker mount
echo "5. Determining block device to mount"
BLOCK_DEVICE=$(lsblk -dprno name,size,mountpoint,type | grep "disk" | grep -v "nvme0" | awk 'NF==3 { print $1; }')
if command -v ebsnvme-id >/dev/null 2>&1 && dpkg -l | grep -q amazon-ec2-utils; then
for nvme_dev in $(lsblk -dprno name,size,mountpoint,type | grep disk | awk '{print $1}'); do
if [ -b "$nvme_dev" ]; then
mapping=$(ebsnvme-id -b "$nvme_dev" 2>/dev/null)
if [[ "$mapping" == "xvdp" || $mapping == "/dev/xvdp" ]]; then
BLOCK_DEVICE="$nvme_dev"
break
fi
fi
done
fi

# Fallback to lsblk if ebsnvme-id is not available or no mapping found, pre ubuntu 20.04
if [ -z "$BLOCK_DEVICE" ]; then
echo "No block device found using ebsnvme-id, falling back to lsblk"
# awk NF==3 prints lines with exactly 3 fields, which are the block devices currently not mounted anywhere
# excluding nvme0 since it is the root disk
BLOCK_DEVICE=$(lsblk -dprno name,size,mountpoint,type | grep "disk" | grep -v "nvme0" | awk 'NF==3 { print $1; exit }') # exit ensures we grab the first only
fi

echo "Block device found: $BLOCK_DEVICE"

mkdir -p "$MOUNT_POINT"
Expand Down
6 changes: 6 additions & 0 deletions ansible/tasks/setup-supabase-internal.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@
shell: "/tmp/aws/install --update"
become: true

- name: install utilities to manage Amazon EC2 instance storage
become: true
apt:
pkg:
- amazon-ec2-utils

- name: AWS CLI - configure ipv6 support for s3
shell: |
aws configure set default.s3.use_dualstack_endpoint true
Expand Down
Loading