CPS100 • Introduction to Computers


Lakeland College • Japan Campus

Special FeatureFilename Extensions

The Filesystem

  • Data on computer volumes is organized with a filesystem
  • Filesystems organize files into directories (folders)
  • Filesystems maintain information about files called "metadata"
  • When you put something in the "trash" and empty it, the data is not really deleted
  • Data must be written over by zeroes (to "zero out") or by new data in order to be deleted
  • Each major operating system platform has its own preferred filesystem
  • Some filesystems cannot be read by some operating systems
  • Some filesystems (used for USB flash devices or external hard drives) may work slowly under some operating systems

Your computer's data is stored on volumes. A volume is any physical storage device, such as a hard disk drive, solid state drive, USB flash drive, an optical disk, and so on. These storage media keep data.

However, that data must be organized in some way. If all the files were just placed on a drive with no organization, you would open the drive and see hundreds of thousands of files all in the same place. It would be impossible to find anything.

Each computer has a filesystem which is responsible for keeping data files and maintaining them. A filesystem must track the location (on the drive) of data in a file, and keep information about that file, such as the name, type, size, and so on.

Directories

Filesystems keep files organized by placing them into directories. You have seen a directory before, many times: you call them folders. "Directories" and "folders" are the same thing.

Like volumes, folders contain data. However, while volumes are physical devices, folders are imaginary locations. You cannot touch a data folder. Because of this, folders are always inside volumes, but volumes are never actually inside folders.

If you open a folder, we say that you are going "down" into the folder. If you exit a folder and go into the folder containing it, we say you are going "up."


The Filesystem and Files

The filesystem must keep certain information about each file. Each file has the following information, called metadata, which is about the file:

  • file size: the filesystem much know how many bits of data are in any one particular file.
  • location on the disk: the filesystem must keep track of where all the data in the file is located, so it can be accessed. Some files are divided into parts in different locations on the disk.
  • dates associated with the file: the filesystem should know when the file was created, when it was last modified, and when it was backed up.

Often, this metadata is not stored with the file's data, but is kept in a directory table.

Why Should You Care? Deleting Files, That's Why.

This is important to know because of how your computer erases (or does not erase) data.

Consider how your computer saves and deletes data. If you save a 3 GB file on your hard drive, it may take 1 minute or longer for the copy to be completed. That's the amount of time necessary to write all the 1s and 0s in the file.

However, when you empty your recycle bin / trash, the file seems to disappear almost instantly.

If it took more than a minute to write the 1s and 0s, why did it take no time to delete the 1s and 0s?

The answer is simple: the data was not really deleted! The filesystem is designed to prevent accidental data loss. As a result, the computer tries to not delete the information until it is necessary.

At first, all the filesystem does is mark the file for deletion. In one example, the filesystem goes into the metadata in the directory table, and replaces the first character of the filename with a "sigma" (σ or Σ).

The file's data is still there. The metadata is still there. All the computer did was to tag the file, essentially saying, "This space is free to use, but we'll keep the data as long as we can."

In some filesystems, the data can easily be recovered. In other filesystems, you must use special recovery software to get the data back.

As time goes by, and you need more disk space, the filesystem will eventually use the file's space, over-writing the data. When that happens, then the data is erased.

It is important to understand that data still exists on a computer even after the files have been "erased."

How Can I REALLY Get Rid of the Data?

Some people imagine that all they have to do is re-format the disk. This could work, but only if you do it the right way. Sometimes, reformatting the disk only takes a few moments. If that is the case, then the data is not being erased!

Data is only truly erased when it is over-written, when you write new data on top of the old data. This is done automatically by writing different data in the same location, but that might take some time. Another way to truly erase data is to zero out the data's location: to write all zeroes in the data location.

To zero out a whole hard drive could take hours. Therefore, if you re-formatted the drive in just a few moments, the data was clearly not erased. The computer just erased the filesystem and created a new one. But the data is still on the disk.

Have you ever sold or given away a computer you owned to someone else without zeroing out the hard drive? If you did, then that person could have uncovered all your old files—even files you thought you had erased months before!

formatting a USB flash drive in Mac OS X

Mac OS X has zeroing-out built in; the feature is called Secure Empty Trash. In the Finder menu, you can choose between regular "Empty Trash" and "Secure Empty Trash." The "secure" option will zero out the data, completely erasing it.

Windows does not have a zero-out feature built in, but you can get various utilities that let you do this.



Filesystems in Use

Various operating system use various filesystems. Modern computers use filesystems that fit the needs of modern computing.

For example, older filesystems only allowed very short filenames, using limited character encodings. Newer filesystems allow very long filenames (255 characters long) using almost any language.

Older filesystems could only allow files up to a few gigabytes in size; newer filesystems allow for huge file sizes.

  • Microsoft Windows uses NTFS ("New Technology File System"), introduced in 1993.
    • FAT32 is an old alternate filesystem made by Microsoft in 1996.
    • ExFAT is an alternate filesystem made by Microsoft in 2006.
  • Mac OS X uses HFS+ ("Hierarchical File System Plus"), introduced in 1998.
  • Linux uses ext3 ("Third Extended Filesystem"), introduced in 2001.
  • Each of the above operating systems can use various filesystems, but they tend to run best using the "native" filesystem.

    For example, the Mac OS uses HFS+, but it can read a disk which is formatted as ExFAT. However, ExFAT-formatted disks are slow in the Mac OS. If a disk is formatted as HFS+, it will transfer data much faster on a Mac.

    On the other hand, if you format a disk as HFS+, it will not be readable on a Windows machine. Similarly, a USB flash drive formatted with NTFS will not work on a Mac.

    FAT32-formatted drives will work on almost any device, but FAT32 will not allow files more than 4GB in size. Since many modern video files are larger than that, the limit causes problems.

    On most current devices, ExFat is supported. However, if you have a PS3 or old XBox, an ExFat drive probably will not work.

    If you will use an external hard drive with only one kind of computer, you should format the drive as NTFS if you use WIndows, or as HFS+ if you use a Mac. USB Flash drives will probably work best using ExFAT, unless you also use the USB drive with only one type of computer.

    To format any drive:

    • In Windows, connect the drive you wish to format. Open the "(My) Computer" window (WIN + E), and then right-click on the volume you wish to format. Choose "Format..." from the pop-up menu. Choose the File System you desire, give the drive a "Volume Label" (name) and then click "Quick Format."
    • On a Mac, search for and open an app called Disk Utility. Connect the drive you wish to format, select it in the left sidebar of Disk Utility, then select "Erase" on the right. Choose the desired file format and click "Erase..."
    formatting a USB flash drive in Mac OS X

    Partitions

    A filesystem can create something called a disk partition.

    A partition can divide one volume so it appears to be two or more partitions.

    In this case, we can take a USB flash drive (which is a volume) and create partitions.

    formatting a USB flash drive in Mac OS X

    As you can see above, there is a flash drive called "USB Disk." It is a 4GB volume with a single partition, using the FAT filesystem.

    In this case, I want two partitions. Under "Partition Layout," I choose "2 Partitions," at which time I can adjust the size of either one. Note that I have chosen a filesystem better for the Mac:

    formatting a USB flash drive in Mac OS X

    I can make various kinds of adjustments. For example, I can set up the device so it can be a "boot" volume—that is, I could install an operating system on it and use it to start up a computer (as an emergency disk).

    Once I am finished, the computer confirms what I have set up:

    formatting a USB flash drive in Mac OS X

    After I have finished, the one USB flash device now appears as two volumes on the computer!

    formatting a USB flash drive in Mac OS X

    You might wonder, why do this? There are many possible reasons. Maybe you want one partition formatted best for Windows, and the other formatted for Mac. On a hard drive, you might divide the disk so that one partition is running Windows 7 in English, and the other partition is running Windows 8 in Japanese (having two operating systems on separate partitions is called dual boot).

    Another use is for a restore partition, which we mentioned back in Chapter 2.


    Terms to Know

    filesystema system for handling files on a computer.
    volumea physical storage device (e.g., HDD, SSD, CD, DVD, USB Flash).
    folderalso "directory"; a grouping of files in a volume, in order to organize files and other folders.
    metadatainformation about data (i.e., data about data).
    directory tableone example of a location where file metadata is kept.
    zero outalso "secure delete"; to completely and safely erase data by over-writing the data with zeroes.
    NTFSThe default filesystem for Windows.
    HFS+The default filesystem for Mac OS X.
    FAT32 / ExFATWindows filesystems commonly in use; ExFAT is more modern and well-featured.
    Previous Chapter Chapter Quiz Next Chapter