Objectives for the module
Understand various components of AIX file system.
File system structure
Explanation:
File system resides on a logical volume. So the size of the file system would be in multiples of logical partitions. Every logical partition would be pointing to a physical partition.
An individual file within a file system would be allocated data blocks which is usually 4 KB in size. In traditional UNIX systems the data block size was 512 bytes.
The first very important component of a file system is called the superblock. The superblock contains information about the file system in terms of the name of the file system, its size, number of inodes in the file system, etc.
The superblock information is very critical and will be utilized by the system whenever the file system has to be mounted and accessed. If the superblock goes corrupt, then the file system will not be able to be mounted also. So a backup copy of the superblock is always written in block 31.
Right after the superblock are the inodes. Inodescontains information of files like file permissions, file type, size, owner, group, created/modified date and time and they also contain the pointers to data block.
Data block contain data. Indirect data block maintain addresses to the actual data block.
Contents of the inode
Explanation:
This is the structure of the inodes. Each file on your system is represented by a single inode. The inode for a file contains information about the file in terms of
>Inode number for the file
>Ownership
>Access Permissions
>Type of the file
>Creation, modification and access times
>Number of links to the file
>Size
>Addresses of data blocks on disk.
Use can use the command ls with the option –i to look at the contents of the inode for that file.
File System Fragmentation
Explanation:
In AIX the filesystemis broken into blocks called as data blocks. These data blocks by default are 4 kb in size i.e. 4096 bytes in size.
Lets imagine you have a file called file1 which is about 1900 bytes. To store this file in the filesystem, you will require a data block (4 kb). That means file1 occupies 1900 bytes of the data block and the rest of the space in the 4 kb data block is empty. But even though rest of the space is empty, this space cannot be utilized by the file system to allocate it any other file. So in these circumstances, potentially you could have more amount of unused or wasted space.
Here is where we can get an intro to the concept of “Fragmentation”.
Fragmentation is a concept wherein a single data block can be broken logically into smaller fragments of size ranging from 512 bytes to 4 kb. Lets say I choose a fragment size of 1kb, that means the data block of 4 kb size is broken into 4 fragments.This would ensure that if there was a small file lets say about 1900 bytes, to store this particular file, I would potentially use up only 2 fragments of the data block and the other two fragments can be allocated to files if necessary. Thus reducing the amount of unused and wasted space in your filesystems.
Number of bytes per inode
For how many number of bytes should a inode be generated ?
for example: nbpi=4096 would create an inode for every 4096 bytes.
Explanation:
In a Journaled File System, when ever a file is created, its respective inode also has to be created. The inode maintains details about the file. In earlier versions of JFs, the number of inodes created for a file system was fixed and it was generated for every 4 KB of disk space of that file system. That means 1024 inodes would be generated. If the data block size also remains at 4 KB, these many inodes was actually enough to cater to the needs of the file system.
But since fragmentation came into picture, wherein instead of sticking to 4 KB data block size, the data block was able to be fragmented in smaller sizes lets say 1024 ie1KB, the need for more number of inodes also increased since there would be potentially more smaller files in the file system. Here is where the nbpi value (number of bytes per inode) can be reduced/changed to suit the requirements. So now nbpi=1024 would mean, please create a inode for every 1024 bytes of the space allocated to this file system.
Allocation Group Size
Explanation:
Allocation group size concept increases the efficiency of the file system. Allocation group is nothing but a logical grouping of related datablocks and the inode into a single group to increase the speed at which the data can be accessed within a filesystem.
The following small table gives you the Allocation Group Size and its respective nbpi values that are supported:
Allocation Group Size NBPI
8 MB 512,1024,2048,4096,8192,16384
16 MB 1024,2048,4096,8192,16384,32768
32 MB 2048,4096,8192,16384,32768,65536
64 MB 4096,8192,16384,32768,65536,131072
Compressed file system
Explanation:
Compressed file system save disk space by allowing a logical block to be stored on the disk in units or fragments smaller than the full block size of 4096 bytes.
Data compression allows all logical blocks of any sized file to be stored as one or more contiguous fragments. On an average, data compression saves disk space by about a factor of 2. There is no support for compression with JFS2 file system.
Recommendations: The root file system must not be compressed. Compression of the /usr file system is not recommended.
Large File Enabled File Systems
File = 132 MB
(1024 * 4 KB blocks) + (1024 * 128 KB blocks) = 132 MB
4 MB + 128 MB = 132 MB
Explanation:
Before discussing the Large File Enabled File System, Lets take a normal scenario of a file of size 140 MB. The default block size for this file system is 4 KB. That means, to store a file of 140 MB size in 4 KB blocks we would require 140 MB /4 KB = 35840 number of data blocks. That means to read this file the system has to perform 35840 I/O operations.
With Large File Enabled File System, the first 4 MB of the file will be allocated in 4 KB blocks and the rest of it will be allocated in 128 KB blocks. That means for the same file which is 140 MB in size, first 4 MB will be allocated using 4 KB blocks (4MB / 4 KB = 1024 blocks) and rest of the file is 136 MB will be allocated in 128 KB block ( 136 MB / 128 KB=1088 blocks). Totally in a Large File Enabled File System to allocate this file of 140 MB only 1024+1088 ie 2112 data blocks will be required and this calculation itself is an indication how a Large File Enabled File System can bring in performance. ( Only 2112 I/O operations are required to read the file instead of 35840 blocks.
Journal Log
Explanation:
Jfslogs are kept in /dev/hd8. The journal logs are circular logs. The size of the journal log is 1 PP size. The jfslog is used to ensure file system integrity by writing all metadata information to the jfslog immediately.
In journal log, only inode and indirect data block information is stored and not the actual data block.
There is also a new feature called inline log that is introduced with JFS2. This inline log allows you to log directly to the file system.
Difference between JFS and JFS2
Explanation:
JFS2 (Enhanced JournaledFile System)
Is a new file system introduced in AIX5.1. The base for JFS2 is JFS file system. At present JFS2 is the only standard file system supported on Itanium based platform.
Extent Based Allocation:
JFS2 uses extent based allocation. An extent is an address length pair, which identifies the starting block address and the length of the extent in blocks. This allows multiple adjacent blocks to be addressed. The advantage of extend based allocation are high performance and large file size.
In JFS2 the inodes are created dynamically i.e. on fly whereas in JFS there was a fixed number of inodes that was getting created during the creation of the file system. An inode in JFS2 file system is of size 512 bytes when compared to the JFS inode size of 128 bytes.
Migration issues: JFS and JFS2 can co-exist on the same system. But to migrate a JFS into JFS2, take the backup of data on the JFS file system, create a new JFS2 file system, restore the JFS file system backup on the new JFS2 file system.
Incoming search terms:
AIX file system structure
File system in AIX
AIX filesystem
Description of AIX filesystem
JFS and JFS2
Difference between JFS and JFS2
Journal log
Journal log in AIX
Inode in AIX
Allocation group size in AIX
Compressed file system in AIX
step by step create a filesystem on aix
Worth Reading...Thanks for the post :
ReplyDelete