You are on page 1of 36

File System

Working with file systems

What you should be able to do


Identify the components of an AIX file system Add an enhanced journaled file system Change characteristics of a file system Add a RAM file system Add a UDF file system on a DVD-RAM

How you will check your progress


Accountability: Checkpoint questions Exercise Activity

Where was Journaled File System (JFS) designed for?


1986 Advanced Interactive eXecutive (AIX) v.1 based on UNIX System V. for IBM's RT/PC. 1990 JFS1 on AIX was introduced with AIX version 3.1 for the RS/6000 workstations and servers using 32-bit and later 64-bit IBM POWER or PowerPC RISC CPUs. 1994 JFS1 was adapted for SMP servers (AIX 4) with more CPU power, many hard disks and plenty of RAM for cache and buffers. 1995-2000 JFS(2) (revised AIX independent version in c) was ported to OS/2 4.5 (1999) and Linux (2000) and also was the base code of the current JFS2 on AIX branch. Just for timeline comparison: 1989 High Performance File System (HPFS) was released with 16 bits OS/2 version 1.2. HPFS supported partitions up to 64 GiB and file sizes up to 2 MiB. The maximal HPFS cache was 2 MiB, but Microsofts HPFS386 cache supported "all available memory". 1990 Microsoft Windows 3.0 used the 8.3 File Allocation Table (FAT) file system. 1994 Windows NT 3.1 (-W2K!) contained a pinball.sys driver to use HPFS instead of FAT. 1995 Windows NT v. 3.51 promoted NTFS1 user rights. Windows 9x used FAT32. 1999 Windows 2000 and successors used NTFS.

Structure of a journaled file system


Superblock File system size and identification Free list, fragment size, nbpi inodes File size, ownership, permissions, times Pointers to data blocks Blocks Data blocks contain data Indirect blocks contain pointers to data blocks

Superblock The first addressable logical block on the file system is the superblock. The superblock contains information such as the file system name, size, number of inodes, and date/time of creation. The superblock is critical to the file system and, if corrupted, prevents the file system from mounting. For this reason a backup copy of the superblock is always written in block 31. Inodes Immediately following the superblock are inodes which contain identifying information for files, such as the file type, size, permissions, user/group/owner, and create/modification and last access dates. They also contain pointers to the data blocks for fragment addresses which hold the data. Indirect blocks For larger files the system creates sets of indirect blocks filled with data block addresses to point to the data block or fragments which hold the data

Function and contents of an inode


Each file is represented by a single inode. The inode contains information about that file such as the following: - Ownership - Access permissions - Type - Creation, modification and access times - Number of links to the file - Size - Addresses of data blocks on disk

You can create large files with the JFS file system type. JFS supports fragmented and compressed file systems, which 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

Enhanced Journaled File System (JFS2) is a file system, introduced in AIX 5.1, that provides the capability to store much larger files than the existing Journaled File System (JFS). You can make an point-in-time image of a JFS file system or of a JFS2 file system (AIX 5.2 and later), which you can then use for backup purposes. There are differences, however, in the requirements and behavior of this image for each file system type. JFS file systems are fully compatible within AIX 5.1 and AIX 5.2. Previous supported versions of the operating system are compatible with the current JFS, although file systems with a nondefault fragment size, NBPI value, or allocation group size might require special attention if migrated to a previous version

File System Commands


Create a file system. This command can be used to create a file system on an existing logical volume, or it can be used as an all in one command to create both a logical volume and file system at once.

crfs

chfs

Change file system characteristics. This can be used to increase the size of a file system. Remove a filesystem, its associated logical volume, and its entry in /etc/filesystems.

rmfs

Paging Space Commands


Lsps Lists information about paging space volumes.

Technical Features
JFS is a modern file system supporting many features, a few of which are listed here. fully 64-bit dynamic space allocation for i-nodes, i.e. no running out of i-nodes on file systems with large number of small files Directory structures designed for speed and efficiency: - directories with eight or fewer entries have their contents storied inline within that directory's i-node.- directories with more than eight entries have their contents stored in a B+ tree keyed on name.JFS utilizes extents for allocating blocks for large files. Support for extended attributes in addition to standard Unix-style permissions. Support for both internal and external logs (see below) Extremely Scalable; Consistent performance from minimum file size up to 4 petabytes. Algorithms designed for high performance on very large systems

Performance tuned for GNU/Linux Designed from the ground up to provide Transaction/Log (not an add-on) Restarts after a system failure < 1 sec Proven Journaling FS technology (10+ years in AIX) Original design goals: Performance, Robustness, SMP Team members from the original AIX JFS Designed/Developed this File System Designed to operate on SMP hardware, with code optimized for at least a 4-way SMP machine

NOTE: JFS uses a journal to maintain consistency of metadata only. Thus, only consistency of metadata (and not actual file contents) can be assured in the case of improper shutdown. This is also the case for XFS and ReiserFS. Ext3, on the other hand, does support journaling of both metadata and data , though with a significant performance penalty, and not by default.

Use of fragmented and compressed file systems


JFS supports fragmented and compressed file systems. Both types of file systems 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. In a fragmented file system, only the last logical blocks of files no larger than 32 KB are stored in this manner, so that fragment support is only beneficial for the file systems containing numerous small files. .

Data compression however, allows all logical blocks of any sized file to be stored as one or more contiguous fragments. On average, data compression saves disk space by about a factor of 2. JFS2 does not support file system compression

Working with file systems

JFS versus JFS2 file systems


Maximum File Size Architectural /Tested Maximum File System Size Architectural / Tested Inode Size Number of inodes Directory File Access Journal Log support Compression Quotas JFS 64 Gigabytes / 64 Gigabytes 1 Terabyte /1 Terabyte JFS2 1 Petabyte / 1 Terabyte

4 Petabytes / 1 Terabyte

128 Bytes Fixed, set at creation Sequential External JFSlog only Yes Yes

512 Bytes Dynamic B-tree Inline or External JFS2log No AIX 5L V5.3 and later

File Systems
# smit fs

Listing file systems


# lsfs

List all mounted file systems


# mount

Add/Change/Show/Delete File Systems


# smit manfs

# crfs command
The crfs command is the high-level command to create a file system.

Managing JFS file systems


Two ways of adding a JFS file system When choosing to add a JFS file system, there are two options: - If you choose to Add a Journaled File System, SMIT uses defaults to create the logical volume in which the file system sits. - If you choose to Add a Journaled File System on a Previously Defined Logical Volume, this assumes that the logical volume has already been created according to your specifications. The size of the file system is the size of the logical volume. In AIX V4.2 and later, the second SMIT menu shown on the visual is displayed nomatter which option is chosen for adding a JFS file system.

After completing this unit, you should be able to:


Monitor file system growth and control growing files Manage file system disk space usage Implement basic file system integrity checks

Space management
File systems expand upon notice, NOT automatically To keep from running into problems:
Monitor file system growth Determine causes Control growing files Manage file system space usage Control user disk usage Defragment file system

The Resource Monitoring and Control (RMC) subsystem


You can also use the Resource Monitoring and Control (RMC) subsystem that is based on the Reliable Scalable Cluster Technology (RSCT) on the IBM SP platform. Use the Web-based System Manager to configure RMC. You have 84 conditions and 8 responses to predefine. The ctrmc subsystem is started in the /etc/inittab.

Listing free disk space


The df command displays information about total space and available space on a file system # df

Importance of the df command


The df command lists the free space on all mounted file systems. This is an important command to be aware of and to use frequently. If you run out of space in a file system (especially / or /tmp), system corruption could occur.

Useful df command flags


Flag (Option df -I Displays information on the total number of blocks, the used space, the free space, the percentage of used space, and the mount point for the file system Information displayed is like that shown on the visual, but statistics in first two columns are given in units of 1024-byte blocks

df -k

df -m df -g

Information displayed is like that shown on the visual, but statistics in first two columns are given in units of 1 MB blocks Information displayed is like that shown on the visual, but statistics in first two columns are given in units of 1 GB blocks

The skulker command


The skulker command cleans up file systems by removing unwanted or obsolete files Cand idate files include: Files older than a selected age Files in the /tmp directory a.out files core files ed.hup files

Importance of Skuller Command


skulker is normally invoked daily by the cron command as part of the crontab file of the root user Modify the skulker shell script to suit local needs for the removal of files

Listing disk usage


The du command can be used to list the number of blocks used by a file or a directory

Defragmenting a file system


The defragfs command increases a file system's contiguous free space The file system must be mounted defragfs [-q | -r | -s] filesystem Options: -q Reports the current state of the file system -r Reports the current state of the file system and the state that would result if the defragfs command is run without either -q, -r or -s -s Gives short report regarding the current state of the file system

Verify a file system


Command syntax: fsck [-p | -y | -n] [-f] [ file system ] Checks journal log Checks inodes, indirect blocks, data blocks, free lists If no file system name is specified, the fsck command checks all file systems which have the check=true attribute set in the /etc/filesystems Orphan files are placed in the lost+found directory Unmount the file system before running fsck

Documenting file system setup


Run the lsfs command Get the contents of the /etc/filesystems file Run the df command to check free space Check all the mounted file systems by running the mount command

You might also like