Skip to content

Commit

Permalink
Merge pull request #1364 from jemrobinson/1351-drive-mount-failure
Browse files Browse the repository at this point in the history
Fix failing drive mounts
  • Loading branch information
JimMadge authored Jan 27, 2023
2 parents 2483b6a + 2495125 commit 21d520e
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 12 deletions.
2 changes: 1 addition & 1 deletion deployment/CheckRequirements.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Import-Module $PSScriptRoot/common/Logging -Force -ErrorAction Stop

# Requirements
$PowershellMinVersion = "7.0.0"
$PowershellMaxVersion = "7.2.7"
$PowershellMaxVersion = "7.2.8"
$ModuleVersionRequired = @{
"Az.Accounts" = @("ge", "2.9.0")
"Az.Automation" = @("ge", "1.7.3")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@ write_files:
BLOBFUSE_CACHE_DIR="/tmp/blobfuse-cache-backup"
rm -rf $BLOBFUSE_CACHE_DIR
mkdir -p $BLOBFUSE_CACHE_DIR
CACHE_SPACE_MB=$(echo "$(df -BM | grep /mnt | awk '{print $2}' | sed 's/M//') / 2" | bc) # set the cache size to half the size of /mnt which scales with VM size
CACHE_SPACE_MB=$(echo "$(findmnt -nb -o size /) / 1024^2 / 50" | bc) # set the cache size to 2% of the OS disk size
/usr/bin/blobfuse $1 -o rw --tmp-path=$BLOBFUSE_CACHE_DIR --cache-size-mb=$CACHE_SPACE_MB --no-symlinks=true --config-file=/opt/configuration/credentials-backup.secret --log-level=LOG_DEBUG -o attr_timeout=240 -o entry_timeout=240 -o negative_timeout=120 -o allow_other
fi
Expand All @@ -426,7 +426,7 @@ write_files:
BLOBFUSE_CACHE_DIR="/tmp/blobfuse-cache-egress"
rm -rf $BLOBFUSE_CACHE_DIR
mkdir -p $BLOBFUSE_CACHE_DIR
CACHE_SPACE_MB=$(echo "$(df -BM | grep /mnt | awk '{print $2}' | sed 's/M//') / 2" | bc) # set the cache size to half the size of /mnt which scales with VM size
CACHE_SPACE_MB=$(echo "$(findmnt -nb -o size /) / 1024^2 / 50" | bc) # set the cache size to 2% of the OS disk size
/usr/bin/blobfuse $1 -o rw --tmp-path=$BLOBFUSE_CACHE_DIR --cache-size-mb=$CACHE_SPACE_MB --no-symlinks=true --config-file=/opt/configuration/credentials-egress.secret --log-level=LOG_DEBUG -o attr_timeout=240 -o entry_timeout=240 -o negative_timeout=120 -o allow_other
fi
Expand All @@ -437,7 +437,7 @@ write_files:
BLOBFUSE_CACHE_DIR="/tmp/blobfuse-cache-ingress"
rm -rf $BLOBFUSE_CACHE_DIR
mkdir -p $BLOBFUSE_CACHE_DIR
CACHE_SPACE_MB=$(echo "$(df -BM | grep /mnt | awk '{print $2}' | sed 's/M//') / 2" | bc) # set the cache size to half the size of /mnt which scales with VM size
CACHE_SPACE_MB=$(echo "$(findmnt -nb -o size /) / 1024^2 / 50" | bc) # set the cache size to 2% of the OS disk size
/usr/bin/blobfuse $1 -o ro --tmp-path=$BLOBFUSE_CACHE_DIR --cache-size-mb=$CACHE_SPACE_MB --no-symlinks=true --config-file=/opt/configuration/credentials-ingress.secret --log-level=LOG_DEBUG -o attr_timeout=240 -o entry_timeout=240 -o negative_timeout=120 -o allow_other
fi
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,26 +10,27 @@ END="\033[0m"
MOUNT_POINTS=("/data" "/home" "/scratch" "/shared" "/output")
echo -e "${BLUE}Checking drives are mounted...${END}"
for MOUNT_POINT in "${MOUNT_POINTS[@]}"; do
ls ${MOUNT_POINT}/* > /dev/null 2>&1
if [ "$(mount | grep $MOUNT_POINT)" ]; then
ls "${MOUNT_POINT}"/* > /dev/null 2>&1
if (findmnt "$MOUNT_POINT" > /dev/null 2>&1); then
echo -e "${BLUE} [o] ${MOUNT_POINT} is mounted...${END}"
else
echo -e "${RED} [ ] ${MOUNT_POINT} not mounted. Attempting to mount...${END}"
if [ -e /etc/systemd/system/${MOUNT_POINT}.mount ]; then
systemctl start $(echo $MOUNT_POINT | sed 's|/||').mount
MOUNT_UNIT="$(echo "$MOUNT_POINT" | tr -d '/').mount"
if [ -e "/etc/systemd/system/${MOUNT_UNIT}" ]; then
systemctl start "${MOUNT_UNIT}"
else
mount $MOUNT_POINT
mount "$MOUNT_POINT"
fi
fi
done
sleep 30

echo -e "${BLUE}Rechecking drives are mounted...${END}"
for MOUNT_POINT in "${MOUNT_POINTS[@]}"; do
ls ${MOUNT_POINT}/* > /dev/null 2>&1
if [ "$(mount | grep $MOUNT_POINT)" ]; then
ls "${MOUNT_POINT}"/* > /dev/null 2>&1
if (findmnt "$MOUNT_POINT" > /dev/null 2>&1); then
echo -e "${BLUE} [o] ${MOUNT_POINT} is mounted...${END}"
df -h | grep $MOUNT_POINT
df -h | grep "$MOUNT_POINT"
else
echo -e "${RED} [x] ${MOUNT_POINT} is not currently mounted...${END}"
fi
Expand Down

0 comments on commit 21d520e

Please sign in to comment.