Scott Hanselman

The real and complete story - Does Windows defragment your SSD?

December 3, '14 Comments [58] Posted in Win7 | Win8
Sponsored By

There has been a LOT of confusion around Windows, SSDs (hard drives), and whether or not they are getting automatically defragmented by automatic maintenance tasks in Windows.

There's a general rule of thumb or statement that "defragging an SSD is always a bad idea." I think we can agree we've all heard this before. We've all been told that SSDs don't last forever and when they die, they just poof and die. SSDs can only handle a finite number of writes before things start going bad. This is of course true of regular spinning rust hard drives, but the conventional wisdom around SSDs is to avoid writes that are perceived as unnecessary.

Does Windows really defrag your SSD?

I've seen statements around the web like this:

I just noticed that the defragsvc is hammering the internal disk on my machine.  To my understanding defrag provides no value add on an SSD and so is disabled by default when the installer determines the disk is SSD.  I was thinking it could be TRIM working, but I thought that was internal to the SSD and so the OS wouldn’t even see the IO.

One of the most popular blog posts on the topic of defrag and SSDs under Windows is by Vadim Sterkin. Vadim's analysis has a lot going on. He can see that defrag is doing something, but it's not clear why, how, or for how long. What's the real story? Something is clearly running, but what is it doing and why?

I made some inquiries internally, got what I thought was a definitive answer and waded in with a comment. However, my comment, while declarative, was wrong.

Windows doesn’t defrag SSDs. Full stop. If it reports as an SSD it doesn’t get defraged, no matter what. This is just a no-op message. There’s no bug here, sorry. - Me in the Past

I dug deeper and talked to developers on the Windows storage team and this post is written in conjunction with them to answer the question, once and for all

"What's the deal with SSDs, Windows and Defrag, and more importantly, is Windows doing the RIGHT THING?"

It turns out that the answer is more nuanced than just yes or no, as is common with technical questions.

The short answer is, yes, Windows does sometimes defragment SSDs, yes, it's important to intelligently and appropriately defrag SSDs, and yes, Windows is smart about how it treats your SSD.

The long answer is this.

Actually Scott and Vadim are both wrong. Storage Optimizer will defrag an SSD once a month if volume snapshots are enabled. This is by design and necessary due to slow volsnap copy on write performance on fragmented SSD volumes. It’s also somewhat of a misconception that fragmentation is not a problem on SSDs. If an SSD gets too fragmented you can hit maximum file fragmentation (when the metadata can’t represent any more file fragments) which will result in errors when you try to write/extend a file. Furthermore, more file fragments means more metadata to process while reading/writing a file, which can lead to slower performance.

As far as Retrim is concerned, this command should run on the schedule specified in the dfrgui UI. Retrim is necessary because of the way TRIM is processed in the file systems. Due to the varying performance of hardware responding to TRIM, TRIM is processed asynchronously by the file system. When a file is deleted or space is otherwise freed, the file system queues the trim request to be processed. To limit the peek resource usage this queue may only grow to a maximum number of trim requests. If the queue is of max size, incoming TRIM requests may be dropped. This is okay because we will periodically come through and do a Retrim with Storage Optimizer. The Retrim is done at a granularity that should avoid hitting the maximum TRIM request queue size where TRIMs are dropped.

Wow, that's awesome and dense. Let's tease it apart a little.

When he says volume snapshots or "volsnap" he means the Volume Shadow Copy system in Windows. This is used and enabled by Windows System Restore when it takes a snapshot of your system and saves it so you can rollback to a previous system state. I used this just yesterday when I install a bad driver. A bit of advanced info here - Defrag will only run on your SSD if volsnap is turned on, and volsnap is turned on by System Restore as one needs the other. You could turn off System Restore if you want, but that turns off a pretty important safety net for Windows.

One developer added this comment, which I think is right on.

I think the major misconception is that most people have a very outdated model of disk\file layout, and how SSDs work.

First, yes, your SSD will get intelligently defragmented once a month. Fragmentation, while less of a performance problem on SSDs vs traditional hard drives is still a problem. SSDS *do* get fragmented.

It's also worth pointing out that what we (old-timers) think about as "defrag.exe" as a UI is really "optimize your storage" now. It was defrag in the past and now it's a larger disk health automated system.

Used under CC. Photo by Simon WüllhorstAdditionally, there is a maximum level of fragmentation that the file system can handle. Fragmentation has long been considered as primarily a performance issue with traditional hard drives. When a disk gets fragmented, a singular file can exist in pieces in different locations on a physical drive. That physical drive then needs to seek around collecting pieces of the file and that takes extra time.

This kind of fragmentation still happens on SSDs, even though their performance characteristics are very different. The file systems metadata keeps track of fragments and can only keep track of so many. Defragmentation in cases like this is not only useful, but absolutely needed.

SSDs also have the concept of TRIM. While TRIM (retrim) is a separate concept from fragmentation, it is still handled by the Windows Storage Optimizer subsystem and the schedule is managed by the same UI from the User's perspective. TRIM is a way for SSDs to mark data blocks as being not in use. Writing to empty blocks on an SSD is faster that writing to blocks in use as those need to be erased before writing to them again. SSDs internally work very differently from traditional hard drives and don't usually know what sectors are in use and what is free space. Deleting something means marking it as not in use. TRIM lets the operating system notify the SSD that a page is no longer in use and this hint gives the SSD more information which results in fewer writes, and theoretically longer operating life. 

In the old days, you would sometimes be told by power users to run this at the command line to see if TRIM was enabled for your SSD. A zero result indicates it is.

fsutil behavior query DisableDeleteNotify

However, this stuff is handled by Windows today in 2014, and you can trust that it's "doing the right thing." Windows 7, along with 8 and 8.1 come with appropriate and intelligent defaults and you don't need to change them for optimal disk performance. This is also true with Server SKUs like Windows Server 2008R2 and later.

Conclusion

No, Windows is not foolishly or blindly running a defrag on your SSD every night, and no, Windows defrag isn't shortening the life of your SSD unnecessarily. Modern SSDs don't work the same way that we are used to with traditional hard drives.

Yes, your SSD's file system sometimes needs a kind of defragmentation and that's handled by Windows, monthly by default, when appropriate. The intent is to maximize performance and a long life. If you disable defragmentation completely, you are taking a risk that your filesystem metadata could reach maximum fragmentation and get you potentially in trouble.

Related Links

* photo by Simon Wüllhorst, used under CC BY 2.0.

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 ORCS Web

Video: My non-technical partner tries Windows 10 for the first time

October 23, '14 Comments [23] Posted in Win10 | Win8
Sponsored By

You may have watch my YouTube series on being an effective user of Windows 8 and 8.1. I've made a short URL for you to give to your friends and family http://hanselman.com/windows8. It'll take you to a YouTube Playlist that includes all my best tips and tricks on using Windows. The most popular is "Learning Windows 8 in 3 minutes" but if you're looking to get yourself, or perhaps non-technical Dad and Mom up to date on Windows 8, I recommend they check out "Windows 8: The Missing Instruction Manual." It's calmly paced and explains everything they'll need to know.

A lot of people say "Windows 8 isn't intuitive." That's up for debate, I think, as there's a big difference between unfamiliar and unintuitive. A few minutes of your time and you'll feel a lot more "intuitively" about Windows.

That said, Windows 10 is coming. If you have an extra machine you can sign up for the Preview here. It's very early and I would not put this on your primary machine.

I thought it would be interesting to show my very smart, but rather non-technical wife Windows 10 for the first time. Here's an uncut video of her experience running the first build of the Windows 10 Technical Preview.

I encourage you to watch it, it's rather interesting the way that she discovers "new" features, but also learns about existing features from as far back as Windows 7. If you've ever do a usability test you'll find the interactions fascinating.

And again, do check out and share http://hanselman.com/windows8


Sponsor: Big thanks to my friends at Octopus Deploy. They are the deployment secret that everyone is talking about. Using NuGet and powerful conventions, Octopus Deploy makes it easy to automate releases of ASP.NET applications and Windows Services. Say goodbye to remote desktop and start automating today!

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 ORCS Web

Fixing the Touch Screen in Windows 8.1 on my old HP TouchSmart with NextWindow Drivers

August 8, '14 Comments [16] Posted in Win8
Sponsored By

HP TouchSmartWe've got an older HP TouchSmart all in one computer that we use as the "Kitchen PC." It's basically a browsing, emails, YouTube, and recipes machine. It's lovely machine, really. I've actually seen them at Goodwill, in fact, for cheap. If you can pick one up inexpensively, I recommend it.

Mine was starting to get sick so I opened it up (a challenge, but OK if you count all the screws) and replaced the Hard Drive. It comes with a 500gig 5400RPM full size SATA drive as I recall, but that was on its last legs. I happen to have a first gen 64G Intel laptop SSD around, so I use some 3M Command double-sided tape and basically taped this tiny hard drive to the inside of the thing and reinstalled Windows. This time, however, instead of the Windows Vista that it came with, I put on Windows 8.1.

You'd think I'd be asking for trouble. In fast, it's amazing. Literally everything worked, first try, with ZERO third party drivers. Blueooth, wireless, graphics, everything. Worked and worked immediately. Nothing was banged out in Device Manager. Even the touch screen worked, but only with 1 point of touch. That meant no pinch to zoom in browsers or maps. Cool, but I wanted to see if I could fix it.

These HP TouchSmarts had touch screens made by a New Zealand company called NextWindow, except they recently went out of business. Their website includes a few drivers, but not the one I needed.

I've mirrored them here because I don't trust that their website will be around long.

Here's the actual driver I needed for the TouchScreen. It doesn't appear to be available anywhere else, so I'm mirroring it here, as-is. It's the "HID Driver" (Human Interface Device) driver for the NextWindow 1900 TouchScreen. It's version 1.4 from May 24th, 2012. It works with NextWindow 2150 and 2700 touchscreens as well and it works under Windows XP, Vista, Windows 7, and now Windows 8 and 8.1!

This completely brought my HP TouchSmart new life with proper multitouch. It's paved completely with a new Windows 8.1 installation and just one third party driver and NO HP crapware.

Hope this helps you, random internet visitor.

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 ORCS Web

How to add a keyboard and write in YOUR language in Windows for free

July 25, '14 Comments [25] Posted in Internationalization | Win8
Sponsored By

A lot of people don't realize that Windows supports a LOT of different languages out of the box. After Windows 7 and now with Windows 8 and 8.1, you can add keyboards to dozens of languages without buying or downloading anything. You have non-English keyboards now, today! Even if you just have English Windows out of the box, you can add a Japanese Input Method Editor (IME - a way to enter kanji), or any of a dozen other methods for entering non-English text on an English Keyboard. This is great for writing family back home, letting your teen write reports for Chinese class in Word, and more.

If you know someone who could benefit from knowing this, tell them! I met a woman from Ethiopia who spoke Amharic recently and somehow we got to talking about the unique syllabary (an alphabet of symbols) that one uses to write Amharic/Ge'ez using Fidel (their lettering system). She had used Windows for 10+ years and had NO idea she could write emails, make web pages, and write Word documents in her native language FOR FREE. She had this feature in Windows and never turned it on.

In Windows 8 or 8.1, press the Windows key and type "Add language."

Screenshot (29)

Select one of these options (doesn't really matter which) and then select the language you want to add. There's a lot.

Look how many languages are available!

I'm selecting Amharic. Note that I could also select Tigrinya as well.

Tigrinya

I'm just adding the Keyboard so I can write letters, but many languages also have a Language Pack where I could change the look and feel of Windows itself. This could make Windows more comfortable for the grandparents, so experiment with this and their settings.

Amharic IME

An Input Method Editor lets you type English/Latin letters and output non-Latin characters. For example, I'll L-A-space, and get ላ or H-I-space and get ሂ.

Typically as you type a list of options appears and is narrowed down by your choices. Sometimes these are phonetic (they sound like the language) and sometimes they are just letter combos you'll learn.

 

The Ethiopic IME

The results are awesome though, and it makes Windows just that much more usable for folks who regularly need to switch between languages.

Scott Hanselman

Use the Hotkey "Windows Key + Space" to toggle keyboards, or just press the keyboard that appears in your Taskbar.

Switching languages

Now, go tell your family and setup alternate languages on their PC! I can speak from experience that a great way to make a computer more accessible for a relative (and get a smile) is adding support for their native language(s).

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 ORCS Web

How to enter and use Emoji on Windows 8.1

July 9, '14 Comments [16] Posted in Win8
Sponsored By

I have an iPhone 5s and every once in a while my wife and would be texting and I would send her a and she would be like "why you sending me a square?" Then later she got a Nokia 1020 and then we could send each other Emoji's back and forth 😄 😃 😀 😊 ☺ 😉 😍.

Today you can use Emoji pretty much anywhere, be it mobile or on the web with most modern browsers. Windows 8 has an on-screen keyboard that you can use to type Emoji, even if you use a regular keyboard and mouse.

Perhaps you think Emoji are silly? Did you know that Twitter actually makes sure Emoji work in all browsers by swapping them out for their own Twitter-custom images? The people LOVE them some Emoji.

Right click in the Taskbar and make sure you have the Touch Keyboard checked:

Windows 8.1 Emoji Touch Keyboard

You can see it there in the Taskbar. Click it.

Windows 8.1 Emoji Touch Keyboard

Now, click the Smiley.

Windows 8.1 Emoji Touch Keyboard

It's important to note the Arrows on the left there, as well as the categories on the bottom. ALL the Emoji are there.

Windows 8.1 Emoji Touch Keyboard

Even U+1F4A9 PILE OF POO. So that's 💩

Also noticed that Emoji are in COLOR in Internet Explorer. Here is the GetEmoji site with Chrome on the left and IE11 on the right. I've zoomed in on IE to show that the font scales.

Look at all the Emoji

There's an amazing article by Ralf Herrmann on Color Emoji in Windows 8.1—The Future of Color Fonts? that I recommend you read immediately. I've taken part of his image below to show one of the main points of his articles. The Emoji in Windows 8.1 are inside of the Segoe UI Emoji font, and are NOT PNGs (as on other systems) which allows them to scale. Instead, they are layered and each layer has a color. So cool.

winemoji

I'm going to hack around and see if I can change the color of each individual layers. "Diversified Emoji" is a big topic right now, as not everyone wants a yellow LEGO head. There's lots of quasi-Emoji chat apps on all phones with afrocentric or other kinds of emojis. I wonder if a layering system like this would be way to create infinitely diverse emoji?

NOTE: I have NO idea what I'm talking about here, just thinking out loud.

It doesn't seem like Window's built in CharMap.exe supports newer Unicode 7 (?) but BabelMap is a fantastic Extended Character Map that will let you explore all of your choices in a font like Segoe UI Emoji.

BabelMap

Now I need to think about how unprofessional it will be to include Emoji in all my work email. And, more importantly, if it'll all just turn into a "J" in Outlook. ;)


Sponsor: Thanks to friends at RayGun.io. I use their product and LOVE IT. Get notified of your software’s bugs as they happen! Raygun.io has error tracking solutions for every major programming language and platform - Start a free trial in under a minute!

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 ORCS Web
Page 1 of 6 in the Win8 category Next Page

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