Welcome to the part 3 of “Installing Linux on USB” series. In this part we will discuss which filesystem is best for USB devices.
As mentioned in Part 1, there are two types of USB devices (broadly speaking):
1. USB hard drives
2. USB flash drives
Now USB hard drives are just like our regular IDE/PATA hard drives which comes in an enclosure with IDE to USB interface. So if you happen to open the enclosure of your USB hard drive you will find a regular IDE/PATA hard drive…surprised?
The default filesystem for Linux installation is ext3. Now ext3 filesystem = ext2 filesystem + journaling capability. We won’t go much in detail about journaling because it deserves a separate post. The main point that I want to highlight here is that ext3 filesystem are known to cause many write to the device because it has to update the journal. The “journaling” feature of ext3 means more write to the disk. Since USB hard drives are just like IDE drives we can write to the same blocks (a disk is made up on several blocks) as many times as we want without causing any wear and tear.
However a USB flash drive is different with respect to writing data on same blocks. USB flash drives are known to have limited life span because each block can only be written up to certain amount of times – as low as 10000 times or as high as 1000000 times – and therefore if we happen to write at the same block too many times we can cause wear and tear to the drive which will eventually make it unusable. In fact I had a Lexar USB flash drive since last 5 years which became unusable couple of weeks back precisely because of this reason.
Adaptation Layer on USB flash drives
A USB flash drive generally has an “adaptation layer” which tries to spread the write all across the drive so that the wearing is leveled i.e. no one particular block is being excessively written again and again. All blocks get almost equal wear and tear. Imagine the teller queues at a busy bank – they generally are all of same length.
Note: With flash device technology maturing over time, the life of USB flash drive is also increasing i.e. your flash drive is good for several million of writes say for a 32 GB flash drive. This is assuming the “adaptation layer” is doing it’s work.
In short, a journaling filesystem like ext3 (or XFS, JFS, ReiserFS) is really not recommended for USB flash drives. Rather our old ext2 filesystem is “go go” for USB flash drives.
To summarize, when it comes to ext3 or ext2 filesystem:
USB Hard Drives = Ext3 or Ext2
USB Flash Drives = Ext2 with “noatime” or “relatime” mount option
When it comes to USB flash drives, the idea is to reduce the number of writes to prolong the life of your flash drive. The ext2 filesystem with the above two mount options exactly does that. We will cover these ext2 options later in the series.
I sincerely hope that the above explanation shed some light on why we need to choose different filesystems for USB hard drives and USB flash drives.
As usual, please leave a comment/feedback if you have any. Comments encourages bloggers to post more and keep their spirits high.
Also please don’t forget to rate this post below.