Atomic I/O letters column #90

Originally published 2008, in Atomic: Maximum Power Computing
Reprinted here January 25, 2009
Last modified 16-Jan-2015.
 

Cluster-frack

As far as I know, the bigger the cluster, the faster your hard drive can read a file, and the less fragmentation. Correct?

I brought a whopping great 1Tb Seagate server-edition HD, which I am planning to use only for files which are from 50Mb to several gigabytes in size. I am using Vista Ultimate 64-bit SP1 at the moment. What's the best allocation unit size to increase performance?

Will

Answer:
Very few PC tasks will run any faster if you increase the NTFS cluster size from the default four kilobytes.

You can go all the way to 64 kilobytes if you like - some partition-management apps, like Acronis Disk Director, let you change the cluster size quickly without reformatting - but only in unusual circumstances will this make any perceptible difference.

Disks that've been converted from FAT32 to NTFS are a special case. They'll have a cluster size of only 512 bytes, which actually will at least slightly reduce performance. If a file can fit in a single cluster, then it's impossible for that file to be fragmented, which means at least one less seek operation when the computer reads that file. If your cluster size is very small, though, as it will be on a FAT-to-NTFS converted volume, then pretty much everything will be fragmentable - though the system will still write files to contiguous clusters as much as it can.

(512-byte clusters will also bloat out the NTFS Master File Table {MFT}, with eight times as many entries as 4Kb clusters would require.)

There's a bit more to this, though, which you'll discover if you start looking into the amount of "slack" space that exists on an NTFS volume. Slack space is the wasted space between the end of a file's actual data, and the end of the last disk cluster it occupies. Unless you're using a rather unusual filesystem, only one file can have data in any given cluster, so the slack space at the end of each file is wasted.

On average, the slack space on a given drive will be one-half of the cluster size times the number of files. Windows makes it easy to see these numbers, in the Properties page for any collection of files; "Size" is the actual bytesize of whatever you selected, while "Size on disk" is the amount of disk space the files take up, including the slack.

On NTFS disks, though, the slack will be smaller than you'd expect. My C drive, for instance, is an NTFS volume with the default four-kilobyte clusters, and it at the moment contains 106,123 files. The simple estimate of slack space therefore gives two kilobytes times 103,123 of slack space - a bit more than 200 megabytes.

The actual bytesize of the files is 313,990,941,886 bytes, but the "Size on disk" number is only 314,062,303,132 bytes. The difference between those two numbers is only about 68 megabytes. That's about a third of what the simple estimate suggests.

This is because NTFS will actually store the whole of a small file in the Master File Table, if the file itself is smaller than the normal MFT data for the file would be. This reduces seeking and makes things faster, and it also greatly reduces the amount of slack space.

The storage capacity of the MFT remains at around 750 bytes per file no matter how big the cluster size is, though. So as NTFS cluster size gets bigger, the actual slack space will get closer and closer to the simple estimate.

Disk space has been so cheap for so long that slack space really doesn't matter much any more. But I'd still probably be wasting nearly a gigabyte of space on my C: drive, instead of less than 70 megabytes, if I stepped it up to 64-kilobyte clusters. And all I'd get in return would be zero fragmentation of all files smaller than 64Kb.

If you've got some oddball application that makes vast numbers of files that're all smaller than the maximum possible cluster size, but bigger than the default one, then setting the cluster size big enough that every one of those files will be able to fit in a single cluster will make disk access faster. This is probably not your situation, though.

NTFS cluster sizes larger than four kilobytes also, by the way, make it impossible to use NTFS compression. NTFS compression can actually, surprisingly, increase disk performance on modern computers that have CPU power to burn, especially for often-read, seldom-written things like application data, and/or if a drive's read speed isn't very high.

Compression won't do any good with incompressible data, though, so there's no point turning it on for a drive that's full of already-compressed image, sound or video files.

 

Also, align your computer north-south

Apparently, "Chinese hacker has managed to crack the maximum memory limit imposed by Microsoft on 32-bit Windows Vista. The trick is to transfer or transplant the more memory support feature in 32-bit Windows Server 2008 to Windows Vista, which use similar kernel code. Replace and overwrite the Windows Vista version of pkeyconfig.xrm-ms and tokens.dat with the version copied from Windows Server 2008."

Some people even claim that only one file needs to be replaced to do the trick.

Is this for real?

Jurgen

Answer:
I don't know whether this works or not (I'd suspect not, based on this). But if it does, all it's doing is enabling full Physical Address Extension (PAE) in 32-bit Vista. This is probably not something you want to do.

32-bit Vista, like 32-bit Windows XP SP2 and later, doesn't really support PAE. You can turn PAE on, but you won't then actually be able to address any more memory. The only reason to turn PAE on is if you want to activate the no-execute (NX) or execute-disable (XD) features of modern CPUs, which require larger-than-32-bit memory addresses, to accommodate the extra bit that activates those modes. That's all PAE does on these operating systems.

The reason why PAE in XP and 32-bit Vista doesn't expand the memory map is that for a computer to work with PAE, all of its kernel-mode drivers need to be PAE-aware. If any of them aren't, the computer will hang.

Microsoft gave up on ever having enough PAE-aware drivers for mainstream WinXP computers, which is why, as of SP2 back in 2004, they abandoned the larger address space and changed the PAE mode for the mainstream 32-bit versions of Windows. Now it only gives you the same 4Gb maximum memory as non-PAE mode. Non-PAE-aware drivers then work fine.

Since 32-bit Vista is not meant to have a full-address-space PAE option, I imagine that many of its kernel-mode drivers - quite possibly including standard Microsoft ones - will also not be PAE-aware. So all sorts of important stuff will fail, and you probably won't even make it to the Windows desktop.

If you can set the system up with nothing but PAE-aware kernel-mode drivers, then "full" PAE would work just fine. But I'd be surprised if you could actually do that, and I'm doubtful about whether this hack actually activates full PAE anyway.

Just get 64-bit Vista in the first place. It pretty much works, these days.

 

I Can't Believe It's Not A Battery!

Do you know of a device that would replace 2 AA batteries with mains power? By that I mean a sort of dummy pack that would be inserted in place of the batteries, and plugs in? I'm thinking no, especially after about an hour of looking. If you know and have a minute I would sure appreciate your insight.

Greg

Inelegant battery-bay connectors
Now, Igor, we need only wait for the lightning to strike!

Answer:
No, I don't know of any off-the-shelf way to do this. It shouldn't be hard to hack up a solution, though.

"Dummy batteries" actually do exist for a few devices - I'm thinking of my old Canon EOS D60 and its "DC coupler", here - but general-purpose ones that replace commodity batteries don't seem to exist.

It wouldn't be difficult to make one, though. All you'd have to do is connect a 2.4-to-3-volt regulated plugpack to a couple of dummy batteries, with the output terminals in the right place to make contact in the battery bay of the device.

(The "regulated" part is important, by the way; unregulated plugpacks output more than their rated voltage when they're less than fully loaded. Modern lightweight switchmode mains adapters should all be regulated, and thus not give a higher output voltage when lightly loaded, but it's still a good idea to check the unloaded output with a multimeter, if you're not quite sure.)

You actually can buy dummy batteries off the shelf, though they're not very easy to find. Making them is no big deal, though - pieces of wooden dowel plus nails or thumbtacks for terminals will do the job. You could also do it without any woodwork, by hacking wires into battery size adapters that're meant to let you use AAs in something that expects C-size or D-size cells, or use AAAs as AAs.

Note that if you want to put the battery cover back on after installing a contraption like this, you're probably going to have to cut some sort of notch in the cover for the wire to pass through. My old D60 had such a notch built in; for other devices you'll have to drill, cut or melt.

It's also often possible to get a good connection with battery-bay contacts by using alligator clips or integrated-circuit test clips, thus avoiding the dummy-battery problem entirely.

Or you could just hard-solder wires to battery-bay contacts, and attach an inline barrel socket or something to the end, so you can plug a normal wall-wart straight in.

 

The Windows-key poltergeist

Sometimes I come back to my Windows XP computer, and the Windows key is stuck down. So if I press E I get a new Explorer window, if I press L the computer locks, and so on.

Apparently this can happen because of some Terminal Services stuff or something; I'm not running Terminal Services, but whatever. The same pages that told me that also said that you can cure it by just pressing your Windows key a couple of times.

The killer is - MY KEYBOARD DOESN'T HAVE A WINDOWS KEY! So the only way I've been able to fix the problem is by rebooting.

WTF?!

Luke

On-Screen Keyboard
A simple solution to a stupid problem.

Answer:
Use the On-Screen Keyboard, Luke.

Start -> Run (or just R, since your computer's convinced the Windows key is down...), and type "osk" and return.

(Fortunately, Windows-O, Windows-S and Windows-K aren't normally used for anything. Once this happened to me when I was running something that did use Windows-O as a hotkey; I had to copy and paste an O from my text editor.)

Now use the mouse to click one of the OSK's Windows keys a couple of times. Windows treats this exactly like pressing the physical key, so now your phantom pressed key will be unpressed once more.

 

Other letters columns

I/O #1
I/O #2
I/O #3
I/O #4
I/O #5
I/O #6
I/O #7
I/O #8
I/O #9
I/O #10
I/O #11
I/O #12
I/O #13
I/O #14
I/O #15
I/O #16
I/O #17
I/O #18
I/O #19
I/O #20
I/O #21
I/O #22
I/O #23
I/O #24
I/O #25
I/O #26
I/O #27
I/O #28
I/O #29
I/O #30
I/O #31
I/O #32
I/O #33
I/O #34
I/O #35
I/O #36
I/O #37
I/O #38
I/O #39
I/O #40
I/O #41
I/O #42
I/O #43
I/O #44
I/O #45
I/O #46
I/O #47
I/O #48
I/O #49
I/O #50
I/O #51
I/O #52
I/O #53
I/O #54
I/O #55
I/O #56
I/O #57
I/O #58
I/O #59
I/O #60
I/O #61
I/O #62
I/O #63
I/O #64
I/O #65
I/O #66
I/O #67
I/O #68
I/O #69
I/O #70
I/O #71
I/O #72
I/O #73
I/O #74
I/O #75
I/O #76
I/O #77
I/O #78
I/O #79
I/O #80
I/O #81
I/O #82
I/O #83
I/O #84
I/O #85
I/O #86
I/O #87
I/O #88
I/O #89
I/O #90
I/O #91
I/O #92
I/O #93
I/O #94
I/O #95
I/O #96
I/O #97
I/O #98
I/O #99
I/O #100
I/O #101
I/O #102
I/O #103
I/O #104
I/O #105
I/O #106
I/O #107
I/O #108
I/O #109
I/O #109
I/O #110
I/O #111
I/O #112
I/O #113
I/O #114
I/O #115
I/O #116
I/O #117
I/O #118
I/O #119
I/O #120
I/O #121
I/O #122
I/O #123
I/O #124
I/O #125
I/O #126
I/O #127
I/O #128
I/O #129
I/O #130
I/O #131
I/O #132
I/O #133
I/O #134
I/O #135
I/O #136
I/O #137
I/O #138
I/O #139
I/O #140
I/O #141
I/O #142
I/O #143
I/O #144
I/O #145
I/O #146
I/O #147
I/O #148
I/O #149
I/O #150
I/O #151
I/O #152
I/O #153
I/O #154
I/O #155
I/O #156
I/O #157
I/O #158
I/O #159
I/O #160
I/O #161
I/O #162
I/O #163
I/O #164
Dan's Data letters #1
Dan's Data letters #2
Dan's Data letters #3
Dan's Data letters #4
Dan's Data letters #5
Dan's Data letters #6
Dan's Data letters #7
Dan's Data letters #8
Dan's Data letters #9
Dan's Data letters #10
Dan's Data letters #11
Dan's Data letters #12
Dan's Data letters #13
Dan's Data letters #14
Dan's Data letters #15
Dan's Data letters #16
Dan's Data letters #17
Dan's Data letters #18
Dan's Data letters #19
Dan's Data letters #20
Dan's Data letters #21
Dan's Data letters #22
Dan's Data letters #23
Dan's Data letters #24
Dan's Data letters #25
Dan's Data letters #26
Dan's Data letters #27
Dan's Data letters #28
Dan's Data letters #29
Dan's Data letters #30
Dan's Data letters #31
Dan's Data letters #32
Dan's Data letters #33
Dan's Data letters #34
Dan's Data letters #35
Dan's Data letters #36
Dan's Data letters #37
Dan's Data letters #38
Dan's Data letters #39
Dan's Data letters #40
Dan's Data letters #41
Dan's Data letters #42
Dan's Data letters #43
Dan's Data letters #44
Dan's Data letters #45
Dan's Data letters #46
Dan's Data letters #47
Dan's Data letters #48
Dan's Data letters #49
Dan's Data letters #50
Dan's Data letters #51
Dan's Data letters #52
Dan's Data letters #53
Dan's Data letters #54
Dan's Data letters #55
Dan's Data letters #56
Dan's Data letters #57
Dan's Data letters #58
Dan's Data letters #59
Dan's Data letters #60
Dan's Data letters #61
Dan's Data letters #62
Dan's Data letters #63
Dan's Data letters #64
Dan's Data letters #65
Dan's Data letters #66
Dan's Data letters #67
Dan's Data letters #68
Dan's Data letters #69
Dan's Data letters #70
Dan's Data letters #71
Dan's Data letters #72
Dan's Data letters #73
Dan's Data letters #74
Dan's Data letters #75
Dan's Data letters #76
Dan's Data letters #77
Dan's Data letters #78
Dan's Data letters #79
Dan's Data letters #80
Dan's Data letters #81
Dan's Data letters #82
Dan's Data letters #83
Dan's Data letters #84
Dan's Data letters #85
Dan's Data letters #86
Dan's Data letters #87
Dan's Data letters #88
Dan's Data letters #89
Dan's Data letters #90
Dan's Data letters #91
Dan's Data letters #92
Dan's Data letters #93
Dan's Data letters #94
Dan's Data letters #95
Dan's Data letters #96
Dan's Data letters #97
Dan's Data letters #98
Dan's Data letters #99
Dan's Data letters #100
Dan's Data letters #101
Dan's Data letters #102
Dan's Data letters #103
Dan's Data letters #104
Dan's Data letters #105
Dan's Data letters #106
Dan's Data letters #107
Dan's Data letters #108
Dan's Data letters #109
Dan's Data letters #110
Dan's Data letters #111
Dan's Data letters #112
Dan's Data letters #113
Dan's Data letters #114
Dan's Data letters #115
Dan's Data letters #116
Dan's Data letters #117
Dan's Data letters #118
Dan's Data letters #119
Dan's Data letters #120
Dan's Data letters #121
Dan's Data letters #122
Dan's Data letters #123
Dan's Data letters #124
Dan's Data letters #125
Dan's Data letters #126
Dan's Data letters #127
Dan's Data letters #128
Dan's Data letters #129
Dan's Data letters #130
Dan's Data letters #131
Dan's Data letters #132
Dan's Data letters #133
Dan's Data letters #134
Dan's Data letters #135
Dan's Data letters #136
Dan's Data letters #137
Dan's Data letters #138
Dan's Data letters #139
Dan's Data letters #140
Dan's Data letters #141
Dan's Data letters #142
Dan's Data letters #143
Dan's Data letters #144
Dan's Data letters #145
Dan's Data letters #146
Dan's Data letters #147
Dan's Data letters #148
Dan's Data letters #149
Dan's Data letters #150
Dan's Data letters #151
Dan's Data letters #152
Dan's Data letters #153
Dan's Data letters #154
Dan's Data letters #155
Dan's Data letters #156
Dan's Data letters #157
Dan's Data letters #158
Dan's Data letters #159
Dan's Data letters #160
Dan's Data letters #161
Dan's Data letters #162
Dan's Data letters #163
Dan's Data letters #164
Dan's Data letters #165
Dan's Data letters #166
Dan's Data letters #167
Dan's Data letters #168
Dan's Data letters #169
Dan's Data letters #170
Dan's Data letters #171
Dan's Data letters #172
Dan's Data letters #173
Dan's Data letters #174
Dan's Data letters #175
Dan's Data letters #176
Dan's Data letters #177
Dan's Data letters #178
Dan's Data letters #179
Dan's Data letters #180
Dan's Data letters #181
Dan's Data letters #182
Dan's Data letters #183
Dan's Data letters #184
Dan's Data letters #185
Dan's Data letters #186
Dan's Data letters #187
Dan's Data letters #188
Dan's Data letters #189
Dan's Data letters #190
Dan's Data letters #191
Dan's Data letters #192
Dan's Data letters #193
Dan's Data letters #194
Dan's Data letters #195
Dan's Data letters #196
Dan's Data letters #197
Dan's Data letters #198
Dan's Data letters #199
Dan's Data letters #200
Dan's Data letters #201
Dan's Data letters #202
Dan's Data letters #203
Dan's Data letters #204
Dan's Data letters #205
Dan's Data letters #206
Dan's Data letters #207
Dan's Data letters #208
Dan's Data letters #209
Dan's Data letters #210



Give Dan some money!
(and no-one gets hurt)