Error
The portal displays this
Blob not found.
error
This is the XML error I get when I hit the
download
button
<Error>
<Code>ResourceNotFound</Code>
<Message>
The specified resource does not exist. RequestId:bea21dfd-0001-004f-26e0-220af6000000 Time:2015-11-19T15:38:55.9836819Z
</Message>
</Error>
Background
I've been trying to implement a workaround for backing up my IaaS v2 Ubuntu VM in Azure. Thanks to an excellent answer I received on Server Fault recently, I decided the best route would just be to periodically back up my server using tar and a cronjob.
So, I googled "tar backup on linux azure VM" – which brought me to this article, namely: How to do Linux backups on Azure without shutting the VM down.
The tutorial outlines a process which executes the tar command, and then uploads the tar to an azure storage container using the credentials listed. Here is the script in question:
#!/bin/bash
# full system backup
# Backup destination
backdest=/opt/backup
# Labels for backup name
pc=${HOSTNAME}
distro=`uname -a | awk '{print $4}'`
type=full
date=$(date "+%F")
backupfile="$backdest/$distro-$type-$date.tar.gz"
username=`whoami`
#blob storage variables
storageAccountName=storageaccountname
storageAccountKey=mylongassstoragekey
storageContainer=backupcontainername
# Exclude file location
prog=${0##*/} # Program name from filename
excdir=`pwd`
exclude_file="$excdir/$prog-exc.txt"
#check backup destination is there
if [ ! -d "$backdest" ]; then
mkdir -p $backdest
fi
# Check if exclude file exists
if [ ! -f $exclude_file ]; then
echo "checking exclude $exclude_file"
echo -n "No exclude file exists, continue? (y/n): "
read continue
if [ $continue == "n" ]; then exit; fi
fi
#don't use nohup we want to make this blocking
tar --exclude-from=$exclude_file -czpvf $backupfile /
#after tar is finished move to blob storage
azure storage blob upload -a $storageAccountName --container $storageContainer -k $storageAccountKey $backupfile
echo "all done!"
Everything seems to go well, the script runs the backup, and then uploads the tar.gz as a block blob. But, as you can see from the above error, the Blob isn't found. The storage container is set to "Container" (as opposed to "Private").
I have no idea how to even start troubleshooting this. What do I do? Any help at all would be appreciated. Thanks very much!
Best Answer
Blob names require you to escape reserved URL characters. Your blob name starts with a
#
which is a reserved URL character. I suspect the issue will resolve itself when you remove that character (or escape it). Note: I haven't confirmed this with an independent test, but it's the first time I've ever seen a blob name with a#
character...More info on blob naming here.