Document copyright 2012 Mark Minasi; please see below for info on subscribing, unsubscribing or copying portions of this text.
Hi all —
This month, I've had my nose to the grindstone getting ready for my full-day talk on Windows 8 Server on 26 March at Cloud Connections in Vegas -- seats for this pre-conference event are still available! -- so I've been installing the Win 8 betas on a number of machines, and while doing all of that, my trusty Lenovo W510 developed some hard disk problems (I tellya, the "urgency detectors" on computers nowadays are deadly accurate ... you'd think they were copiers or something!), so two techniques came to mind that I thought you'd find interesting: how to use USB sticks to install Win 8 faster, and how to use Robocopy to get as much accessible data off a bad drive as is possible, and in the shortest time. I hope you'll find these tips useful but first, a word from our sponsor...
Installing the Windows 8 Betas From a USB Stick Rather than DVD
With the arrival of what we're supposed to either call "the Windows 8 beta" or "the Customer Preview of Windows 8" in both Desktop and Server flavors, it's time for OS geeks like me to download some ISOs, burn them to DVDs, and then use those DVDs to get the beta running on the odd spare box or two. (Yes, we can use virtual machines, but given that so much of the intended appeal of Win 8 has to do with the way it handles hardware, I think it really needs a physical box to really show its true colors.) DVDs can be a pain, though, and I'm just green enough to feel embarrassed burning an ISO to a DVD just to use it one time, and then consign it to some landfill somewhere. Worse yet, an awful lot of systems nowadays lack an optical drive altogether, making a Win 8 install a mite annoying ... but there's a better way.
Ever since Vista's new "bootmgr" startup routine debuted in 2006, Windows -- and most post-2006 hardware -- have become much more friendly to the notion of booting from a USB stick. So instead of burning that DVD, take a couple of minutes and see how to install Windows 8 from USB.
First, let's prep the USB stick to be bootable and ready to receive the Win 8 setup files. To do that, we're going to insert the USB stick, note its drive letter, and then fire up DISKPART. In DISKPART, we'll figure out which physical drive number Windows gives your USB stick, which will then enable us to wipe that USB stick clean, make it bootable, and format it as NTFS.
To begin, insert the USB stick. In Explorer, note its size and drive letter.
Next, open a command prompt and type DISKPART. Once DISKPART starts up, type "list disk." I've inserted an 8 GB USB stick into my computer for this example. Also my computer contains a 500GB and a 750GB hard drive, so DISKPART should report seeing three disks.
After inserting the USB stick Explorer tells me that it was drive D:. The result of the "list disk" command looks like this:
Disk ### Status Size Free Dyn Gpt -------- ------------- ------- ------- --- --- Disk 0 Online 465 GB 0 B Disk 1 Online 698 GB 0 B Disk 2 Online 7702 MB 0 B
So where's the USB hardware... behind Door Number Zero, Door Number One, or Door Number Two? Well, clearly it's not the 500 GB drive (okay, the "465 GB," that's 500GB in marketing-speak) or the 698GB one, so the "7702 MB" one seems the right one. So select it now by typing
select disk number
Where number is whatever the disk number of your USB stick is. In my case, it's 2, so I'd type:select disk 2
I'd hate to accidentally toast a data with vital data on it, however, so let's put on both the belt and the suspenders and type
Which gives us information like this:
UDISK PDU01-8G B4H2.0 USB Device Disk ID: 26D7ED61 Type : USB Status : Online Path : 0 Target : 0 LUN ID : 0 Location Path : UNAVAILABLE Current Read-only State : No Read-only : No Boot Disk : No Pagefile Disk : No Hibernation File Disk : No Crashdump Disk : No Clustered Disk : No Volume ### Ltr Label Fs Type Size Status Info ---------- --- ----------- ----- ---------- ------- --------- -------- Volume 5 D FAT32 Removable 7701 MB Healthy
The information starts out talking about a "USB Device," and ends up noting that the drive contains a drive with letter ("Ltr") D, so I know I was right. Now we're ready to wipe it, make it bootable, format it, and give it a drive letter like so, with the following final warning:
REMEMBER, ONLY RUN THESE COMMANDS AFTER YOU ARE 100 PERCENT SURE THAT YOUR SELECTED DISK IS THE RIGHT ONE. OTHERWISE, YOU MAY LOSE DATA THAT WOULD BE DIFFICULT OR IMPOSSIBLE TO RECOVER!
clean create partition primary active format fs=ntfs quick assign detail disk
Once that's done, I got some output that looked like this:
UDISK PDU01-8G B4H2.0 USB Device Disk ID: 00000000 Type : USB Status : Online Path : 0 Target : 0 LUN ID : 0 Location Path : UNAVAILABLE Current Read-only State : No Read-only : No Boot Disk : No Pagefile Disk : No Hibernation File Disk : No Crashdump Disk : No Clustered Disk : No Volume ### Ltr Label Fs Type Size Status Info ---------- --- ----------- ----- ---------- ------- --------- -------- * Volume 5 F NTFS Removable 7701 MB Healthy
Now I know that my stick's ready and that it's drive F:. Get out of Diskpart by typing
Next, mount the Win 8 Beta ISO, using whatever tool you like. As I use Virtual Clone Drive, I just right-click the ISO and choose "Mount Virtual Clone Drive." After a minute, I get an Explorer window showing me all of the contents of the ISO on an imaginary new drive D:. (Apparently VCD recycled the D: drive letter.) Then I just select all of the files on drive D: (ctrl-A), copy them to the Clipboard (ctrl-C), and then paste them into my new drive (right-click F: in Explorer, choose "Paste"), and go away for a while. (And yes, Explorer is fine for this job -- no strange folders, hidden files or the like to make the copy fail. Of course, robocopy d: f: * /s /mt:10 would work great.) When the copy's done, you can install Win 8 on any system lacking an optical drive by just booting from the USB stick and installing as normal. Believe me, this is sooo much faster than screwing around with burning DVDs, you'll never look back. And if you've got a USB 3.0 stick, remember... Windows 8 Setup understands USB 3.0 on most systems, and is gosh-darned fast. Cool, eh?
Retrieving a Sick Drive's Recoverable Files Quickly with Robocopy
My desktop includes a second hard drive where I keep data files of various kinds, but the two biggies are the "VMs" folder (virtual machines) and the "Photos" folder. A few days ago, it started acting wonky and I realized that it'd developed some bad areas which were causing Windows Backup to sort of run in the background pretty much all of the time, as it would first fail, and then apparently go back to that part of the drive that it couldn't read and keep trying, and trying, and trying... Now, I appreciate that it's a determined little terrier and really, really wants to read that sector for the five millionth time just in case it can get that data, but I'm not sure that constantly pounding an already-sick drive is a good idea -- and so I got a replacement drive and set out to copy the data from the dying drive to a new drive. Yes, I've got other backups, but they're not handy at the moment and basically all I want to do is to quickly get a copy of every file on the drive that's copy-able so I can throw away the bad drive and start off with a drive that's got 99.9% of the files from the bad drive.
The trouble is, it's really hard to do that. Basically there are two types of in-the-box or free approaches to transfer all of the contents of one drive to another: block-by-block copies (ImageX, Windows Backup/wbadmin) or file-by-file (Explorer, copy, xcopy, robocopy). Unfortunately, nearly all of them have the same problem: what to do when you try to read a bad sector? Some of them hit a bad sector, think about it for a bit and just give up, recovering no data at all (the image part of Windows Backup, wbadmin.exe), others hit a bad sector, think about it for five minutes, and then stop and ask you what to do, meaning that you've got to babysit the whole process, which isn't any fun when trying to recover files (Explorer). Still others just try and try and try and try, which, again, probably puts the last nails in the sick drive's coffin (robocopy, the file-by-file part of Windows Backup).
Scouring the documentation about wbadmin.exe, the Ghost-like drive copy system in Windows, I could not find a "skip bad sectors" option... darn. But what about robocopy? Here was my original robocopy attempt to get whatever was recoverable from the sick drive (e:) to the new one (f:).
robocopy e:\ f:\ * /s /mov /mt:10
That says to move all files and folders from drive E: to drive F: -- that's the "e: f: *" part -- and to recreate E:'s folder structure onto F: (/s), to move the files, meaning to delete any files from E: once they're safely on F: (/mov), and to create multiple threads to do it, getting it done more quickly and making the best use of my drive channels (/mt:10, which creates ten simultaneous threads). That worked extremely well, except for one problem: robocopy just wouldn't give up on the impossible-to-read files, waiting 30 seconds every time a particular "read" operation failed, and then trying it again, and again, and.... "Well, how many times is the silly thing going to retry?," I thought, and then remembered.
One. Million. Times.
Really -- I'm not kidding. Robocopy is the terrier of terriers here, and its creator baked in "do those retries a million times" as a default. So, I thought, there must be a way to stop retries, and of course there was: "/r:0," which means "do no retries." Heck, there's even an option "/REG," which says, "remember that particular desired number of retries in the Registry, and use it henceforth as the new default from now on." I friggin' love robocopy. The final command, then, was
robocopy e:\ f:\ * /s /mov /mt:10 /r:0
I was then able to go off to bed, arise the next morning and find that The Job Had Been Done, in about two and a half hours. Yes, I'd lost eight files, but I've got them on that distant backup. Oh, and in the process, I got an excuse to upgrade that "data drive" to a Seagate Momentus XT, a 750 GB 7200 RPM 2.5" drive with a bit of NVRAM built in to offer a bit better speed... very nice. I love a happy ending, don't you?
Postscript: If You're Trying to Recover a User's System Drive...
I got a great note from a reader, Chrissy Willow Rothgeb, who added something that I'd forgotten:
When recovering or backing-up data using Robocopy, you'll want to use the /xj (exclude junction) switch if copying data from a user's profile. With the advent of Vista and now Windows 7, part of what Microsoft has done to promote compatibility is create junction points throughout the file system. Usually this is quite okay, but I have found a cyclical junction within the Appdata directory. Instead of copying a few Megabytes of data, Robocopy winds up traversing the branch, copying gigabytes of redundant data in an ever deepening file structure until it hits the limit of the file system to support. Worse, when you try to go back and delete this branch of the tree in your copied data, Explorer's file system limitations are much shorter that what Robocopy can process, and thus you are blocked. My only solution is to follow the branch, renaming the affected directories to a single character until I eventually am able to delete the whole thing. It's quite frustrating at best.
Great advice, and I'd not thought of it because I was trying to recover a drive that contained data only. Many thanks, Chrissy!
And Another Postscript...
Reader Chris Villenueva offered this solution:
To Subscribe/Unsubscribe, Read Old Newsletters or Change Your Email Address
To subscribe, visit http://www.minasi.com/nwsreg.htm. To change e-mail or other info, link to http://www.minasi.com/edit-newsletter-record.htm. To unsubscribe, link to http://www.minasi.com/unsubs.htm. Visit the Archives at http://www.minasi.com/archive.htm. Please do not reply to this mail; for comments, please link to http://www.minasi.com/gethelp.
All contents copyright 2012 Mark Minasi. I encourage you to quote this material, SO LONG as you include this entire document; thanks.