# ephemeral-disk-warning - warns user that the disk is really, really ephemeral # # On Azure, the ephemeral disk is extremely ephemeral; the ephemeral disk is # unsafe between boots. This places a file on /mnt that warns the user # that the disk is a dangerous place for storing data of any importance. env RESOURCE_DISK=/dev/disk/azure/resource-part1 start on (stopped rc RUNLEVEL=[2345] and stopped cloud-config) task script if [ ! -e $RESOURCE_DISK ]; then logger "Disk $RESOURCE_DISK does not exist, skipping ephemeral warning" exit 0 fi ephemeral_kdev=$(readlink -f $RESOURCE_DISK) ephemeral_mp=$(awk '$1==kd {print$2}' "kd=$ephemeral_kdev" /proc/mounts) warn_file="$ephemeral_mp/DATALOSS_WARNING_README.txt" if [ -z "$ephemeral_mp" ]; then logger "Unable to discover mount point of $ephemeral_kdev. Ephemeral warning will not be written" exit 0 else logger "Ephemeral disk $ephemeral_kdev located at $ephemeral_mp" fi if [ ! -e "$warn_file" ]; then cat >> $warn_file <