Tanti Technology

My photo
Bangalore, karnataka, India
Multi-platform UNIX systems consultant and administrator in mutualized and virtualized environments I have 4.5+ years experience in AIX system Administration field. This site will be helpful for system administrator in their day to day activities.Your comments on posts are welcome.This blog is all about IBM AIX Unix flavour. This blog will be used by System admins who will be using AIX in their work life. It can also be used for those newbies who want to get certifications in AIX Administration. This blog will be updated frequently to help the system admins and other new learners. DISCLAIMER: Please note that blog owner takes no responsibility of any kind for any type of data loss or damage by trying any of the command/method mentioned in this blog. You may use the commands/method/scripts on your own responsibility. If you find something useful, a comment would be appreciated to let other viewers also know that the solution/method work(ed) for you.

Friday 22 November 2013

AIX File systems

File systems
A directory is a unique type of file that contains only the information needed to access files or other directories. As a result, a directory occupies less space than other types of files.
File systems consist of groups of directories and the files within the directories. File systems are commonly represented as an inverted tree. The root directory, denoted by the slash (/) symbol, defines a file system and appears at the top of a file system tree diagram.
Some of the most important system management tasks have to do with file systems, specifically:
  1. Allocating space for file systems on logical volumes
  2. Creating file systems
  3. Making file system space available to system users
  4. Monitoring file system space usage
  5. Backing up file systems to guard against data loss if the system fails
  6. Maintaining file systems in a consistent state
FileSystem

Note:The maximum number of logical partitions per logical volume is 32,512.For more information on file system logical volume characteristics,see the chlv command.
AIX supports four file system types:
jfs Journaled File System which exists within a Logical Volume on disk
jfs2 Enhanced Journaled File System which exists within a Logical Volume on disk
cdrfs CD-ROM File System on a Compact Disc
nfs Network File System accessed across a network
udfs Universal Disk Format (DVD ROM media)
gpfs General Parallel Filesystem
smbfs Server Message Block Filesystem (cifs_fs, samba share)
Description of File System:-
These include the following: In Aix generally JFS,JFS2, NFS, CDRFS and UDFS are used
Journaled File System (JFS) or Enhanced Journaled File System (JFS2)
  1. JFS and JFS2 file systems use database journaling techniques to maintain structural consistency. This prevents damage to the file system when the system is halted abnormally.
  2. The operating system mounts the file system during initialization.
  3. Each JFS or JFS2 located on a separate logical volume.
  4. JFS is the basic file system type that supports the entire set of file system commands.
  5. JFS2 is the basic file system type that supports the entire set of file system commands.
  6. This multiple file system configuration is useful for system management functions such as backup, restore, and repair, because it isolates a part of the file tree so that you can work on it.
Note :A difference between JFS and JFS2 is that JFS2 is designed to support
large files and large file systems.
Network File System (NFS)
The network file system (NFS) is a distributed file system that allows users to access files and directories located on remote computers and use those files and directories as though they are local.
CD-ROM File System (CDRFS)
The CD-ROM file system (CDRFS) is a file system type that allows you to access the contents of a CD- ROM through the normal file system interfaces.
DVD-ROM File System (UDFS)
Allows access to the contents of a DVD through the normal file system interfaces.
File System Structure:-
1. Superblock :
The superblock contains control information about a file system, such as the overall size of the file system in 512 byte blocks, the file system name, the file system log device, the version number, the number of inodes, the list of free inodes, the list of free data blocks, date and time of creation, and file system state. All this data is stored in the first logical block of the file system.
Note:- Corruption of this data may render the file system unusable
2. Inodes :
The inode contains control information about the file, such as type, size, owner, and the date and time when the file was created, modified, or last accessed. It also contains pointers to data blocks that store the actual data of the file. Every file has a corresponding inode.
For JFS file systems, the total number of i-nodes in a file system limits the total number of files and the total size of the file system. The JFS provides the nbpi (number of bytes per i-node) parameter that affects the number of i-nodes in a file system. For every nbpi bytes of your file system, there will be an inode created. The total number of inodes is fixed.
Note:The nbpi values needs to be correlated with allocation group size.
The JFS restricts all file systems to 16M (224 ) i-nodes.
JFS2 file systems manages the necessary space for inodes dynamically so there is not any nbpi parameter.
3.Data blocks:
Data blocks store the actual data of the file or pointers to other data blocks. The default value for disk block size is 4 KB.
Data BLock
4.Allocation group:
An allocation group consists of inodes and its corresponding data blocks. An allocation groups spans multiple adjacent disk blocks and improves the speed of I/O operations. Both JFS and JFS2 file systems use allocation groups. For a JFS file system, the allocation group size can be specified when the file system is created.
Allocation Group
Allocation Group
Size in Megabytes Allowable NBPI Values
8 512, 1024, 2048, 4096, 8192, 16384
16 1024, 2048, 4096, 8192, 16384, 32768
32 2048, 4096, 8192, 16384, 32768, 65536
64 4096, 8192, 16384, 32768, 65536, 131072
Fragments
Fragments of logical blocks can be used to support files smaller than the standard size of the logical block (4 KB). This rule applies only to the last block of a file smaller than 32 KB.
For JFS file systems only, you have the option to use compression to allow all logical blocks of a file to be stored as a sequence of contiguous fragments. Compression for a file system will increase the amount of CPU and I/O activity when using that file system.
These features can be useful to support a large number of small files. Fragment size must be specified for a file system at installation time. Different file systems can have different fragment sizes.
The JFS supports four fragment sizes of
512
,
1024
,
2048
, and
4096
byte units of contiguous disk space. The JFS maintains fragment addresses in i-nodes and indirect blocks as 28-bit numbers. Each fragment must be addressable by a number from 0 to (
228). Fragement
The file system size limitation is the minimum of the following:

NBPI * 224
or
FragmentSize * 228
Difference Between JFS & JFS2 :
FunctionJFSJFS2
Architectural maximum file system size1 TB4 PB
Architectural maximum file size64 GB4 PB
Number of i-nodesFixed, set at filesystem creationDynamic
Inode size128 bytes512 bytes
Fragment size512512
Block size40964096
Directory organizationLinearB-tree
CompressionYesNo
Default ownership at creationsys.sysroot.system
SGID of default file modeSGID=onSGID=off
QuotasYesYes
File System Commands :-

crfs→Create a file system. This command can be used to create a file system on an existinglogical volume, or it can be used as an all in one command to create both a logical volume and file system at once.
chfs → Change file system characteristics. This can be used to increase the size of a file system.
rmfs →Remove a filesystem, its associated logical volume, and its entry in /etc/filesystems.
crfs:-
Its purpose is to add a file system. The crfs command creates a file system on a logical volume within a previously created volume group. A new logical volume is created for the file system unless the name of an existing logical volume is specified using the -d. An entry for the file system is put into the /etc/filesystems file.
You can use the File Systems application in Web-based System Manager (wsm) to change file system characteristics. You could also use the System Management Interface Tool (SMIT)smit crfs fast path to run this command.
Notes: The file system is created with the setgid (set group ID) bit enabled. This determines the default group permissions. All directories created under the new file system will have the same default group permissions.
Eg:-
  1. To make a JFS on the rootvg volume group with nondefault fragment size and nondefault nbpi. type
# crfs -v jfs -g rootvg -m /test -a \ size=32768 -a frag=512 -a nbpi=1024
Here, this command creates the /test file system on the rootvg volume group with a fragment size of 512 bytes, a number of bytes per i-node (nbpi) ratio of 1024, and an initial size of 16MB (512 * 32768).
  1. To make a JFS on the rootvg volume group with nondefault fragment size and nondefault nbpi,type
# crfs -v jfs -g rootvg -m /test -a size=16M -a frag=512 -a nbpi=1024
Here, this command creates the /test file system on the rootvg volume group with a fragment size of 512 bytes, a number of bytes per i-node (nbpi) ratio of 1024, and an initial size of 16MB.
3. To create a JFS2 file system which can support NFS4 ACLs, type:
# crfs -v jfs2 -g rootvg -m /test -a size=1G -a ea=v2
Here, this command creates the /test JFS2 file system on the rootvg volume group with aninitial size of 1 gigabyte. The file system will store extended attributes using the v2 format.
chfs:-
Its purpose is to changes attributes of a file system. The chfs command changes the attributes of a file system. The new mount point, automatic mounts, permissions, and file system size can be set or changed. The FileSystem parameter specifies the name of the file system, expressed as a mount point.
Some file system attributes are set at the time the file system is created and cannot be changed. For the Journaled File System (JFS), such attributes include the fragment size, block size, number of bytes per i-node, compression, and the minimum file system size. For the Enhanced Journaled File System (JFS2), the block size cannot be changed.
The chfs command also accepts attributes that have no meaning to the file system and file system does not act on the attributes.. The attributes are saved in the /etc/filesystems file. The /etc/filesystems limitation is 512 bytes only if exceed the stanza is no longer recognised.
You could also use the System Management Interface Tool (SMIT) smit chfs fast path to run this command.
A new commit type has been added to the mount command. The syntax is:
cmtype=[gc|ac]
where
gc=group commit (the commit log record is synchronously written to disk before the system call returns,If a system failure occurred, recent changes will not be lost the crash recovery.)
ac=asynchronous commit (the commit log record is asynchronously written to the disk when the system call returns,improve the system performance,f a system failure occurred, recent changes will not be lost the crash recovery)
Eg:-
# chfs -a cmtype=[gc|ac] -a size=+1 /j2.0
Only the root user or a member of the system group can run this command.
  1. To change the file system size of the /test Journaled File System, type
# chfs -a size=24576 /test
  1. To increase the size of the /test Journaled File System, type
# chfs -a size=+8192 /test
  1. To change the mount point of a file system
# chfs -m /test2 /test
  1. To reduce the size of the /test JFS2 file system, type
# chfs -a size=-16M /myfs
chfs
  1. To mount a read-only copy of /testfs at /backup.
# chfs -a splitcopy=/backup -a copy=2 /testfs
rmfs:-
Its purpose is to remove a file system. The rmfs command removes a file system. If the file system is a journaled file system (JFS or JFS2), the rmfs command removes both the logical volume on which the file system resides and the associated stanza in the /etc/filesystems file. If the file system is not a JFS or JFS2 file system, the command removes only the associated stanza in the /etc/filesystems file. The FileSystem parameter specifies the file system to be removed.
You could also use the System Management Interface Tool (SMIT) smit rmfs fast path to run this command.You can use the File Systems application in Web-based System Manager (wsm) to change file system characteristics.
Eg:-To remove the /testfile system, type
# rmfs /test
Note: To remove a file system data from /etc/filesystems: imfs -x -l
The asterisk (*) is the comment character used in the /etc/filesystems file.
lsfs:-
Its purpose is to displays the characteristics of file systems.such as mount points, automatic mounts, permissions, and file system size. The FileSystem parameter reports on a specific file system.
The following subsets can be queried for a listing of characteristics:
  • All file systems
  • All file systems of a certain mount group
  • All file systems of a certain virtual file system type
  • One or more individual file systems
You could also use the System Management Interface Tool (SMIT) smit lsfs fast path to run this command.You can use the File Systems application in Web-based System Manager (wsm) to change file system characteristics.
  1. To show all file systems in the /etc/filesystems file, type:
#lsfs
  1.  To show all file systems of vfs(virtual file system) type jfs, type:
# lsfs -v jfs
  1.  To show the file system size, the fragment size, the compression algorithm (if any), and the number of bytes per i-node as recorded in the superblock of the root file system, type:
# lsfs -q /
># istate (show the data of file system)
Example:-
1.How to check Inode Number.
# ls li
2.How To copy superblock content when it is corrupted.
# dd count=1 bs=4k skip=31 seck=1 if=/dev/lv00 of=/dev/lv00.
File System Management -
A file system is a complete directory structure, including a root directory and any subdirectories and files beneath it.
File systems are confined to a single logical volume. Some of the most important system management tasks are concerning file systems, specifically:
  • Allocating space for file systems on logical volumes
  • Creating file systems
  • Making file system space available to system users
  • Monitoring file system space usage
  • Backing up file systems to guard against data loss in the event of system failures
  • Making a snapshot to capture a consistent block-level image of a file system at a given point in time
  • Maintaining file systems in a consistent state.
Mounting and unmounting file systems:-
Mounting is a concept that makes file systems, files, directories, devices, and special files available for use at a particular location. It is the only way a file system is made accessible.
The mounting point(directory) must be created before the file system is mounted.
Use the mount command as follows:
# mkdir
# mount  (name of directory on which you want to mount)
Or
# mount {-a|all}
# mount (Display the mounted file systems)

O/P →
node mounted mounted over vfs date options
——– ————— ————— —— —————————
/dev/hd4 / jfs2 Nov 27 12:36 rw,log=/dev/hd8
/dev/hd2 /usr jfs2 Nov 27 12:36 rw,log=/dev/hd8
/dev/hd9var /var jfs2 Nov 27 12:36 rw,log=/dev/hd8
/dev/hd3 /tmp jfs2 Nov 27 12:36 rw,log=/dev/hd8
/dev/hd1 /home jfs2 Nov 27 12:36 rw,log=/dev/hd8
/proc /proc procfs Nov 27 12:36 rw
/dev/hd10opt /opt jfs2 Nov 27 12:36 rw,log=/dev/hd8
/dev/testlv /test jfs2 Nov 28 19:54
rw,log=/dev/loglv01
Note:
  1. Automatic fs is to be mounted at boot; this is usually used for system-defined file systems.
  2. True mount all is allowed to mount this file system.
  3. False mount will only occur when the file system is specified as an argument to the mount command, or the type is used for mount.

No comments:

Post a Comment