Skip to content

Commit f3c004d

Browse files
authored
Merge pull request #70 from Barts-Life-Science/fileshare-linux-mgmt
Change the shared storage mount to be permanent on Linux VMs
2 parents b9d8239 + 82fc012 commit f3c004d

File tree

1 file changed

+20
-12
lines changed
  • templates/workspace_services/guacamole/user_resources/guacamole-azure-linuxvm/terraform

1 file changed

+20
-12
lines changed

templates/workspace_services/guacamole/user_resources/guacamole-azure-linuxvm/terraform/vm_config.sh

+20-12
Original file line numberDiff line numberDiff line change
@@ -37,20 +37,24 @@ if [ "${SHARED_STORAGE_ACCESS}" -eq 1 ]; then
3737
storageAccountKey="${STORAGE_ACCOUNT_KEY}"
3838
httpEndpoint="${HTTP_ENDPOINT}"
3939
fileShareName="${FILESHARE_NAME}"
40-
mntRoot="/fileshares"
40+
41+
# Configure for permanent mount instead of autofs
42+
# mntRoot="/fileshares"
43+
mntRoot="/shared-storage"
44+
4145
credentialRoot="/etc/smbcredentials"
4246

43-
mntPath="$mntRoot/$fileShareName"
47+
# mntPath="$mntRoot/$fileShareName"
4448
# shellcheck disable=SC2308
4549
smbPath=$(echo "$httpEndpoint" | cut -c7-"$(expr length "$httpEndpoint")")$fileShareName
4650
smbCredentialFile="$credentialRoot/$storageAccountName.cred"
4751

48-
# Create required file paths
49-
sudo mkdir -p "$mntPath"
52+
# # Create required file paths
53+
# sudo mkdir -p "$mntPath"
5054
sudo mkdir -p "/etc/smbcredentials"
5155
sudo mkdir -p $mntRoot
5256

53-
### Auto FS to persist storage
57+
# ### Auto FS to persist storage
5458
# Create credential file
5559
if [ ! -f "$smbCredentialFile" ]; then
5660
echo "username=$storageAccountName" | sudo tee "$smbCredentialFile" > /dev/null
@@ -62,15 +66,19 @@ if [ "${SHARED_STORAGE_ACCESS}" -eq 1 ]; then
6266
# Change permissions on the credential file so only root can read or modify the password file.
6367
sudo chmod 600 "$smbCredentialFile"
6468

65-
# Configure autofs
66-
echo "$fileShareName -fstype=cifs,rw,dir_mode=0777,credentials=$smbCredentialFile :$smbPath" | sudo tee /etc/auto.fileshares > /dev/null
67-
echo "$mntRoot /etc/auto.fileshares --timeout=60" | sudo tee /etc/auto.master > /dev/null
69+
# # Configure autofs
70+
# echo "$fileShareName -fstype=cifs,rw,dir_mode=0777,file_mode=0777,uid=1000,gid=1000,credentials=$smbCredentialFile :$smbPath" | sudo tee /etc/auto.fileshares > /dev/null
71+
# echo "$mntRoot /etc/auto.fileshares --timeout=60" | sudo tee /etc/auto.master > /dev/null
6872

69-
# Restart service to register changes
70-
sudo systemctl restart autofs
73+
# # Restart service to register changes
74+
# sudo systemctl restart autofs
7175

72-
# Autofs mounts when accessed for 60 seconds. Folder created for constant visible mount
73-
sudo ln -s "$mntPath" "/$fileShareName"
76+
# # Autofs mounts when accessed for 60 seconds. Folder created for constant visible mount
77+
# sudo ln -s "$mntPath" "/$fileShareName"
78+
79+
sudo mkdir -p $mntRoot
80+
echo "$smbPath $mntRoot cifs rw,vers=default,dir_mode=0777,file_mode=0777,uid=1000,gid=1000,credentials=$smbCredentialFile 0 0" | sudo tee -a /etc/fstab >/dev/null
81+
sudo mount $mntRoot
7482
fi
7583

7684
### Anaconda Config

0 commit comments

Comments
 (0)