Advertisements

Archive for January, 2015

How to do a full system bare-metal backup in Windows 8

The Windows “Backup and Restore” utility that was present in the control panel in Windows 7 could easily do full-system bare-metal backup and restore. Unfortunately, this tool was removed from the control panel in Windows 8.

However, it looks like that tool is still present on the hard drive and can be used. Here’s how to find it.

Click Start, and in the search box, type SDCLT.EXE . Right-click the and click Run As Administrator.

As always, a test restore is good practice.

Comments are welcomed below!

Advertisements

Leave a comment

Restoring and downloading S3 Glacier objects using s3cmd

I currently have a portion of my backups on S3, with a life-cycle policy that includes moving the objects to Glacier after a period of time. This makes the storage much cheaper ($0.01/GB/Mo from $0.03/GB/Mo – Source), but has the downside that objects require a 4-hour restore period  before they can become available for download. I have had need for some objects quickly, and so the 4-hour restore time isn’t worth the savings. Unfortunately, once an object has had this life-cycle applied to it, it can only be temporarily restored. In order to make it a standard object again, you have to download it, delete the Glacier object, and then re-upload it. Unfortunately, doing it all wasn’t quite as straightforward as I thought it might be. But, (I think) I figured out a way to get it done rather painlessly.

I’m going to be using s3cmd and a few cron jobs to automate this.

First, get s3cmd version 1.5. This version supports initiating restores on the Glacier objects. You can recursively initiate a restore on every object in the bucket, but when it hits a non-Glacier object it will stop. You can also use s3cmd to initiate a download of all the objects in the bucket, but when it hits a Glacier object, the download will stop. And you will end up with a zero-byte file. (Hey s3cmd developers, would you mind fixing this behavior, or at least writing in something to force progression on a failure, so we can walk through the entire bucket in one go?)

The solution had to involve initiating restores, waiting at least 4 hours for the restore, then going back for the restored data and deleting it from the buckets, then deleting any zero-byte files, and then doing it all over again later.

Ain’t nobody got time for that. Except cron. Cron has plenty of time for that.

First of all, make sure you have s3cmd installed and configured (with s3cmd --configure). Then you can configure the following script to run every 4 hours. I’m not going to go into much detail on this. If you’re familiar with s3cmd and Amazon S3/Glacier, you can probably figure out how it works. I wrote it as a short-term fix, but it’s worth sharing.

#!/bin/bash

# This script should be fired every 4 hours from a cron job until all
# data from the desired bucket is restored.
# Requires s3cmd 1.5 or newer

# Temp file
TEMPFILE=~/.s3cmd.restore.tmp

# Bucket to restore data from. Use trailing slash.
BUCKET="s3://bucketname/"

# Folder to restore data to. Use trailing slash.
FOLDER="/destination_folder/"

# Because of the way s3cmd handles errors, we have to run in a certain method
# 1: download/delete files from bucket,
# 2: run restore on the remaining objects
# 3: Do housekeeping on the downloaded data

if [ ! -f $TEMPFILE ]
then
touch $TEMPFILE
echo === Starting Download Phase
s3cmd -r --delete-after-fetch --rexclude "/$" sync $BUCKET $FOLDER
echo === Starting Restore Phase
s3cmd -r -D 30 restore $BUCKET
echo === Starting cleanup
# s3cmd doesn't delete empty folders, and can create empty files. Clean this up.
find $FOLDER -empty -delete
# but it might accidentially delete the target directory if the download didn't
# happen, so we have to fix that now
mkdir $FOLDER
rm $TEMPFILE
fi

Note that restore, download, and delete operations can incur extra costs. Be aware of that before proceeding.

So that’s it. I *should* have my entire S3 bucket downloaded completely within the next few days, and then I can migrate to what I hope is a more simplified archiving plan.

, , ,

Leave a comment

External optical drive woes

My old laptop, a Dell Latitude E6510, has a bad DVD drive. It won’t read most discs, and almost everything I try to burn, fails. I purchased an external USB drive to use with it, and that works well. It was cheaper than replacing the drive itself. Replacing the drive is straightforward, I just don’t want to spend the money right now to get a new drive.

About a week ago I wanted to install some software from a CD (Who does that anymore, right?) on my Asus tablet, which lacks an optical drive, but has a USB port. I plugged the external USB drive into the port, and put the disc in it. Shortly after, the drive kept disappearing from ‘My Computer’, I kept hearing the Windows disconnect and reconnect sounds. It wouldn’t stay ‘connected.’

My son likes to get into things that he shouldn’t, so I nearly chewed him out for it straight away, but after taking a bit to calm down, I decided to troubleshoot. I thought it was a bad cable at first, so I tried a few different cables. No change. Tried wiggling the USB port to see if the tablet port was faulty, no change. I plugged the drive back into the Dell, and it worked without a problem. This got me thinking.

After some of that thinking, I finally figured out what the issue was, and I’m posting this to see if anyone else can figure it out too, because you’ll learn something from my ordeal. Something that may surprise you.

This is a photo of the bottom of the USB drive, showing the label and the USB plug. Most of the information you need to figure this out is in this photo. You may need to go and do a web search if you’re missing a piece of information.

Post your comments, questions, or guesses in the comments below. The first person who figures it out will get recognition, and I’ll clarify the answer if it needs any. 

Hint: Again, almost everything you need to know to figure this out is in the photo of the USB drive. Almost. The rest is a quick web search away.

Hint: The Dell laptop has USB 2.0 ports. The tablet has USB 3.0. This is not the reason, although it’s going in the right direction. 

Guess/Hint: Someone guessed that the drive was made on April Fool’s Day. A clever guess sir, but not correct. You are looking in the right area.

Guess: Someone guessed that I might have been using the microUSB “On The Go” (OTG) port. A good guess, as this tablet has one of those ports as well, but no. I was using the USB 3 port that’s on the tablet’s keyboard dock. I did just try using the OTG port instead of the USB 3.0 port and got the same result. I am not surprised. 

Here are photos. Click any for a larger image:

Answer: My friend Gary got the idea that it might have been a power issue, but cwyenberg went so far as to point that 1.6A is a lot for a USB draw. 

Explanation: From Wikipedia:

USB power standards
Specification Current Voltage Power
USB 1.x and 2.0 500 mA[a] 5 V 2.5 W
USB 3.x 900 mA[b] 5 V 4.5 W

USB devices can only ask for so much power, (up to 500mA for a USB 2.0 device), and 1.6A is far beyond that. This drive can’t be expected to work under all circumstances according to the USB specification. The reason that it worked on the Dell laptop is probably that Dell is allowing the device to draw more power for the sake of compatibility. This is why you see external hard drives with Y-cables — the device can pull from 2 USB ports to get more power and still adhere to the USB standard, allowing the device to be expected to work under all circumstances. Interestingly enough, the drive does work with a powered USB hub rated for 2.5A. So, if you’re having a similar issue as me, try getting a powered USB hub. 

There’s a handy program I found called USBTreeView that can show you the requested power for each device connected to your USB bus. In this case, USBTreeView shows the following lines for this drive:

iManufacturer : 0x01
Language 0x0409 : "Hitachi-LG Data Storage Inc"
iProduct : 0x02
Language 0x0409 : "Portable Super Multi Drive"
...
MaxPower : 0xFA (500 mA)

Thanks for reading (and for your responses)!

Leave a comment