Scott Hanselman

How to upgrade two out of four of your hard drives in Windows Home Server

April 16, '09 Comments [26] Posted in Home Server | Tools
Sponsored By

I love my Windows Home Server, it's saved my *ss and my marriage. ;) I bought an HP MediaSmart Home Server from Amazon. You can get various sizes, from 500gig up to 1.5 TB.

I think the best deal is to get the smallest one you can afford, and upgrade it when you start running out of space. That's what I did. You really can't go wrong because it's like butter (yes, rich, creamy butter) to upgrade.

When I first started, I had the two 500gig drives it came with. The HP supports up to FOUR drives at a time internally. Because I can't stand the empty slots, I threw in whatever drives I had lying around. I ended up with a 70gig (I have no idea why I put that) and a 300gig as drives 2 and 4. This gave me a total of about 1.25TB. This was fine when i started, as I only used up like 50% of the capacity.

image

Fast forward a year or so later, and I'd only had less than 20% left. A lot of space was taken up by backing up 6 different Home PCs, and a lot of was taken up by Family Photos and Videos from my new HD Camcorder. It was time to upgrade.

The system is always duplicating your files on as many disks as possible. It's not RAID, but it effectively gives you the same level of assurance that your data won't go missing. What's nice is that it supports drives of different sizes, rather than using either insisting on the same size driver, or using only the smallest drive size for all drives.

Here's how I upgraded my two smallest drives to new 1TB SATA Seagates.

Make as Much Room as Possible

This isn't 100% necessary, but I noticed that a LOT of my space was taken up by backups going back as far as 3 months. I really only needed the most recent ones, so I went into the Home Server Console and clicked "Backup" then "Backup Cleanup." This happens on Sundays automatically, but it's a good way to make a little space before a hardware upgrade like mine.

image

This operation, as with most "large scale" operations, will take a while. Maybe 10 minutes, maybe an hour, it depends on how large your stuff is.

Warn the Home Server you're Removing a Drive

Now you need to warn the Home Server that you're removing a drive. This is important so the Home Server can make sure ALL your files are sufficiently duplicated on more than just 1 drive. You are removing one, and it needs to make sure each file is on at least 2 other driver, as I understand it. This can also take a while, although it didn't for me.

I right-clicked the drive, clicked Remove. It tells me not to turn the machine off, etc.

3

When the drive is "remove" from the software, but not yet physically yanked out of the machine, it'll show up in the list as a "Non-Storage Hard Drive."

4

Notice that my free space went from 1.2TB to 1.02TB, so I lost about 200gig in this removal process. Also, at this point, the lights on the front of my server are 1 pink (the removed drive) and 3 blue (the remaining healthy drives.)

CIMG8787

You can technically pull these drives out and put them in with the machine is running, but I'm still paranoid and I figure it never hurts to shutdown first (which I didn't do in this particular picture.)

Swap the Drive Enclosures

I like the enclosures on the HP because they are tool-less. They require no screwdriver, you just pull aside one edge and these little rivets (not screws) pop themselves via a tension spring into the screw-holes on the sides of the drives.

CIMG8785

I put the new 1TB drive in the old drive's enclosure, and slide it into the HP. Push it into the machine, turn it on (again, I've done this hot-swap before, but still) and run the Home Server Console:

5

The drive shows up as a Non-Storage drive, but I just click Add and I'm given the choice to add the drive to server storage OR to use it to Backup the Home Server and my files. (I use an external drive for Server Backup.)

6

It'll run for a bit. After it's done, I tell the system to Remove the last small drive, and let it duplicate onto the larger one. Then I yanked the second small drive and repeat the process. Now Home Server reports I have 2.73TB total space, with 1.74TB free.

8

I like having the confidence that I can do this again at some point in the future with more cheap 1TB drives or larger. The whole operation took about an hour.

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 twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

Hanselminutes Podcast 157 - Hanselminutae-five with Richard Campbell

April 13, '09 Comments [8] Posted in Musings | Podcast
Sponsored By

My one-hundred-and-fifty-seventh podcast is up. Be warned! We may just waste your time with this show. It's Hanselminutae #5 with Richard Campbell. We talk books, Windows, Economics, being a Millionaire, Multiple Monitors, TweetDeck, and much much less!

Subscribe: Subscribe to Hanselminutes Subscribe to my Podcast in iTunes

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 a 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, we can provide the building blocks to take your application a step closer to your imagination. Explore the leading UI suites for ASP.NET and Windows Forms. Enjoy the versatility of our new-generation Reporting Tool. Dive into our online community. 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 twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

Hanselminutes Podcast 156 - Dealing with Diversity in Agile Teams with Aslam Khan

April 4, '09 Comments [6] Posted in Africa | Agile | Musings | Podcast | Programming
Sponsored By

zz11329426 My one-hundred-and-fifty-sixth podcast is up. Scott chats about Diversity with Aslam Khan. He is a software architect and coach from South Africa. He shares his experience growing up South African, and how he applies his experience to working with Agile software development teams. They also talk bout the African philosophy of "Ubuntu" (not the Linux Distro) and how it can be applied to diverse teams.

Subscribe: Subscribe to Hanselminutes Subscribe to my Podcast in iTunes

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 a 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, we can provide the building blocks to take your application a step closer to your imagination. Explore the leading UI suites for ASP.NET and Windows Forms. Enjoy the versatility of our new-generation Reporting Tool. Dive into our online community. 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 twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

The Weekly Source Code 40 - TweetSharp and Introducing Tweet Sandwich

April 3, '09 Comments [24] Posted in Open Source | Source Code | Windows Client | WPF | XML
Sponsored By

imageI just was at Quiznos hanging out with @QuiznosNick. He's a former Technology Executive who bought a Quiznos Franchise for his retirement. He's a major geek, and while chatting he wonder how he could take orders over Twitter. I wanted to see how easy it'd be to write as a real app. I could use PowerShell or Curl, but it's all in good fun, right?

For no reason at all, here is the thought process and code as I write it. I shall call it Tweet Sandwich.

Step 0 - Make it Pretty

Ok, WPF will do fine. Of course, before I do any work or planning or anything, I'll need an icon. ;) Search the web, find a nice, free non-commercial icon of a sandwich. Make it transparent with Paint.NET, make a 32x32 and a 16x16 at 24 bit color and paste into Visual Studio. Name it app.ico. Waste of time, perhaps, but it motivates me personally to do the pretty stuff first.

Take the Window1, call it Main and setup some controls. Grab a Free Twitter Bird PNG and a picture of a Sandwich, more Paint.NET and I've got a Main Form.

I tell you, being able to use Paint.NET and the clipboard, and a good understanding of how transparency works in Windows is an important skill to have. I'm no artist, but I can hack together a picture of a bird and a sandwich with the best of them.

Tweet Sandwich

What Settings Do I Need to Save

OK. Now, I put the Settings in the Properties dialog for the project.

image

Then I'll put in some small databinding code to make the text boxes in the form fill with the data from the settings.

<Window x:Class="TakeOrdersOverTwitterWPF.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Tweet Sandwich" Height="459" Width="454"
xmlns:local="clr-namespace:TakeOrdersOverTwitterWPF.Properties">
<Window.Resources>
<local:Settings x:Key="settings" />
</Window.Resources>
<Grid>
<GroupBox Header="Settings" Name="groupBox1">
<Grid DataContext="{StaticResource settings}" >
<TextBox Name="twitterUserName" Text="{Binding Path=Default.TwitterUserName}"/>
...etc...

The keys are the Settings Resource that maps to the Properties (Settings) for the app. Then the Binding to the TextBox. Then we save them when the app closes with Settings.Default.Save();

How Often Will I Check For Orders?

Now, I'll setup a Timer to check for orders every five minutes:

DispatcherTimer twitterTimer = null;

private void Window_Loaded(object sender, RoutedEventArgs e)
{
this.twitterTimer = new DispatcherTimer(new TimeSpan(0, 5, 0), DispatcherPriority.Normal, CheckForOrders, this.Dispatcher);
}

private void CheckForOrders(object sender, EventArgs e)
{
...
}

Gotta GET the Twitter Feed now...check the Twitter API. Do I want RSS or an API? The Twitter API has a REST model, and I need to see the replies to QuiznosNick, so I'll need to add some options to my application. I'll need to authenticate as QuiznosNick and ask for his replies list. I need his username and password. I'll probably want to call this API, which will let me see replies since some time. Looks like I can use the Date, or a status id, which is a big number that keeps getting bigger.

statuses/replies

Returns the 20 most recent @replies (status containing @username) for the authenticating user.

URL: http://twitter.com/statuses/replies.format

Formats: xml, json, rss, atom

Method(s): GET

Parameters:

  • since_id.  Optional.  Returns only statuses with an ID greater than (that is, more recent than) the specified ID.  Ex: http://twitter.com/statuses/replies.xml?since_id=12345
  • max_id. Optional.  Returns only statuses with an ID less than (that is, older than) the specified ID.  Ex: http://twitter.com/statuses/replies.xml?max_id=54321
  • since.  Optional.  Narrows the returned results to just those replies created after the specified HTTP-formatted date, up to 24 hours old.  The same behavior is available by setting an If-Modified-Since header in your HTTP request.  Ex: http://twitter.com/statuses/replies.xml?since=Tue%2C+27+Mar+2007+22%3A55%3A48+GMT
  • page.  Optional. Retrieves the 20 next most recent replies.  Ex:http://twitter.com/statuses/replies.xml?page=3

Returns: list of status elements

How Will I Call Twitter?

I could just make a call to Twitter using WebClient and Basic Auth, but since I'll only be paid in Sandwiches, I'll use TweetSharp. It's a smidge overkill for one API call, but it'll let me figure out if TweetSharp is fun or not. I could have also used LinqToTwitter, so try them both out and make your own judgment.

Here's how you would get the replies for an authenticated user using TweetSharp. I might switch this over to DirectMessages, which is less fun, but more secure, if things become a problem.

TwitterClientInfo info = new TwitterClientInfo() { ClientName = "TweetSandwich", ClientVersion = "1.0" };
var twitter = FluentTwitter.CreateRequest(info)
.AuthenticateAs(twitterUserName.Text, Password.Password)
.Statuses()
.Replies().AsXml();

string result = twitter.Request();

At this point, "result" has the XML I want in it.

Text Visualizer (3) 

The general structure of the nodes I'll need is:

statuses
status
created_at
id
text
user
id
name
location

I want "all status's greater than the lastid, and from those, extract the text, user id, name and location, sorting by created_at descending." In LINQ to XML, that might be:

XDocument doc = XDocument.Parse(result);
var statuses = (from d in doc.Descendants("status")
where int.Parse(d.Element("id").Value) > lastOrderNum
where d.Element("text").Value.Contains(orderString.Text)
select new
{
tweetid = int.Parse(d.Element("id").Value),
name = d.Element("user").Element("name").Value,
location = d.Element("user").Element("location").Value,
tweet = d.Element("text").Value,
dateTime = d.Element("created_at").Value.ParseTwitterDateTime()
}).OrderByDescending(t => t.dateTime);

However, TweetSharp has an object model that will deserialize JSON so I don't even need to do this. I can use their objects and still use LINQ, which makes this even cleaner. I can avoid all the strings and the dataType conversions as it's all hidden. Not to mention the hacky ParseTwitterDateTime extension method I got from Wally that he got from Tim Heuer.

TwitterClientInfo info = new TwitterClientInfo() { ClientName = "TweetSandwich", ClientVersion = "1.0" };
var replies = FluentTwitter.CreateRequest(info)
.AuthenticateAs(twitterUserName.Text, Password.Password)
.Statuses()
.Replies()
.Since(lastOrderNum)
.AsJson();

IEnumerable<TwitterStatus> statuses = replies.Request().AsStatuses();

var statusesFiltered = from d in statuses
where d.Id > lastOrderNum
where d.Text.IndexOf(orderString.Text, StringComparison.OrdinalIgnoreCase) != -1
orderby d.CreatedDate descending
select d;

Printing Orders

Now I just need to print them out. Every Quiznos has the same computer and the same printer that they got from the corporate office. I don't care though, I'll just print out an order on whatever default printer they have.

Printing is hard, and I only allocated a few hours to do this, but Printing a "Visual Object" in WPF is easy.

PrintDialog dlg = new PrintDialog();
dlg.PrintVisual(orderCanvas, "Whatever");

I could just make a Canvas with a bunch of controls to represent the last tweeted order, and print that. 

Tweet Sandwich (2)

However, the last time I did anything with Printing it was VB6 and it was hard. How hard it is now to make a real document today in WPF?  I figured I'd find out by trying.

I thought I'd use these FlowDocuments and make one that can show a Tweet. I went File | Add New Item | FlowDocument and call it SandwichOrder.xaml.

Add New Item - TakeOrdersOverTwitterWPF

I made a FlowDocument as a Resource that looked like this I could do it manually, do it in Word and save it, or use an HTML to XAML converter as others have.

<FlowDocument xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
FontSize="24" FontFamily="Georgia">
<Paragraph>
<TextBlock Text="{Binding Path=User.ScreenName}"/> in
<TextBlock Text="{Binding Path=User.Location}"/>
says on <TextBlock Text="{Binding Path=CreatedDate}"/>:
</Paragraph>
<Paragraph FontFamily="Arial">
<TextBlock Text="{Binding Path=Text}"/>
</Paragraph>
</FlowDocument>

I figured I want to DataBind to it, using the TweetSharp TwitterStatus object. Dynamically creating a document from a resource template, binding to it and printing it seems like a core scenario. Googling around, though found a lot of people having trouble with a few basic things that I was hitting into also.

NOTE: I might be doing this wrong, so I need to ask a WPF expert at Microsoft to see if I'm wrong about some things I think are too hard.

Dynamically Creating a FlowDocument, Data Binding and Printing It

First, I wrote this:

private void PrintOrder(TwitterStatus t)
{
var streamInfo = Application.GetResourceStream(new Uri("resources/SandwichOrder.xaml",UriKind.Relative));
FlowDocument doc = XamlReader.Load(streamInfo.Stream) as FlowDocument;
doc.DataContext = t;
PrintDialog dlg = new PrintDialog();
dlg.PrintDocument(((IDocumentPaginatorSource)doc).DocumentPaginator,"Tweeted Sandwich Order");
}

I felt OK about it, but not awesome. First, it was too hard to get my FlowDocument out of the Embedded Resource. I thought I could do something like App.Resources["SandwichOrder.xaml"]. I also wanted to do lines one and two in all one like like: var doc = FlowDocument.FromResource("SandwichOrder.xaml").

Finally, the weird interface cast in the PrintDocument line was totally counter intuitive. Seemed like PrintDocument should have an overload that takes a FlowDocument.

Then I tried to print. When I printed, the data binding didn't happen. I just got the basic text. More Googling showed there's a threading issue and the binding happens on another thread?

Now I had to add what appears to be the WPF equivalent of "DoEvents" - that big dispatcher call that releases the thread to do pending stuff. This CAN'T be right. I MUST be doing something wrong, so I'll update this post as I learn.

private void PrintOrder(TwitterStatus t)
{
var streamInfo = Application.GetResourceStream(new Uri("resources/SandwichOrder.xaml",UriKind.Relative));
FlowDocument doc = XamlReader.Load(streamInfo.Stream) as FlowDocument;
doc.DataContext = t;
Dispatcher.CurrentDispatcher.Invoke(DispatcherPriority.SystemIdle, new DispatcherOperationCallback(delegate { return null; }), null);
PrintDialog dlg = new PrintDialog();
dlg.PrintDocument(((IDocumentPaginatorSource)doc).DocumentPaginator,"Tweeted Sandwich Order");
}

After this printing and databinding worked, except the TextBlocks I was using didn't wrap, so the orders got clipped. I tried using a <Run> but they don't support DataBinding. I ended up having to add a BindableRun class as more Googling showed more confusion. Folks have created Bindable Tables also, it seems and this BindableRun pattern seems common. I need to check on why this isn't built in.

Now my FlowDocument looks like this:

<FlowDocument xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:bt="clr-namespace:TakeOrdersOverTwitterWPF.BindableText;assembly=TakeOrdersOverTwitterWPF"
FontSize="24" FontFamily="Arial">
<Paragraph FontSize="48">Twitter Order</Paragraph>
<Paragraph>
<bt:BindableRun BoundText="{Binding Path=User.Name}" />
(<bt:BindableRun BoundText="{Binding Path=User.ScreenName}" />) in
<bt:BindableRun BoundText="{Binding Path=User.Location}" /> says on
<bt:BindableRun BoundText="{Binding Path=CreatedDate}" /> :
</Paragraph>
<Paragraph FontFamily="Arial">
<bt:BindableRun BoundText="{Binding Text}" />
</Paragraph>
</FlowDocument>

And it prints exactly as it should. So, for printing, to recap, I:

  • Made a Template FlowDocument and embedded it as a Resource
    • Had to use a BindableRun
  • Pulled it out of the resuorce, DataBinding, did a weird dispatcher hack, printed it.

Too much Googling on that one. It wasn't nearly as obvious to print as it was to do the Graphical UI.

image

This app, modified, could be used to waste dead trees by printing out tweets that contain words. Mark Nijhof is using TweetSharp to tweet what he blogs. It could also make the computer beep when a sandwich order arrives. Oh! There's an idea!

Tomorrow at lunch, I'll present Tweet Sandwich, the first automated Twitter-based Sandwich Ordering System to @QuiznosNick and hope I earned a free sandwich or ten. ;)

Download the Source from SkyDrive

Please offer feedback, as I'm sure there's lots of ways this can be cleaner. For example, a bound listbox of Replies/Orders (starts to look like a real Twitter Client, then.)

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 twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

Microsoft ASP.NET MVC 1.0 is now Open Source MS-PL

April 2, '09 Comments [23] Posted in ASP.NET | ASP.NET MVC
Sponsored By

iStock_000003337699XSmall The source for ASP.NET MVC has long been available up at http://www.codeplex.com/aspnet. The source has been "Available" so I usually call this "Source Opened" as opposed to "Open Source."

ASP.NET MVC has been "Free" as in "Gratis" since it started. That means, "Free like Beer." As ScottGu just blogged about moments ago, today, it's also "Libre" as in "Free like Speech." You can do what you want with the source. 

Today, ASP.NET MVC is now Open Source and licensed under MS-PL. That means you can change it, redistribute your changes, even fork it if you want. MS-PL is an OSI-Approved Open Source License and you can read the legalese on their site.

"The Ms-PL contains no platform restrictions and provides broad rights to modify and redistribute the source code."

As a reminder, MEF (Managed Extensibility Framework) is another .NET Framework component that's MS-PL, as is the DLR (Dynamic Language Runtime) and IronRuby. The Ajax Control Toolkit and Silverlight Toolkit is also MS-PL.

These are all baby steps, but more and more folks at The Company are starting to "get it." We won't rest until we've changed the way we do business.

If you like, you can download and install ASP.NET MVC 1.0 from inside of the Web Platform Installer 2.0 directly.

Congrats to ScottGu and PhilHa and the team for making this happen. Now, go bask in the source as the ASP.NET MVC 1.0 download has been updated with a zip of the source. I hope Miguel is dancing today.

If you have any questions about the future, legal stuff, etc, I'll defer them to ScottGu (leave them in his comments).

(This is not an April Fools joke. It's for reals.)

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 twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb

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