How do I defragment my Pocket PC memory cards? Do I need this at all?
By Werner Ruotsalainen, Submitted Wednesday, February 8, 2006
Topics:
http://forum.xda-developers.com/viewtopic.php?t=40533
Despite the popular belief ("memory cards don't contain moving, mechanical parts; therefore, there's no point in defragmenting them"), it is worth defragmenting them now and then. I've made some benchmarks (please see this article for some quantitive results) and it has indeed turned out to be worth defragmenting heavily and often written-to memory cards from time to time (say, once every 2-3 months). Note that you won't ever need to bother defragmenting memory cards that you never write to (and your programs don't do either - for example because you explicitly make them write-protected by, for example, switching the write protection switch on Secure Digital memory cards). I would not recommend any Pocket PC-based tool for defragmenting your card - they're unreliable (please read this thread on this question - I also recommend this thread for everyone that would use Pocket Mechanic or StorageTools, the two commercial tools also capable of defragmenting, for other tasks like fixing problems), commercial (you must pay for them) and very slow. The way of defragmenting memory cards I describe in this tutorial only use free, already-available desktop Windows tools, not resulting in any need for purchasing additional programs, as long as you use a desktop card reader. If you don't have a desktop card reader (you should consider getting one! They're immensely useful and really cheap), you will end up having to use some commercial programs, though. If you have a memory card reader in your Windows computer- save all the files to your hard disk in any directory using a memory card reader. It's very easy: just copy all the directories with a file copier application that also supports copying hidden/system files. If you use the built-in Windows File Explorer in Windows, first, you need to make sure it also sees hidden files (many Pocket PC applications create/use hidden files). Go to Tools/Folder Options/View and enable the "Show hidden files and folders" radio button in the "Hidden files and folders" group: Click for screenshot You can, of course, use other file handler tools too. Make sure, however, that they are also able to see/copy hidden files. In, for example, the highly famous Total Commander, you can do this by going to Configuration/Options/Display and enabling the "Show hidden/system files (for experts only!)" checkbox: Click for screenshot
- now, after transferring all the files from the card, just enter the
format drivename: /q /u
command in either Start/Run (if you use Windows Explorer), or, conveniently, into the input field of Total Commander. For example, if your memory card is mapped to drivename i, enter format i: /q /u as can be seen here (Windows Explorer):
- after formatting is finished, copy your files back to the card.
- use Windows Explorer (after enabling it to see hidden files) by just clicking the "Explore" icon on ActiveSync. Note that the WinCE File System plug-in for Total Commander (please see this tutorial on installing and using it), while being an immensely nice and useful tool, does not correctly copy the "hidden" flag of hidden files (it just removes this flag), which may result in problems later. Therefore, it's better to exclusively use Windows Explorer in this case. Please note that, especially with older, slower, pre-WM2003 Pocket PC's and older, pre-3.8 ActiveSync versions, long ActiveSync-based file transfers are known to be often interrupted/broken (and are much slower than using a memory card reader in your desktop computer). If you encounter situations like this, consider getting a memory card reader for your desktop PC. It'll greatly enhance the reliability (and, naturally, speed).
- to format the memory card inside the Pocket PC, you will have several choices. Make sure you read this article on the available card formatter tools and their problems/usage. You may also want to try to optimize the memory card by testing it with different file systems / block sizes during this. It's pretty time-consuming, but is certainly worth the trouble and time.
- finally, just copy back your files from the desktop to the storage card by directly copying them via Windows Explorer, in the "Explore" mode.
- Login or Register to post comments
Printer-friendly version




I'm absolutely sure there's wear levelling in all built-in ROM's. If there wasn't, then, even the smallest bit error would cause tremendous problems and would render all ROM's practically useless.
In most cases levelling works on the bit level. I don't think the file system controller sees these problems and allocates the blocks used to avoid them – with most flash memories, the outer world only sees a homogenous address range, of which every single bit is usable. At the flash controller level, there's some kind of mapping out of bad bits (that is, 4-8 bytes in general), of course.
As the operating system, however, doesn't see anything of them, it won't repartition a file while it's written to the file store and, therefore, no performance degradation will occur (because it won't need to update the file allocation table to leave out dead bits).
As far as formatting the built-in, user-writable flash ROM is concerned, there're two cases: pre-WM5 and WM5 devices.
As far as the file system format of the ROM is concerned, to my knowledge, it's not FAT. I may be wrong though – I will check out the related docs some time.
As promised, I've continued researching this subject; File Store uses FAT and, under certain circumstances, can be formatted. I'll publish a tutorial on all this really soon.
Are you sure the write protection latch isn't in the "protected" position?
Please note that Pocket Mechanic Professional is a brand new (unavailable/not-yet-announced) at the time of writing of the article), completely rewritten product. In the article, I referred to Pocket Mechanic, not to Pocket Mechanic Professional. I, along with several other users, did have problems with Pocket Mechanic's unability to fix errors that the desktop-based, plain chkdsk would have easily fixed.
I haven't tested Pocket Mechanic Professional in this respect as yet. Will try to do it soon and will also post the results.