Scott Hanselman

BACKUP YOUR CRAP: Missing Operating System, Backups, Disk Images, Home Servers, BootRec, BootMgr, RebuildBCD, FixBoot and Problems, Plural

December 08, 2010 Comment on this post [55] Posted in Hardware | Musings
Sponsored By

HanselmanDesktopDecember2010 Today I was sitting in what I like to call "Conference Room B" but what other people call "Quiznos Sandwiches," talking to Damian and Vishal over Office Communicator. We were running a meeting and sharing screens and suddenly my laptop's little hard drive light started going bananas.

OK. That's bad, but I've seen it before.

I hit CTRL-ALT-DEL to bring up Task Manager, but nothing happened. About 30 seconds later I got a message from Windows saying basically "um, I totally see that you hit Ctrl-Alt-Del and I told that security screen to come up but him no worky."

I've seen this dialog literally like TWICE in my life. That's bad.

So I'm sitting there watching this light *BOOM* WHOA*** BLUE SCREEN.

Whoa! Ok, so it's writing out the memory dump....WHAT? Error Writing Dump, Hardware Failure, NO CARRIER...

I've never seen that. Ever.

I reboot.

BIOS says Hardware Device Error. The hard drive is dead. My year old $600 OCZ VerteX SSD that I bought myself and put in my work computer to be more productive is dead. And not dead in that plug it into another machine kind of dead. Not in a Super Nintendo blow hard on the contacts and reinsert kind of dead. Not in a Jonah Hex touch me and come back to life just for a minute dead. Not AMC's Walking Dead.

It's a coaster now.

I leave Quiznos that moment, walk over to the local computer shop and say "proprietor! Sell me your finest hard drive!" He has a single random 500gig 7200RPM laptop HD he sells me for $77.

I go home and boot off my Windows Home Server Restore CD. My machine was backed up this morning at 2am. Restore takes a few hours over wired Ethernet and I boot.

However...I forgot I had some 100meg System Partition on my laptop that isn't backed up, so I get No Operating System Found. Not to be confused with "Missing Operating System," this means that my machine was totally restored, except for the boot stuff that's needed. That was on that little 100 meg partition.

I boot into my Windows Disk, and when it comes up to the first menu, I hit SHIFT-F10. That brings up a command prompt. They hide it with that obscure hotkey because Captain, Thar Be Whales Here. You can get hurt.

I type

DISKPART

In case you haven't figured it out, if you find yourself typing DISKPART, EVER in your life, you've got problems. Plural.

Then from the prompt:

DISKPART> list disk

Disk ###  Status          Size   Free
--------  --------------- ------ -----
Disk 0    Online          465 GB   0 B

DISKPARK> select disk 0

Disk 0 is now the selected disk

DISKPART> list partition

Partition ###  Type       Size 
-------------  ---------  ------- 
Partition 1    Primary    465 GB

DISKPART> select partition 1

Partition 1 is now the selected partition

DISKPART> active

Partition 1 is now active

Then I reboot, startup with the Windows 7 DVD again and go back into the Windows Recovery console with F10 from the first dialog.

Now it's Boot Sector time, son!

I've got a Windows installation on C:\Windows on an active partition. That's the one I restored from a disk image, remember?

However, I've got no boot information, no master boot record (MBR) and no Boot Configuration Data (BCD.)

From the recovery command line:

BCDBOOT c:\windows

Then

BOOTREC /FIXMBR
BOOTREC /FIXBOOT
BOOTREC /REBUILDBCD

After this I rebooted and was greeted by the most beautiful sight I've seen today. My desktop. Exactly as it was this morning at 2am.

My other files? The ones I changed? Safe in DropBox and syncing from the cloud to my machine as we speak, Dear Reader.

Sure, I realize that all this command line partitioning was an edge case and not completely related to my whole message of "backup your stuff," but this was my afternoon, so I've shared it with you.

Conclusion

  • Have a backup strategy my friends. Not only that, but seriously, test your restores. Backups are great. I do them all the time. Backups always work. Restores fail all the time.
  • Backup some stuff to the cloud. I don't care whose cloud, pick one. I used to use Mozy, now I use KeepVault because it backs up my Windows Home Server to the cloud, as well as my desktops.
  • Make local disk images to external hard drives. I have a 2TB external drive that I make weekly images to use Acronis TrueImage. Just in case everything goes bad. If you are a presenter and traveler type like me, always be ready with a Virtual Machine on a USB Key or a Disk Image on a hard drive in case things go bad the night before a presentation.
  • You can make VHD (Virtual Hard Drive) images from physical disks for free with Disk2VHD if you're really fancy and advanced.
  • Given what's going on with Windows Home Server and Drive Extender, I don't know what to think. I can say though, that this is the fourth time that having a drive image (not just files backups) have had me typing on the same machine that died the very same day.

Friends. Stop. Go backup your machines. Then backup your spouse's, girlfriend's, boyfriend's, parents, grandparents and Uncle Ronnie's.

Related Links

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook bluesky subscribe
About   Newsletter
Hosting By
Hosted on Linux using .NET in an Azure App Service

This Developer's Life 1.0.9 - Management

December 04, 2010 Comment on this post [5] Posted in Podcast
Sponsored By

dilbert-boss In this episode of This Developer's Life 1.0.9, Rob and I talk to technical folks who have moved on up to Management - and what it means to them.

  • Mark Freedman shares his story about clawing his way out of a successful career as a manager at a rather large, growing company. A good job, lots of respect, and he hates it.
  • Bertrand LeRoy talks about charting his own path right at Microsoft after graduating with a PhD in Physics and how he maintains a career right down in the middle of manager and coder.
  • Todd Baesen talks about moving from Chemical Engineer to Nuclear Engineer on the USS Enterprise (literally), and then to senior management at a big engineering firm in the SF Bay Area.

You can download the MP3 here (58 minutes) and visit our site at http://thisdeveloperslife.com.

Please consider subscribing with iTunes, or Zune. Or if you have a BitTorrent client and would like to help save us bandwidth money, as well as the bragging rights of downloading legal torrents via RSS, get our Torrent Feed at ClearBits.

The bandwidth and other costs for this week's show were picked up by Twilio:

Need SMS or Voice call capabilities for your application? Check out Twilio.

… and SublimeSVN

sublime

Easy Subversion Management for Windows

See you next time!

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook bluesky subscribe
About   Newsletter
Hosting By
Hosted on Linux using .NET in an Azure App Service

Hanselminutes Podcast 243 - Knockout JavaScript with Steve Sanderson

December 04, 2010 Comment on this post [1] Posted in ASP.NET | ASP.NET MVC | Javascript | Open Source | Podcast
Sponsored By

homepage-exampleSteve Sanderson has created an interesting MVVM JavaScript library for ASP.NET MVC called Knockout. Yes, you read that right! MVVM on the client, MVC on the server, living together happily may make a more enjoyable development experience. All this plus HTML, data binding, jQuery, text boxes over data, ASP.NET and more.

Download: MP3 Full Show

NOTE: If you want to download our complete archives as a feed - that's all 243 shows, subscribe to the Complete MP3 Feed here.

Also, please do take a moment and review the show on iTunes.

Subscribe: Subscribe to Hanselminutes or Subscribe to my Podcast in iTunes or Zune

Do also remember the complete archives are always up and they have PDF Transcripts, a little known feature that show up a few weeks after each show.

Telerik is our sponsor for this show.

Building quality software is never easy. It requires skills and imagination. We cannot promise to improve your skills, but when it comes to User Interface and developer tools, we can provide the building blocks to take your application a step closer to your imagination. Explore the leading UI suites for ASP.NET AJAX,MVC,Silverlight,Windows Forms and WPF. Enjoy developer tools like .NET Reporting, ORM, Automated Testing Tools, Agile Project Management Tools, and Content Management Solution. And now you can increase your productivity with JustCode, Telerik’s new productivity tool for code analysis and refactoring. Visit www.telerik.com.

As I've said before this show comes to you with the audio expertise and stewardship of Carl Franklin. The name comes from Travis Illig, but the goal of the show is simple. Avoid wasting the listener's time. (and make the commute less boring)

Enjoy. Who knows what'll happen in the next show?

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook bluesky subscribe
About   Newsletter
Hosting By
Hosted on Linux using .NET in an Azure App Service

Hanselminutes Podcast 242 - The Plight of the Remote Worker with Pete Brown

December 03, 2010 Comment on this post [6] Posted in Podcast | Remote Work
Sponsored By

LiveMeeting with a Panorama viewScott and Pete have both worked for Microsoft for a while now as remote workers. What works, what doesn't? Why is Scott obsessed with video portals and cameras and does it help? Pete shares his thoughts and tips on the remote life.

Download: MP3 Full Show

Links from the Show

NOTE: If you want to download our complete archives as a feed - that's all 242 shows, subscribe to the Complete MP3 Feed here.

Also, please do take a moment and review the show on iTunes.

Subscribe: Subscribe to Hanselminutes or Subscribe to my Podcast in iTunes or Zune

Do also remember the complete archives are always up and they have PDF Transcripts, a little known feature that show up a few weeks after each show.

Telerik is our sponsor for this show.

Building quality software is never easy. It requires skills and imagination. We cannot promise to improve your skills, but when it comes to User Interface and developer tools, we can provide the building blocks to take your application a step closer to your imagination. Explore the leading UI suites for ASP.NET AJAX,MVC,Silverlight,Windows Forms and WPF. Enjoy developer tools like .NET Reporting, ORM, Automated Testing Tools, Agile Project Management Tools, and Content Management Solution. And now you can increase your productivity with JustCode, Telerik’s new productivity tool for code analysis and refactoring. Visit www.telerik.com.

As I've said before this show comes to you with the audio expertise and stewardship of Carl Franklin. The name comes from Travis Illig, but the goal of the show is simple. Avoid wasting the listener's time. (and make the commute less boring)

Enjoy. Who knows what'll happen in the next show?

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook bluesky subscribe
About   Newsletter
Hosting By
Hosted on Linux using .NET in an Azure App Service

BIN Deploying ASP.NET MVC 3 with Razor to a Windows Server without MVC installed

November 24, 2010 Comment on this post [39] Posted in ASP.NET | ASP.NET MVC
Sponsored By

If someone says "just bin Deploy it" they mean "deploy the application with the dependencies copied into the application's /bin folder, rather than running an MSI that installs the dependencies into the Global Assembly Cache (GAC)."

You may not have administrative control over your Web Server and your host may not want you running installers when new stuff like ASP.NET MVC 3 and Razor comes out. You'll want to "bin deploy" these new technologies.

Here's two ways. The simple way and The Awesome Way.

The Manual Way to BIN Deploy ASP.NET MVC 3 with Razor

On your development machine that has ASP.NET MVC 3 installed you have a C:\Program Files\Microsoft ASP.NET\ASP.NET MVC 3 folder and a C:\Program Files (x86)\Microsoft ASP.NET\ASP.NET Web Pages folder. In those folders are "Assemblies" folders.

Windows Explorer showing the Assemblies that ASP.NET MVC and Web Pages needs for BIN Deployment

ASP.NET MVC itself references these additional assemblies.

  • System.Web.Mvc (well, we ARE this assembly, actually)
  • Microsoft.Web.Infrastructure
  • System.Web.Razor
  • System.Web.WebPages
  • System.Web.WebPages.Razor

And the default Web.config for projects also expects:

  • System.Web.Helpers

After you deploy your ASP.NET MVC 3 Razor application, you'll need to manually copy these five assemblies to the \bin folder of your deployed application.

NOTE: It's possible to just reference these assemblies directly from your application, then click properties on each one and set copyLocal=true. Then they'd get automatically copied to the bin folder. However, I have a problem with that philosophically. Your app doesn't need a reference to these assemblies. It's assemblies your app depends on. A depends on B that depends on C. Why should A manually set a dependency on C just to get better deployment? More on this, well, now.

Now, you likely remember that "If you're using XCOPY for deployment, you're doing it wrong" so you're likely wondering how to make this deployment process less manual and more awesome.

The Alpha-Geek Show-Off Fancy-Pants Future-Proofed Way to BIN Deploy ASP.NET MVC 3 with Razor

I created a custom Windows 7 Virtual Machine that had only IIS7 and .NET 4 installed, plus Web Deploy, and nothing else in order to test this scenario. This machine has never seen ASP.NET MVC 3 or Razor and we're not installing anything on it. It's our pretend "shared host."

My custom Virtual Machine without ASP.NET MVC installed

In my ASP.NET MVC Application, I'm going to create a folder called "_bin_deployableAssemblies." Yes, that's a underscore in the front. IIS will not serve from folders whose first character is an underscore. You can thanks FrontPage for that feature. In fact, this guarantees that even if you accidentally copy this folder up (don't) it won't be served. Apparently I got bad info on this from the IIS team. I'm looking into this statement as it's incorrect.

  • Create a _bin_deployableAssemblies folder.
  • Copy the assemblies we want bin deployed into this _bin_deployableAssemblies folder.
  • Select them all, right click and hit properties. Set their Build Action to "None."
  • You are expected to check these into source control as well.

Here's my Solution so far:

My Solution Folder View

Here comes the secret awesome sauce.

NOTE: You're reading this on some random dude's blog, so lower your expectation of support now. No, lower. Bit lower. There. Yes, that's zero support. If this accidentally formats your harddrive or deletes your source code, kick yourself hard so you'll wake up to the previous level of Inception, specifically the one where the skinny kid from Third Rock From The Sun is walking on the ceiling. Be careful. Make backups.

Get ready, because we are going into the belly of the beast. This is for VS2010, to be clear. Also, your Program Files folder will vary depending on your x86/x64 version of Windows.

  • Go into C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\WebApplications and make a copy of this folder. Put it somewhere safe.
  • Go  into C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\Web and make a copy of this folder. Put it somewhere safe.
  • Download this file and unzip it somewhere: FancyAndTotallyUnsupportedMSBuildFilesForBinDeployableAssemblies.zip
  • Inside is:
    • "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\WebApplications\Microsoft.WebApplication.targets"
    • "C:\Program Files (x86)\MSBuild\Microsoft\VisualStudio\v10.0\Web\Microsoft.Web.Publishing.OnlyFilesToRunTheApp.targets"
  • Copy these new files OVER your existing ones (remember, the ones you backed up?)

Now when you build your Web Application, all the files that are in _bin_deployableAssemblies will automatically get copied into your /bin folder.

This is better than a simple Post Build Step Batch File because it works specifically with publishing. Now, you can right click on your Web Project and "Publish..." an the bin folder contain your project's build output PLUS the _bin_deployableAssemblies folder.

Build Deployment Package

I could publish directly to my Shared Host, or I can Build Deployment Package and get a ZIP file with all the things my app needs.

For me, as I have a VM (remember that I put Web Deploy on it?) and from IIS Manager just "Import Application." Some hosters have a control panel for this, but you'll likely use Web Deploy or Publish via FTP.

Import Application from inside IIS7 with WebDeploy

This is a nice, clean, self-contained way to bin deploy an ASP.NET MVC 3 application with Razor views to a host that doesn't have any of these bits installed.

INTERESTING NOTE: In a "future update to Visual Studio 2010" (that's marketing code for SP1, which I'm not allowed to say) this feature will be built in. Because with this hack we've only messed with our built-in build targets, those files we've modified will be torched (replaced) with the new Visual Studio updated files, effectively undoing what we've done here. It's a "future-proofed hack."

Enjoy!

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook bluesky subscribe
About   Newsletter
Hosting By
Hosted on Linux using .NET in an Azure App Service

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.