summaryrefslogtreecommitdiff
path: root/debian/ephemeral-disk-warning.conf
blob: 714ee99ca0b5440151260b9518390531d877e16c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# 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.

start on (stopped rc RUNLEVEL=[2345] and stopped cloud-config)
task
script
    dev_sdb_mp=$(mount | awk '/sdb1/{print$3}')
    warn_file="$dev_sdb_mp/DATALOSS_WARNING_README.txt"
    if [ -z "$dev_sdb_mp" ]; then
            logger "Unable to discover /dev/sdb1's mount point, ephemeral warning will not be written"
            exit 0
    else
            logger "Ephemeral disk /dev/sdb located at $dev_sdb_mp"
    fi

    if [ ! -e "$warn_file" ]; then
        cat >> $warn_file <<"EOF"
WARNING: THIS IS A TEMPORARY DISK.

Any data stored on this drive is SUBJECT TO LOSS and THERE IS NO WAY TO
RECOVER IT.

Please do not use this disk for storing any personal or application data.

For additional details to please refer to the MSDN documentation at:
http://msdn.microsoft.com/en-us/library/windowsazure/jj672979.aspx
EOF
        chmod 0444 $warn_file
        chattr +i $warn_file
        logger "Added ephemeral disk warning to $warn_file"
    fi
    logger "WARNING: $dev_sdb_mp is an ephemeral disk. See $warn_file for more information"

end script