I am trying to mount my external persistent disk using the command:
sudo mount -o discard, defaults /dev/sdb /mnt/working
what I want to do is to make it part of the startup script as I start my VM. I followed the instructions as per the link: https://cloud.google.com/compute/docs/startupscript#startupscriptrunninginstances
I added the script as follows:
custom metadata
key value
startup-script #! /bin/bash
sudo mount -o discard,defaults /dev/sdb /mnt/working
However when I restart my VM , it does not execute it. What am I doing wrong here ?
EDITED to provide more information
Image: debian-10-buster-v20200910 I have not enabled error logging as I am not using the free version anymore but I am hoping that the default log viewer will show error logs. I don't see any. I also ran the script by logging into the vm instance:
sudo google_metadata_script_runner startup
This also didn't help.
Issue was primarily a newline character between /mnt/sdb /mnt/working. This prevented from the startup script from getting executed. Thanks to the tip from Lukaszberwid, I ran the
was able to spot the issue. I was wondering if the metadata value field for the startup script can be expanded to the right or made little bigger to spot such cut and paste issues.