Filesystem fears

Q I've read that it's better to use an ext2 or FAT filesystem on a USB key, because they make them last longer than if you used a journalled system such as ext3 or ReiserFS (or even NTFS). This got me thinking, if you have a USB key that you use to exchange files between work and home, it would presumably be read and written to twice a day. On the basis of the working year being about 240 days it would last 104 years on the basis of a life expectancy of 100,000 reads and writes. I don't quite understand the ins and outs of journalled file systems, but I believe they automatically check the disk and then verify the file when it's written, which would make a read one 'use' but a write three 'uses', so they would reduce the life of this over-worked USB key to a measly 52 years. As these things can be bought for a few pounds these days, is a false economy to be so careful with your USB key?

A There's more to a filesystem than just the files - there's also metadata, such as file permissions and time stamps. Then there are directory indices to consider. When writing to a file, all of these have to be updated. So if you copy a directory containing 10 files to a disk, that means eleven directory entries to be updated. With a FAT filesystem, the file allocation table that gives it its name is stored at a single location, so every action on the disk involves reading or writing this location, and that's what causes the wear. If a device is mounted with the sync option, there can be many writes to this location for each file that is updated.

One kernel 'feature' once caused this to be written to for every 4KB of data written, which resulted in my (expensive at the time) 1GB device failing in a very short time when I was writing 700MB Knoppix images to it. Add to this the journal, which contains records of every transaction, and you can see that parts of the filesystem are worked very hard. Yes, the devices are cheap enough now, but their contents may not be. To use your example of transporting data between work and home, what happens if you take some important files home to work on them for an urgent deadline the next morning, spend hours working on them and find the USB stick doesn't work when you get into the office the next day?

The most likely point of failure is the file allocation table, so even files you weren't working on will no longer be available without the use of some recovery software and a fair bit of time. It's also possible, but by no means certain, that cheaper devices may fail sooner because of the likely lower standard of quality assurance. The key point is that these devices are cheap and cheerful and should not be assumed to last forever. Note that these comments are aimed at USB flash memory devices. The flash memory SSDs (solid state disks) used by the likes of the Asus Eee PCs are completely different, incorporating wear levelling so that specific parts of the memory are not disproportionately hammered.

Follow us on or Twitter

Username:   Password: