- What is the UFS file system?
- UFS1 and UFS2 file system structure
- Where UFS1 and UFS2 file systems are used?
- The difference between UFS, UFS2 and EXT4
- How can I view files on a UFS1 on a UFS2 drive in OS Windows and, if necessary, copy them to the other local drive?
What is the UFS file system?
The UFS (Unix File System) file system was originally designed specifically for use in the BSD family of operating systems. Today, it is used in a more refined form in Unix-like operating systems (such as Linux and Solaris), which support this file system at the kernel level. Support for UFS is also implemented in Mac OS X, but it is not native to this operating system.
At an early stage of development, the UFS file system was called FS. It was fairly simple and contained only data such as superblocks, boot blocks, data blocks, and index descriptors (also known as inodes). FS was well suited for the small-size hard drives that dominated the market at the time. But as time went on, storage capacity increased, and it gradually became clear that the FS file system was not able to provide the necessary performance. This led to the further development of FS. Developers added cylinder groups. Each group had its index descriptors to avoid the accumulation of “garbage” in the file system, and the file system itself changed its name from “FS” to “FFS (Fast File System)”.
The main purpose of FFS was to consolidate all the contents of a directory (data and metadata) into one cylinder group. It would greatly reduce the fragmentation level that occurred due to the severe spread of data across the disk’s surface. However, due to the rapid increase in the disk size and the size of the files stored on them, this solution was no longer effective since the block size was increased to keep the performance at the proper level. Accordingly, storing a large number of small files took up a lot of space.
It again forced the developers to develop the file system and based on FFS was created the revised file system “UFS1“, and later its revised version – “UFS2“, creation of which allowed providing reliability and speed thanks to the division of blocks into fragments, which are used to store the final bytes of the file (previously for this was allocated a whole block) and some new technologies.
In fact, “UFS1” and “UFS2” are two additional layers — the top layer, which provides the directory structure and supports metadata in the index structure descriptor, and the bottom layers, which allow representing container data as index descriptors. This was done to support both traditional FFS and LFS.
The structure of the UFS file system is detailed in the next paragraph of this article.
UFS1 and UFS2 file system structure
The structure of the UFS1 and UFS2 file systems is as follows: the boot block is located first, and then the superblock. The index descriptor table (inode table) is placed next, followed by the catalogs. Also in some operating systems (e.g. Solaris), the file system stores access control lists (ACLs) to provide shadow index descriptors (shadow inodes). This is roughly what a FreeBSD partition looks like when the UFS file system is used:
All disk space is divided into cylinder group, and each group stores the following information:
- Boot block – designed to store the data that is needed to boot the operating system. If it were missing, the operating system would not be able to boot. The boot block appears only in the zero cylinder group and occupies the first 8 Kbytes of the disk part. If the file system is not used when the system boots, it remains empty;
- Superblock – this section of the file system contains its description, as well as information about its configuration;
- Descriptions of the “cylinders” groups (CG summary). Cylinders are an area separate from the rest, which contains some nested files. Accordingly, a cylinder group contains several disk cylinders.
- Free inodes map — data about the free inodes and summary information about the use of inodes in the group;
- Free block map — data about the free blocks and summary information about the use of disk blocks in the group;
- Inode array – the inode contains all information about the file except its name, such as file size, date and time of creation, last modification and last reading of the file. Each file has its own inode;
- Superblock backup;
- Some number of data blocks in which the file data is stored;
To improve the performance of the operating system UFS uses some additional solutions. For example:
- larger data blocks in order to increase bandwidth and therefore performance;
- creating superblock duplicates — this solution allows for disk recovery when needed;
- supporting blocks fragmentation into 2, 4, or 8 fragments for better performance with small-size files;
- assigning each new directory to a separate cylinders group to evenly distribute the information on the disk;
- physical access optimization for better read performance;
Other features of the UFS file system are “state flags“. These are designed to indicate the state of the file system. Four states are available: clean, stable, active, or unknown. It avoids unnecessary checks of the file system. If all is good and the state is displayed as “clean” — the checking utility is not run when the operating system is loaded;
It is also worth noting that the number of inodes in UFS is fixed and it is not possible to add them dynamically (like in the XFS file system). It is one more reason why the UFS file system is more suitable for large files than for small files, since if all free inodes run out, the user has to recreate the file system on the disk, and when we are talking about terabytes of data, it is quite a long process.
Where UFS1 and UFS2 file systems are used?
Due to the fast performance with large files the UFS (Unix File System) is the most commonly used on servers. It is especially true for servers storing video data, as video files usually take up the most memory. Thus the higher the server upload speed — is the better performance of the video service in general. In addition, many server administrators prefer to use UFS because of its extensive timestamps.
UFS exists in several variants and can be installed on many types of UNIX systems, including FreeBSD, HP-UX, NetBSD, OpenBSD, Apple OS X, and Sun Solaris. A lot of operating systems have modified one or more data structures over the years to suit their needs, but they all share the same concepts. For example, Solaris has added proprietary add-ons that modify the file system in such a way that other operating systems may not recognize the file system. At the same time, many of the above companies continue to use the original data block size and width. Thanks to this, some compatibility across platforms has been preserved. However, before using it on multiple platforms, it is advisable to learn more about compatibility to prevent operating system freezes and possible future data loss.
The FreeBSD operating system is based entirely on FFS and UFS. It was done to support the evolution of the UFS2 standard which adds a 64-bit pointer block, thus allowing the operating system to handle up to 8 Zettabytes (8 million million gigabytes) of storage
UFS1 and UFS2 file systems are very commonly used in various Linux distributions, but it is worth noting here that the Linux kernel supports this file system only at the reading level. For both UFS1 and UFS2 to work fully, additional software packages will have to be installed.
It is also worth noting that with additional utilities it is possible to provide journaling and thereby obtain a journalable file system that can quickly work with files of enormous size.
Sony PlayStation 2 and Sony PlayStation 3 gaming consoles use their modifications of UFS1 and UFS2 respectively. The reason is that for the fast console performance, developers needed a file system that could provide the appropriate level of performance of the console when working with large images of installed games.
Among other things, it is impossible not to mention the fact that the ext4 file system is based on UFS. Read about how ext4 differs from UFS in the next paragraph of this article.
The difference between UFS, UFS2 and EXT4
UFS1 and UFS2 are very similar. They both have the same structure and scope. However, since UFS2 is a reworked version of UFS1 – the difference between them lies in the functionality.
The main difference between UFS2 and UFS1 is that it is 64-bit and can work with disk volumes larger than a terabyte. Note that the inodes table entry length in UFS2 has doubled to 256 bytes.
In addition, UFS2 includes support for extended file attributes, such as ACLs. It is essential for network administrators. The thing that the average user will notice is that the creation of a new file system is faster (especially noticeable on very large disks).
In general, from a user’s perspective, there is no difference between UFS and UFS2. In practice, however, it is better to use UFS2 because it is newer and has more features.
As mentioned above, the ext4 file system (like ext2 and ext3) is based on UFS, so they are similar. For example, data blocks in ext4 are combined into groups, which strongly resemble groups of cylinders in UFS. Also, ext4 uses inodes and superblocks in the same way as UFS.
At the same time, ext4 has some differences from UFS. For example, it has support for “extents“, which allow you to address a large number (up to 128 MB) of consecutive blocks with a single descriptor. Up to 4 pointers to extents can be placed directly in the inode, which is enough for small and medium-size files. This solution allows increasing the speed of data reading/writing. UFS uses the principle of physical space allocation to increase the data reading speed. It means that while a hard disk drive head is reading the information, there is a delay between the end of reading one block and the beginning of reading the next one. During this time the magnetic disk has time to rotate several degrees, and if there are files on the disk one after another, the disk has to complete a full rotation to allow the head to start reading the next block, and this requires a certain amount of time. The UFS file system takes this into account and distributes files on disk space in such a way as to minimize delay in moving from one data block to the next. However, practice shows that the extents are more efficient. In addition, when dealing with small files UFS loses a lot to ext4 in performance.
The other difference between the ext4 and UFS file systems is the bit depth. Ext4 uses 48-bit block numbers, while UFS uses 64-bit block numbers. In practice, it means that the maximum size of an ext4 file system is 1 exabyte, while UFS 2 has a maximum size of 8 Zettabytes. That is why when working with huge amounts of data (video hosting, etc.) the choice falls on UFS2.
The ext4 file system supports journaling out-of-the-box, while UFS requires additional software.
To summarize, ext4 has a good chance to supersede UFS2 in the future, but it still needs to evolve (e.g. add 64-bit block numbers). Also, ext4 has no checksum verification for data, which makes it impossible to detect data corruption due to hardware failures.
How can I view files on a UFS1 on a UFS2 drive in OS Windows and, if necessary, copy them to the other local drive?
Despite all the advantages of UFS1 and UFS2 file systems, they are most often used in UNIX-like operating systems. For example, Linux users often like to install UFS2 on high-capacity external hard drives where they store movies and other data. However, practice shows that 97% of PC and laptop users use Windows as their primary operating system, which does not support the UFS file system. So how can you open a drive formatted in UFS on a Windows system?
To open a flash drive or an external hard drive formatted with FreeBSD, HP-UX, NetBSD, OpenBSD, or Sun Solaris you do not need to install drivers or use a virtual machine to install the second system.
The best solution is to use the RS Linux Recovery program. It is very easy to use and does not require much computer resources. In addition, it has an intuitive interface. Therefore, if you can be sure that you will open your UFS drive no matter what your level of computer proficiency is.
The same method can be used if you have accidentally deleted an important file or formatted your UFS drive following the Windows Explorer recommendation.
So to open your UFS drive just follow a few simple steps:
Step 1: Download and install the RS Linux Recovery following the installation wizard tips. Then launch the program.
Step 2: The File Recovery Wizard will open in front of you. Click “Next“. The program will ask you to scan your UFS drive for files. RS Linux Recovery offers two types of scans: a quick scan and a full scan. The first option is worth choosing if you just want to look at the data on the drive and copy it to another local drive. The second option is worth choosing if you have lost important information and want to recover it.
Also at this stage, it is worth selecting the file system type of the drive. RS Linux Recovery supports ALL file systems that are used in Linux. Click “Next“.
The the drive analysis will start and will take several minutes.
Step 3: Once the analysis is complete, RS Linux Recovery will show ALL the files on your UFS drive (including those that have been deleted and can be recovered). You can browse the files you want. A quick preview will also be available on the right side. If you want to copy a file to a different disk of your computer or recover a lost file — right-click on it. Then choose “Recovery“.
Step 4: Choose where you want to copy or restore the desired file. It can be a hard drive, a ZIP-archive, or an FTP-server. Then click “Next. The copy/restore process will start. It usually takes a few minutes, depending on the size.
It is also worth noting that you can use this method to view data on drives with the file system ext2,3,4, XFS, ReiserFS, and other modern file systems.