File Systems

So, continuing from my last post, we know that a formatted hard disk is divided into numerous partitions (the minimum number of partitions being one). Each of these partitions start with a bit of information about what type of partition it is and how to boot an operating system off it (if one is actually installed on it), which works in conjunction with boot information in the MBR. The partition then has a file system written to it. The file system includes the information needed to locate and store data (i.e your files) on the partition.

There are lots of different types of file system all with advantages and disadvantages. However, for a desktop user, the most important differences are between what are called journalling and non-journalling file systems, the security features offered by the different file systems and the maximum sizes supported. Of these, maximum size is the most self-explanatory. As disk sizes have increased, so file systems have had to be able support bigger partition sizes, bigger files and longer file names. You can also probably guess what typical security features are supported by modern file systems. Give yourself a pat on the back if you came up with encryption (i.e the ability to encrypt the entire file system not just individual files), file ownership and file permissions (allowing you to specify who should be able to access the files and how). If you came up with any more, well, no one likes a smart-arse! Now, as for journalling, this might need a bit of explanation.

In the old days of computers, if you were copying a file and the computer unexpectedly turned off half way through writing it, it would not only leave the file in an unreadable state but, if you were unlucky enough for the computer to be updating the information about the file in the file system when you it got turned off, it could leave the file system in an unreadable state, meaning you wouldn’t be able to read any of the data stored in the partition. To fix this you would have to repair the file system when the computer was next turned on. This involved checking all the data on it, something which was irritating when disks were a few megabytes in size but something that would take hours on a modern terrabyte one. So journalling file systems were invented. These stored information about what they were doing before they did it so that in the event of suddenly losing power the journal could just be reread when power was resumed and the operation finished or, at least, terminated in a sensible fashion.

You might well think that, because of this, non-journalling file systems are a thing of the past but unfortunately not. Non-journalling file systems are a lot simpler than their journalling counterparts and are, therefore, cheaper/faster to implement. However, more commonly, the problem is that, due to the fact that Microsoft and Apple have their own journalling file systems (NTFS and HFS+ respectively), which they do their best to stop other people using, Linux had to write its own (ext3, now ext4), which Apple and Microsoft don’t want to support because then we’d live in a crazy messed up world where you could buy a usb hard drive with a sane file system on it that you could expect to work everywhere. Instead we live in a world where your memory stick has to have a file system which was outdated over a decade ago just because it is so simple that everyone one has worked out how to use it and is old enough to no longer be covered by patents, meaning you can use it without having to pay.

The upshot of all this is that raspberry pi expects to have at least two partitions on it. One which has an old non-journalling file system on it (vfat) and which contains basic config information for the raspberry pi’s hardware (for example setting the tv standard for the composite out) so that you can do the basic setup needed to actually get it to display something using any computer. As this blog post is dealing with setting up the raspberry pi over the network we don’t need to worry about this at the moment (though we might need to later on). The other which can have any file system supported by the operating system we are going to use, which will, in this case, be a Linux’s standard journalling file system, called ext4.

Because we are going to install the os by copying an image file. We don’t need to actually create the partitions ourselves, so you probably didn’t need to read all that…

Series Navigation<< Disks and PartitionsActually Writing the Image to Disk >>

One Reply to “File Systems”

  1. Thank you for explaining non-journaling and journaling file systems and why we can’t buy a “usb hard drive with a sane file system on it that can work everywhere.” And now, I understand why a Raspbian “wheezy” SD card needs both a vfat partition and an ext partition. Thank you so much.

Leave a Reply

Your email address will not be published. Required fields are marked *