dropdown menu

FS-File system

FS-File system


A file system is a hierarchical tree structure of files and directories. Some tasks are performed more efficiently on a file system than on each directory within the file system. For example, you can back up, move, or secure an entire file system.

File systems are associated with devices (logical volumes) represented by special files in /dev. When a file system is mounted, the logical volume and its contents are connected to a directory in the hierarchical tree structure. You can access both local and remote file systems using the mount command.

AIX supports these 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
UDF      Universal Disk Format (DVD ROM media)
SMBFS    Server Message Block Filesystem (cifs_fs, samba share)
PROCFS   Proc File System
NFS      Network File System accessed across a network

some extra:
GPFS     General Parallel Filesystem
AHAFS    Autonomic Health Advisor File System
------------------------

System-Created File Systems in AIX
The six standard file systems in AIX Versions 5 and higher are /, /home, /usr, /proc, /tmp, and /var. Each of these file systems is always associated with a logical volume name:

Logical Volume          File System or Description
------------------------------------------------------
hd1                     /home    (users' home dir)   
hd2                     /usr     (operating system commands, libraries and application programs)
hd3                     /tmp     (temporary space for all users)
hd4                     /        (critical files for system operations, programs that complete the boot process)
hd5                     <boot logical volume>
hd6                     <primary paging space>
hd8                     <primary JFS or JFS2 log>
hd9var                  /var     (variable spool and log files)
hd10opt                 /opt     (freeware programs)
/proc                   /proc    (pseudo fs kept in memory to support threads)



------------------------

/etc/filesystems

All of the information about the file system is centralized in the /etc/filesystems file. Most of the file system maintenance commands take their defaults from this file. The file is organized into stanza names that are file system names and contents that are attribute-value pairs specifying characteristics of the file system.

/tmp:                           <-- names the directory where the file system is normally mounted
        dev      = /dev/hd3     <-- for local mounts identifies the block special file where the file system reside
                                    for remote mounts, it identifies the file or directory to be mounted
        vfs      = jfs2         <-- specifies the type of mount. For example, vfs=nfs
        log      = /dev/hd8     <-- full path name of the filesystem logging logical volume (only for jfs and jfs2)
        mount    = automatic    <-- used by the mount command to determine whether this file system should be mounted by default
        type     = nas          <-- several file systems can be mounted by giving the value as an argument to the -t flag (mount -t nas)
        check    = false        <-- used by the fsck command to determine the default file systems to be checked
        vol      = /tmp         <-- used by the mkfs command when initiating the label on a new file system
        free     = false        <-- it is there because of unix traditions only (It is totally ignored by any and all AIX commands)
                                    (df command in traditional UNIX would use it to determine which file systems to report)

For the option mount, these are valid entries: automatic, true, false, removable, and readonly:
automatic    fs is to be mounted at boot; this is usually used for system-defined file systems.
true         mount all is allowed to mount this file system.
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.

The asterisk (*) is the comment character used in the /etc/filesystems file.

------------------------

mount

The mount command is the glue that logically connects file systems to the directory hierarchy. When a file system is mounted, the logical volume and its contents are connected to a directory in the hierarchical tree structure.

mount /dev/bblv /home/bb       mounts the given lv (bblv) to the given dir (/home/bb)
mount /home/bb                 usually mount used this way, same as above (because /etc/filesystems contains lv and mount points)

------------------------


imfs

All filesystem related commands (crfs/rmfs..) are managing /etc/filesystems file automatically, so usually /etc/filesystems should not be edited manually. (However it is possible with vi.) There is another method which updates /etc/filesystems and this is the command 'imfs', which is not documented, but exists with AIX since the 90s.

If /etc/filesystems file has been removed or some parts have been deleted/overwritten accidentally imfs can create (or remove) filesystem related stanzas.

imfs -x <vgname>                <--remove all filesystems related to the given vg from /etc/filesystems
imfs -xl <lvname>               <--remove a filesystem (logical volume) stanza from /etc/filesystems

imfs <vgname>                   <--it recreates all filesystems in /etc/filesystems which are in the given vg
imfs -l <lvname>                <--it recreates one filesystem in /etc/filesystem

(I think this command is using the vg and lv data on the disk and in the odm to recreate info in /etc/filesystems.)

------------------------------------------------------ 

Superblock
In a JFS, the superblock is the first addressable block (and a backup at the thirty-first addressable block) on a file system. It is 4096 bytes in size. The superblock is very important because a file system cannot be mounted if the superblock is corrupted. This is why there is a secondary or backup superblock at block 31. The superblock contains the following: size of the filesystem, number of datablocks in the fs, state of the fs...

# dd count=1 bs=4k skip=31 seek=1 if=/dev/hd4 of=/dev/hd4     <--this will restore the superblock from block #31
# fsck -p <fs>                                                <--this will copy also the superblock from #31
# dumpfs /usr                                                 <--shows the superblock, i-node map, and disk map information
# od -x -N 64 /dev/hd1 +0xF000                                <--display first superblock (JFS2)
# od -x -N 64 /dev/hd1 +0x8000                                <--display second superblock (JFS2)

------------------------

i-node (index node)
A file system has a fixed number of i-nodes that are located following the superblock. i-nodes contain information about files, including the location of the data on the disk. They contain all of the identifying information about files (file type, size, permissions, user/group/owner, create/modification and last access dates) except for the file name, which is stored in the directory, and the contents of the file, which are stored in the data blocks. Each file or directory has an i-node associated with it. AIX reserves a number of i-nodes for files and directories every time a file system is created, and if all the available inodes are used, no more files can be created, even if the fs has free space.

------------------------

jfslog
AIX uses a journaled file system, meaning that certain i-node information is stored in a transaction log during writes. Its real value is in maintaining the integrity of the file system. Journaled file systems enable faster system reboots after system crashes. Each volume group has a jfslog file that is automatically created when the first file system is created in that volume group. The jfslog ensures the integrity of a file system by immediately writing all meta-data information to itself. Meta-data is information about the file system, such as changes to the i-nodes and the free lists. The jfslog keeps track of what is supposed to happen to the file system and whether it gets done. You are allowed to have a separate log for each filesystem.

(If a jfslog has been created manually, the logform command should be used to activate it as the jfslog for that vg.)

------------------------

Special or device files
A special file, sometimes called device file is associated with a particular hw device or other resource of the computer system. AIX uses them to provide file I/O access to character and block device drivers. Special files are distinguished from other files by having a "c" or "b" stored in the i-nodes, and they are located under the /dev directory. Character and block I/O requests are performed by issuing a read or write request on the device file:
- Character device file: Character devices (tape drives, tty devices) are capable of doing sequential I/O.                   
- Block device file: Block devices can only do random I/O, such as disk devices.

mknod: creates new special files (i-node and the file type (c or b) sould be set), major minor numbers will be written into the i-node

------------------------

Directories
The directory entry contains an index number associated with the file's i-node, the file name....
Every well formed directory contains the entries: . and ..
-.: points to the i-node for the directory itself
-..: points to the i-node for the parent directory

Because directory entries contain file names paired with i-nodes, every directory entry is a link.

------------------------

Links
Links are connection between a file name and an i-node. The i-node number actually identifies the file not the filename. By using links, any i-node or file can be known by many different names.
-hard link: Hard links can be created only between files that are in the same fs.
(when the last hard link is removed , the i-node and its data are deleted)
           
# ls -li: (bello is a hard link, and link count 2 shows it)
4 -rw-r--r--    2 root     system            0 Jul  8 23:27 bello

-symbolic link: Allow access to data in other filesystems from a new filename.

# ls -li: (bello is a sym. link, and  the first character "l" shows this)
lrwxrwxrwx    1 root     system           15 Jul  8 23:30 bello -> /test_fs1/hello

------------------------

NameFS (Name File System)
A NameFS is a pseudo-file system that lets you access a directory through two different path names. With a NameFS you can create a second path and you don't have to change permissions, copy, move, rename or even touch the original file system.

You could use a Name File System to set up a directory with:
-an alternate path (so it’s like a shortcut)
-different permissions (e.g. when some applications or users should have read-only access)
-other mount attributes such as Direct I/O (dio) or Concurrent I/O (cio)

How to setup NameFS:

1. mkdir -p /shortcut                                <--create a dir, which will be the mount point for the new Name file System

2.:
mount -v namefs /some/long/path /shortcut            <--with this you got access to the files via 2 paths
mount -v namefs -o ro /data/report /data_reports     <--with this you can make a read only mount of a dir
mount -v namefs -o cio /db2/W01/redo /deb2redo       <--with this you can mount a dir with CIO to improve I/O

------------------------

crfs                                                       creates a file system (crfs can create lv as well if needed)
crfs -v jfs2 -m /bb -a size=1G -g bbvg                     creates fs and lv (fslv00)(after that lv can be renamed if needed: chlv -n...)
crfs -v jfs2 -d bblv -m /bb -A yes -p rw -a options=cio    creates fs on the given lv with many parameters.
                                                           (lv can be created: mklv -t jfs2 -y bblv bbvg 80 hdiskX hdiskY)

mkfs                           creates an fs over an already created lv (lv must already exist)

mount                          displays information about all the currently mounted file systems
mount dir_name                 mount the file system according to the entry in /etc/filesystems
mount lv_name dir_name         mount the file system to another lv than  in /etc/filesystems
umount dir_name                umount the filesystem
mount -a or mount -all         mounts all the file systems at one time

lsfs                           displays the characteristics of file systems
lsfs -q                        more detailed info about the fs (lv size...) (it queries the superblock)
                               (-v: list filesytems belonging to given fs type (jfs2, nfs); -u: lists filesystems in the given mount group)
rmfs /test                     removes a file system
rmfs -r /test                  removes the mount point also
chfs -a size=+5G /shadowtemp   it will increase by 5G the fs (-5G can be used as well, or 5G will set tthe size of the fs to 5GB)
                               (if fs was reduced but space is not freed up defragfs could help)
chfs -a options='rw' /shadow   shows with lsfs rw (I think rw is the deafault anyway)

imfs -x -l <lvname>            remove a file system data from /etc/filesystems


fsck                           checks file system consistency (should not run on a mounted file system)
defragfs /home                 improves or reports the status of contiguous space within a file system

ls -ldi <dir>                  shows inode number in the first column
istat /etc/passwd              display information regarding a particular inode (last updated, modified, accessed)
                               (update: change in the inode (file name, owner...); modified: change in the content of the file or dir)

df                             monitor file system growth
du dir_name                    (disk usage), to find which files are taking up the most space
du -sm * | sort -rn | head     shows every dir size in MB (du -sk * the same in KB), the first 10 largest

skulker                        cleans up file systems by removing unwanted or obsolete files
fileplace <filename>           displays the placement of file blocks within logical or physical volumes, it will show if a file fragmented

fuser /etc/passwd              lists the process numbers of local processes using the /etc/passwd file
fuser -cux /var                shows which processes are using the given filesystem
fuser -cuxk /var               it will kill the above processes   
fuser -dV /tmp                 shows deleted files (inode) with process ids which were open by a process (so its space could not be freed up)
                               (-V: verbose will show the size of the files as well)
                               if we rm a file, while it is opened by a process its space will not free up.
                               solution: kill the process, wait for the process to finish or reboot the system
---------------------------------------

HOW TO FIND FILES AFTER A SPECIFIC DATE:

touch mmddhhmm filename        creates a file at a specific date
find /var -xdev -newer filename -ls

---------------------------------------

CREATING FS with commands:

1. mkvg -y oravg -s 128 hdiskpower62                                 <--creates vg with 128MB pp
2. mklv -y oraloglv -t jfs2log -a e -r n oravg 1 hdiskpower62        <--creates loglv (-a: allocation (e:edge), -r: relocatable (n:no))
3. mklv -y oralv -t jfs2 -a e oravg 500 hdiskpower62                 <--creates lv (-a: allocation (e:edge))
4. crfs -v jfs2 -a logname=oraloglv -d oralv -m /ora                 <--creates fs with specified loglv (set auto mount if needed)
5. mount /ora                                                        <--mount fs
6. chown -R oracle.dba /ora_backup                                   <--set owner/permission

---------------------------------------

EXTENDING FS with commands:

1. extendvg oravg hdiskpower63                                       <--extends vg with hdisk
2. chlv -x 1024 oralv                                                <--set the maximum number of logical partitions if needed
3. extendlv oralv 20 hdiskpower63                                    <--extends lv to the specified hdisk
4. lslv -m oralv                                                     <--check allocations if needed
5. lsfs -q /ora                                                      <--shows new size of the lv (copy value of 'lv size')
6. chfs -a size=146800640 /ora                                       <--use the 'lv size' value to enlarge fs

--------------------------------------------

HOW TO CORRECT CORRUPTED FS:
1. fsck /fs1                <--checks fs consistency (should not run on a mounted file system)
2. umount /fs1              <--umounts fs

If umount fails:
fuser -cux /fs1             <--shows processes running in the fs
fuser -kcux  /fs1           <--kills the above processes (kill -9 works as well) (inittab/repawn processes will be there again)
umount /fs1

3. fsck -y /fs1             <--corrects errors

--------------------------------------------

HOW TO CORRECT CORRUPTED ROOTVG FS:

1. on NIM server setup client for network boot: nim -o maint_boot -a spot=spot-6100-09-01 <client>       
(smitty nim --> nim admin. tasks --> machines --> perform operations on machines --> maint_boot (if needed choose spot))

2. boot into SMS (set ip, and network boot)
NOTE: Although you will be going into maintenance mode on the NIM client, you DO NOT want to select “Service Mode Boot”. That is a very limited shell, and will not always allow you to do everything you would like to do in maintenance mode. Select “Normal Mode Boot.

3. Choose "Access Root VG" --> "Access this Volume Group and start a shell before mounting filesystems"

4. fsck needed fs (lv):
   fsck /dev/hd4
   fsck /dev/hd2
   fsck /dev/hd3
   fsck /dev/hd9var
   fsck /dev/hd1

NOTE: The -y option automatically repairs file system corruption. This flag can be used to avoid having to manually answer multiple confirmation prompts, however, use of this flag can cause permanent, unnecessary data loss in some situations.

5. To format the default jfslog for the rootvg: /usr/sbin/logform /dev/hd8
(Answer yes when asked if you want to destroy the log.)

6. Reboot system into normal mode: sync;sync;sync;reboot

(If /etc/filesystems is corrupted, follow this docu from point #10: http://www-01.ibm.com/support/docview.wss?uid=isg3T1000131)

--------------------------------------------

CANNOT UNMOUNT FILE SYSTEMS:

umount: 0506-349 Cannot unmount /dev/fslv00: The requested resource is busy.

-files are open or a user is using a directory in the fs:
fuser                       <--determines the PIDs for all processes that have open references within the fs
kill                        <--these processes can be killed

-loaded kernel extension:
genkex                      <--reports all loaded kernel extension

-file systems are still mounted within that file system:
umount                      <--umount first the embedded file systems!!!!!

-you can check processes using it with lsof:
lsof /home                  <--it will show the pids what should be terminated (kill <pid>)

-file system is an nfs4 exported fs:
cat /etc/exports            <--check if fs is listed there as an nfs4 exported fs (-vers=4)
exportfs -u <fs>            <--removes export, after umount is possible. (after exportfs <fs> will re-export)

--------------------------------------------

HOW TO COPY A FILESYSTEM:

cp: good for smaller filesystems (less than 10GB) with not so many files, can be done online
tar: good for lots of small files and if it has to be done online (if files are greater than 2GB use GNU tar utility)
cplv: this is better with large filesystems, with many files (it is copying at pp (lv) level, not file by file (filesystem level) (umount is needed)

--------------

cp:
cp -prh /origfs/* /destfs/                     <--this is good if small number of files need to be copied online (verify after copy: ls -lR|wc -l)

--------------

tar:
cd /origfs                                    <--cd to the directory what you want to copy
tar cvf - . | (cd <destfs> && tar xvf -)      <--it copies everything from here to destfs (file size limit? 6GB OK)
                                              Ibm site I saw this: tar cpf - . | (cd /opt/pluto_bak; tar xpf - )
ls -lR | wc -l                                <--check if everything is identical, for both dir

--------------

cplv:
(In the first example both the original and the copied filesystems can be mounted after copying finished if needed.)
(As lv names are unique system wide, lvs can be in different vg and cplv can understand them.)

original fs: /origfs (origlv)
destination fs: /destfs (destlv)

0. create destination fs: /destfs              <--if destination fs does not exist create it (min. size as origfs, can be in different vg)
1. umount /origfs; umount /destfs              <--umount both filesystems (cplv works only if fs is not mounted)
2. chlv -t copy destlv                         <--type of destination lv should be changed from jfs/jfs2 to copy (otherwise cplv gives error)
3. cplv -e destlv origlv                       <--copy to an existing logical volume (-e) (it will change type of destlv to jfs2)
4. mount /origfs; mount /destfs                <--check if everything is OK
5. umount /destfs; fsck /dev/destlv            <--good habit to do an fsck


(In the second example fs will be moved, both origfs and destfs cannot be mounted at the same time.)
0. no destination fs (lv) is needed            <--as fs (lv) will be moved (migrated) no destination fs is needed, cplv will create new lv
1. umount /origfs                              <--umount is needed, cplv works only if fs is not mounted
2. cplv -v VGname -y newLV origlv              <--if VGname (-v) omitted lv is created in the same vg
3. chfs –a dev=/dev/newLV –a log=/dev/[logdev] /origfs    <--lv and logdevice of /origfs should be changed to show new parameters (lsvg -l vg|grep log)
                                               (instead chfs, /etc/filesystems can be edited: change "dev" and "log" lines to new values)
4. mount /origfs                               <--check if everything is OK
5. umount /origfs; fsck /dev/newLV             <--good habit to do an fsck
6. rmlv origlv                                 <--origlv can be removed (or if you want fallback, chfs to original values)



--------------------------------------------

BACKUP/RECREATE/RESTORE FILESYSTEM:

1. cd /filesystem
2. tar -cvf /tmp/filesystem.tar ./*                        <--it creates a backup of all the files in the fs
3. cd /
4. umount /filesystem
5. mkfs /filesystem
6. mount /filesystem
7. cd /filesystem
8. tar -xvf /tmp/filesystem.tar > /dev/null                <--restores the data (output redirected, as displaying is time consuming)

--------------------------------------------

CHANGING THE LOG LOGICAL VOLUME:
If an fs is write extensive, the use of the log logical volume can cause io bottleneck if it is placed on the same disk.
(e.g. data-fs is located on hdisk2)

1. umount /data-fs                                         <--umount the fs for which you want to create the new log logical volume
2. mlv -t jfs2log -y datafsloglv datavg 1 hdisk1           <--create a new log logical volume
3. logform /dev/datafsloglv                                <--format the log
4. chfs -a log=/dev/datafsloglv /data-fs                   <--it will modify /etc/filesystems to consist the new settings
5. getlvcb -ATdatalv                                       <--just for checking if lvcb is updated
6. mount /data-fs                                          <--mount back the changed filesystem

--------------------------------------------

REMOVING A FILE WITH SPECIAL CHARACTERS:

1. find inode number
root@bb_lpar: /tmp/bb # ls -i
   49                <--the name of the file is empty
   35 commands              
   47 lps.txt


2.  remove file by inode number
root@bb_lpar: /tmp/bb # find . -inum 49 -exec rm '{}' \;

--------------------------------------------

FILESYSTEM CLEANUP HINTS:

find large files:
find /var -size +10000 -mtime -1 -exec ls -ltr {} \;       <--files > 5MB (10000x 512bytes) and modification date is less than a day
find . -xdev -size +4000000c -exec ls -l {} \;             <--it will list files larger than 4MB in the fs
find . -type f | xargs ls -s | sort -rn | head             <--10 largest file (if there is another fs under it, it will search there too)
find . -type f -size +10000 | while read X ; do du -sm "$X" ; done | sort -n | tail -n 15        <--15 largest file


/etc:

/etc/perf/daily/                                           <--xmdaily logs can be removed if not needed
                                                           (can be removed from inittab and xm processes can be killed)

who /etc/security/failedlogin                              <--lists failed logins
> /etc/security/failedlogin                                <--clears that file


/usr:

/usr/websm/pc_client                                       <--windows, exe files can be removed


/var:

/var/adm/wtmp:
who /var/adm/wtmp                                          <--shows the contents of that file
/usr/sbin/acct/fwtmp < /var/adm/wtmp | tail -5000 > /tmp/wtmp.asc   <--converts wtmp to ascii, saves last 500 lines
/usr/sbin/acct/fwtmp -ic < /tmp/wtmp.asc > /var/adm/wtmp            <--converts back to original format
rm /tmp/wtmp.asc                                           <--delete the ascii file


/var/adm/cron/log:
> /var/adm/cron/log                                        <--this can be cleared
   
/var/spool/lpd:
stopsrc -s qdaemon                                         <--stops qdaemon
rm /var/spool/lpd/qdir/*                                   <--clears dir
rm /var/spool/lpd/stat/*                       
rm /var/spool/qdaemon/*
startsrc -s qdaemon                                        <--starts qdaemon

/var/spool/mail   
                                        <--under this dir, not needed mails can be cleared as well
/var/adm/sulog                                             <--this file can be reduced (cleared) as well

--------------------------

109 comments:

hdkutz said...

#########################################################
# Can I identify deleted files still opened by a process?
#########################################################
Just run fuser -V -d on the filesystem you want to check for deleted but still opened files. This is an example for /filesystem1:

user@localhost:/filesystem1 >fuser -V -d /filesystem1
/filesystem1:
inode=205 size=8388624384 fd=17 1028162
inode=214 size=8388624384 fd=16 3465470
inode=113 size=8388624384 fd=26 3977340
inode=204 size=8388624384 fd=66 5316844

find out what the last column pid is:
ps -ef|grep 1028162

aix said...

Thank You hdkutz!

Anonymous said...

Too much detail.....
overloading.

Thanks BTW.

Anonymous said...

very informative

Unknown said...

That's True yaar. Too Much information...

Thanks a ton...............!!!!

Anonymous said...

hi,
What is the difference between inline log and external log . Any performance differences ?

aix said...

Hi, you can define inline log when filesystem is created, so every filesystem can have 1 inline log, however 1 jfs2log can support many filesystems. This could have the disadvantage, if we have several heavily used filesystems and these have only 1 jfs2log which is used very heavily as well and it could be a bottleneck on the disk. With inline log every filesystem can have its own log. Inline log is a new feature, so per IBM using it is easier (less management needed, don't have to allocate extra space on the disk for the log lv...)
But in real life we have many systems with jfs2 log and I don't remember we had any problem with those....

sureshraavi said...

how will we see the contents of the super block

sureshraavi said...

why ther is no /dev/hd7 what is the reason

aix said...

I have found this:
"With root authority, use the od command to display the superblock for the file system, as shown in the following example:

od -x -N 64 /dev/lv02 +0x1000

Where the -x flag displays output in hexadecimal format and the -N flag instructs the system to format no more than 64 input bytes from the offset parameter (+), which specifies the point in the file where the file output begins. The following is an example output:

0001000 1234 0234 0000 0000 0000 4000 0000 000a
0001010 0001 8000 1000 0000 2f6c 7633 0000 6c76
0001020 3300 0000 000a 0003 0100 0000 2f28 0383
0001030 0000 0001 0000 0200 0000 2000 0000 0000
0001040

In the preceding output, note the corrupted magic value at 0x1000 (1234 0234). If all defaults were taken when the file system was created, the magic number should be 0x43218765. If any defaults were overridden, the magic number should be 0x65872143."

BUT, for me this does not work :(

aix said...

During the history of AIX "hd" numbering changed many times. I have found this: "hd7 became the dump device in AIX V3 in AIX 4 hd7 disappeared"

Unknown said...

Hi,
I'm trying create a JFS (v1) over AIX 6.1 and get the problem bellow.
Is there something missing?
(the main objective is create this the FS with compress=LZ for a database test environment,
but I stopped into the same error)


> mklv -y'lvifxdados1log' -t'jfslog' -u'1' ifxdat2vg 1G
lvifxdados1log

> mklv -y'lvifxdados1' -t'jfs' ifxdat2vg 2G
lvifxdados1

> crfs -v jfs -a logname=lvifxdados1log -d lvifxdados1 -m /vul/ifxdados
Based on the parameters chosen, the new /vul/ifxdados JFS file system
is limited to a maximum size of 134217728 (512 byte blocks)

New File System size is 4194304

> mount /vul/ifxdados
mount: 0506-324 Cannot mount /dev/lvifxdados1 on /vul/ifxdados: A system call received a parameter that is not valid.

aix said...

Hi,

logform was missing when you created jfslog lv.

I recreated what you did on a vg with 256MB PP size:

# logform -V jfs /dev/lvifxdados1log
WARNING: log size greater than one segment
Only 256MB of log will be used
logform: destroy /dev/lvifxdados1log (y)?y

# mount /vul/ifxdados
# df -g | grep dados
/dev/lvifxdados1 2.00 1.94 4% 17 1% /vul/ifxdados


After logform mount is OK now :)
What I did not understand, why did you create a log lv with 1GB?

Anonymous said...

Hi,

Please provide me the steps to migrate a Filesystem to new VG. Thanks in advance!!

aix said...

Hi,

you can find the steps above "HOW TO COPY A FILESYSTEM". If new filesystem name should be the same as the old one, then basically all the steps above are correct. If different filesystem names are possible, then "renaming" step is not needed.
In short:
1. create new fs
2. mount old fs in read only mode (to be on safe side)
3. copy data from old fs to new fs
4. remove old fs and rename new fs if needed

Anonymous said...

Hi,
"aix" will also support UDF, GPFS, SMBFS right? If it is so just add these list of filesystems to your above mentioned filesystems in this page...

Anonymous said...

This is Jus 4 UR info and also to help viewers... Okay???

aix said...

Thanks a lot for your info. I have already updated this page with your suggestions.
I really appreciate your contribution :)

prabaharan said...

Which file system must not be compress ?
/usr
/home/
/root
/tmp

Please provide the answer and tell why

aix said...

This is written at IBM site:
Data compression is not supported for JFS2.
The root file system (/) must not be compressed. Compressing the /usr file system is not recommended because installp must be able to accurately calculate its size for updates and new installs.

Anonymous said...

Just a question ...
can we unmount the following file system /, /usr, /home, /var & /tmp ?
I have seen above your example ...you have unmounted /var & run the fsck... this is will work ?

I guess for OS file system we need to boot in maintenance mode & then run the FSCK ..

Please correct me if I'm wrong !!

Thanks

aix said...

You are right, AIX related filesystems can be unmounted only in maintenance mode.
Thanks for bringing this up, I have corrected the above example and changed the filesystem name.

Anonymous said...

Hi, Thanks for the information.

But this lsof command is not working.

aix said...

Hi, it should work:

root@bb_lpar: /root # lsof /home
lsof: WARNING: device cache mismatch: /dev/pts/170
COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME
ctxxmld 294994 ctxsrvr cwd VDIR 10,8 256 9 /home (/dev/hd1)
ctxfm 467186 ctxsrvr cwd VDIR 10,8 256 9 /home (/dev/hd1)
ctxxmldss 487474 ctxsrvr cwd VDIR 10,8 256 9 /home (/dev/hd1)
ctxlsd 536588 ctxsrvr cwd VDIR 10,8 256 9 /home (/dev/hd1)


Do you have lsof installed on your server?

Luis A. Gonzalez said...

Hello

Thanks a lot for the tips.

I have an issue with the chfs command, can you help me?

The problem is: I have a FS that I need to increase in 10GB the command chfs -a size=+10G /usr/sap/trans says the FS is increased, but the df command shows the same previos value

BEFORE
[ccheccd:/]#df -g /usr/sap/trans
Filesystem GB blocks Used Free %Used Mounted on
/dev/fslv15 10.00 8.89 1.11 89% /usr/sap/trans
[ccheccd:/]#

COMMAND OK
[ccheccd:/]#chfs -a size=+10G /usr/sap/trans
Filesystem size changed to 62914560

BEFORE size doesn't change
[ccheccd:/]#df -g /usr/sap/trans
Filesystem GB blocks Used Free %Used Mounted on
/dev/fslv15 10.00 8.89 1.11 89% /usr/sap/trans
[ccheccd:/]#


[ccheccd:/]#lslv fslv15
LOGICAL VOLUME: fslv15 VOLUME GROUP: vgbin
LV IDENTIFIER: 0006a96a0000d4000000012666f6fe29.6 PERMISSION: read/write
VG STATE: active/complete LV STATE: opened/syncd
TYPE: jfs2 WRITE VERIFY: off
MAX LPs: 1024 PP SIZE: 128 megabyte(s)
COPIES: 1 SCHED POLICY: parallel
LPs: 240 PPs: 240
STALE PPs: 0 BB POLICY: relocatable
INTER-POLICY: minimum RELOCATABLE: yes
INTRA-POLICY: middle UPPER BOUND: 16
MOUNT POINT: /usr/sap/trans LABEL: /usr/sap/trans
MIRROR WRITE CONSISTENCY: on/ACTIVE
EACH LP COPY ON A SEPARATE PV ?: yes
Serialize IO ?: NO


[ccheccd:/]#
[ccheccd:/]#lsvg vgbin
VOLUME GROUP: vgbin VG IDENTIFIER: 0006a96a0000d4000000012666f6fe29
VG STATE: active PP SIZE: 128 megabyte(s)
VG PERMISSION: read/write TOTAL PPs: 2237 (286336 megabytes)
MAX LVs: 512 FREE PPs: 797 (102016 megabytes)
LVs: 7 USED PPs: 1440 (184320 megabytes)
OPEN LVs: 7 QUORUM: 2 (Enabled)
TOTAL PVs: 2 VG DESCRIPTORS: 3
STALE PVs: 0 STALE PPs: 0
ACTIVE PVs: 2 AUTO ON: yes
MAX PPs per VG: 130048
MAX PPs per PV: 4064 MAX PVs: 32
LTG size (Dynamic): 256 kilobyte(s) AUTO SYNC: no
HOT SPARE: no BB POLICY: relocatable
[ccheccd:/]#

aix said...

Hello,

Strange, I don't see any errors.

The output, what you sent: "Filesystem size changed to 62914560"
As I counted it should be Now 30GB, but it is still 10GB?

Are there any error messages somewhere?
Did you try to increase other fs?
I would try with smitty to increase this fs... or I would open an IBM call.

-Balazs

A J said...

Hi Balazs

You have a very informative site and appreciate your informative replies to queries. I have a question forwarded to me and to which i dont have a definite answer so sharing it on this. There are 2 parts to it.

1. Does the backup of a mirrored rootvg take twice the space on media than a regular rootvg.

2. How to restore the backup of mirrored rootvg on a single disk.

Thanks
A J

aix said...

Hi A J,

1. The size of the backup is based on the size of the mounted filesystems in rootvg. So, the answer is no.

2. I assume you would like to restore it by a NIM server. What you need to do:
- restore the image.data file from your mksysb
- edit the image.data file to look like your rootvg has 1 disk only and it is not mirrored
- transfer this image.data file to the NIM server and create a resource from this
- when you initiate the restore on the NIM server, choose this image.data resource to use during installation

The exact steps are described here: http://www-01.ibm.com/support/docview.wss?uid=isg3T1011782

Hope this helps,
Balazs

Sheik Abdul Kaleem said...

hi,

I am getting an error when creating a file system in HACMP cluster of two nodes.

i created lv using smity cpsoc fast path and when i was creating fs its giving error as

mount point is inuse on node 1

aix said...

Hi, did you check if the mentioned mount point is really in use or not?

Unknown said...

Hi What is the difference between JFS & JFS2

aix said...

Hi, in AIX 5L Differences Guide Redbook there is a whole section which will describe it in details.
(some improvements, file system size is bigger, you can shrink a filesystem ...)

Anonymous said...

I have similar situation where i have a file of 160 gb under a directory mounted on file system.

I have deleted the file but the space was not reclaimed to the file system.

root:localhost:/ # fuser -V -cfxd /usr/openv
/usr/openv:
inode=4917156101247467520 size=2 110828m
inode=4917156101247467520 size=2 180810m
inode=4917156101247467520 size=2 156444m


Unknown said...

Hi aix.. i love your blog.. wish you continue this forever! below are few questions from me..

1.How to remove or destroy rootvg??
2.I saw that compression is possible on JFS but not JFS2.. what is the reason??

Thanks,
Rajesh

aix said...

Hi, thanks.

1. Usually you shouldn't do that, but if you want to erase a disk, you can do that if you boot into maintenance mode (via network boot or DVD) and choose erase disks.

2. The real reason I don't know, but my assumption, IBM removed compression from JFS2 becasue it causes performance degradation, for example: "It can require a great deal of time to compress and decompress data so that the usability of a compressed file system might be limited for some user environments." The other reason I guess, that storage increased a lot and it is much cheaper now, so there is no real value of compressing a filesystem. (More info: http://pic.dhe.ibm.com/infocenter/aix/v6r1/index.jsp?topic=%2Fcom.ibm.aix.baseadmn%2Fdoc%2Fbaseadmndita%2Ffs_jfs2.htm)

Hope this helps,
Balazs

Unknown said...

Thanks Aix!

Rajesh

deven said...

Thanks for sharing information

Regards,
Devendra Koli

aix said...

welcome :-)

Anonymous said...

Hi Balazs

You have a very informative site.I have been bookmarked your Blogspot in my browser.It really helps me a lot.Thank you!!!

I have a Question for u.What is the procedure for Decommissioning AIX 5.2 and 5.3?Please tell me the step by step procedure.How to do disk scrubing?

Thanks in Advance!!!!!!!

aix said...

I can help you with disk scubbing only as decomissioning is dependedin on your environment.
Disk scrubbing can be done, if you boot into maintenance mode (via DVVD or network boot from NIM master). Then there will be a menu point: "Erase Disks"...

Unknown said...

Hi,

I want to increase the filesystem size to 2GB, SAN team has assigned LUN.In the environment we are using DUAL VIO with NPIV and the nodes are in Two Node Cluster.

My Question is if any new disk came to the server, Do I need to change new disk properties according to the old disk available in the VG before extending the VG, or not required. Means all the disks available in the VG should have same properties or not required.
Please suggest.

Thanks.

aix said...

Hi,
all disks properties should be same. If in the ODM, in the Predefined Object Classes, these properties are set, then when you configure a new disk, you don't have to set these properties, because they are automatically set. If these are missing on the ODM, you have to set it manually each time.

Anonymous said...

how to do house keeping for / and /home file systems

aix said...

I'm not aware of any generic rules.

Anonymous said...

Hi,
I am not an sysadmin, but i have one question difference between jfs2 and nfs file system
I am using sap in cluster env. which is more suitable jfs2 or nfs
Regards,

aix said...

Hi, I cannot give you a definite answer without an analysis of your environment...but with nfs you have an additional network layer above the filesystems, which is an extra risk and can cause performance issues as well. So, without any specifics I would choose jfs2...but some of your sysadmins should check your environment and decide.

Anonymous said...

Hi,

Is there any chance to convert jfs to jfs2 & jfs2 to jfs

regards,
sathish

aix said...

Hi, since 6.1 TL4 you can do it with alt_disk_copy:
alt_disk_copy -T -d <--it will convert jfs to jfs2 on the new target disk (from 6.1 TL4 only)

If this is not an option, you can do it with an mksysb restore, but prior that run 'mkszfile', which will create image.data file. If you edit this file (change jfs to jfs2) and then use this file with mksysb restore you can convert rootvg to jfs or jfs2.

Anonymous said...

HI,

I want do Filesystem cleanup for /,/usr ,/opt
Plz give me the solutions ASAP.

Anonymous said...

HI,
how to do the VIO lun mapping from VIO server to VIO clients.the VIO Clients are Cluster Server.

Anonymous said...

Hi,
I have a problem in /var. For /var we allocated 2gb of space and the du command shows 1GB is used and 460MB of free space. We have no idea about 5ooMB. Can somebody help

aix said...

Hi, there could be deleted, but still opene files. You can check it with: fuser -V -d /filesystem1

Sahasra said...

Dear sir, Which file system are remain not changed during migration operation.

aix said...

Hi, please check here: http://aix4admins.blogspot.hu/2013/03/aix-migration-upgrade-with-nimadm-aix.html

Anonymous said...

Hi , my system is using 99.2% of memory what needs to be done how do i figure whats the problem which is causing memory to use 99%.

if it is file system cache how do i check it and resolve it, please help.

aix said...

Hi, some description about performance issues in memory can be found here: http://aix4admins.blogspot.hu/2011/09/memory-leak-caused-by-program-that.html.
About filesystem cache, you can read here: http://aix4admins.blogspot.hu/2011/09/vmm-concepts-virtual-memory-segments.html

Unknown said...

Only /tmp and /home can be unmounted(OS filesystems) and fsck can be run on it but not on others . Other FS (/var , / , /usr , etc) should be unmounted in MM mode .

Anonymous said...

This is not true for jfs2 which is the default FS.
on jfs2 the first superblock is located at 0x8000 and the second is located at 0xF000

So the commands should be
# od -x -N 64 /dev/hd1 +0x8000
# od -x -N 64 /dev/hd1 +0xF000

aix said...

Thanks a lot... I really appreciate this info!

Unknown said...

Hi Admins,

We have a probelm with Cluster filesystems, we have two storages DC-A and DC-B, if any external LUN is needed to the cluster node, storage team will assign LUNs from the two storages.

The problem is storage claimed that they have mistakenly assigned LUNs from same storage, but after assigning LUN with out checking we have increased VG and also increased the filesystem, now How can we check that filesystem resides on which disks.

Please help here its a very critical server in the enviroment.
How to check Filesystem resides which disks..

Thanks in advance.

Anonymous said...

lspv -l hdisk# tells which f/s is on disk. Also gives lv name and size in lp and pp's.

Prathap reddy said...

my root file system got 94 %, can u please help me how to increase ?

Anonymous said...

hii sir wht ever you explained tht is good but explain me in a sigle line what is file system because iam new to aix

aix said...

hi, it is the same thing as a directory (you can create files and directories in it), but you can set how much space should it use

Anonymous said...

Hi,
When ever we reboot the server ..by default file systems are mounted in this manner.

1) /U01_ora
2) /U03_ora
3) /U02_ora

Now DBA wants to mount in this manner ..

1) /U01_ora
2) /U02_ora
3) /U03_ora


In /etc/filesystmes I have changed manually but it didn't work...I took my seniors helps & suggeted to recreate the file systems but its not possible at the moment,

so is there any way, to change the file system order.

Thanks in advance :-)

aix said...

Hi,
probably this link can help you: https://www.ibm.com/developerworks/community/wikis/home?lang=en#!/wiki/Power%20Systems/page/How%20to%20change%20order%20of%20fs%20mounts%20on%20AIX%20V5.3

Manoj Suyal said...

Hi Balazs,

Dose I node contains information of file creation, I don't think it contains... Please clarify ...

below is the inode statics for a directory .

Inode 4 on device 10/8 Directory
Protection: rwxr-xr-x
Owner: 204(noci) Group: 1(staff)
Link count: 3 Length 256 bytes

Last updated: Mon Nov 18 15:24:42 CST 2013
Last modified: Mon Nov 18 15:24:42 CST 2013
Last accessed: Mon Nov 18 13:20:12 CST 2013



Regards
Manoj Suyal

aix said...

Hi, no it is not there.
- Balazs

Ahmed Amer said...

Would you please clarify how "dumpfs /usr shows the superblock, i-node map, and disk map information"?

derikogay said...

You can use Long Path Tool for such issues, it works good.

Anonymous said...

Hi !!
I have received following error while creating new directory :
Error : There are too many links to a file.

Current directory count in that location is : 32766 directories

Could u suggest on this ..???

Anonymous said...

/usr/include/sys/limits.h file doesn't show any hard coded entry like 32767 ..!!
But just need confirmation whether this is Limitation of AIX ....??

oyao aixblogspot.com said...

how to kill one perticular user in a filesystem,if my filesystem is used by showmany users

oyao aixblogspot.com said...

how to know FS belongs to which VG

oyao aixblogspot.com said...

how to remove label name for LV

oyao aixblogspot.com said...

give me reply whether it is possible or not

oyao aixblogspot.com said...

dumpfs /fsname to see superblock information

Abdul said...

Hi oyao,
you can find by using lsvgfs -- chk the link
http://publib.boulder.ibm.com/infocenter/aix/v6r1/index.jsp?topic=%2Fcom.ibm.aix.cmds%2Fdoc%2Faixcmds3%2Flsvgfs.htm

oyao aixblogspot.com said...

thanx bos

oyao aixblogspot.com said...

what is difference between hard mount and soft mount

oyao aixblogspot.com said...

how to kill one perticular user in a filesystem,if my filesystem is used by showmany users

Unknown said...

HI Admin,

Could you please give me the steps to change the block size of a jfs2 filesystem. it's having 4096 currently, i need to change it to 512 for enabling CIO for that filesystem( This is a request from Oracle DB admins)

aix said...

Hi,

man chfs writes this:
"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. "

So I think new filesystem has to be created with requested block size and copy the content...

oyao aixblogspot.com said...

please provide me information about freeware programs

Pengertian Evaluasi said...

This article can help .... I can read them with new knowledge ... thank you so much for what was given to me

Arti Mimpi said...

i , my system is using 99.2% of memory what needs to be done how do i figure whats the problem which is causing memory to use 99%.

if it is file system cache how do i check it and resolve it, please help.

B@lu said...

How to move file system from one server to another server???

Anonymous said...

Hi,
regarding the system Created file systems in AIX , if i am not wrong the number of file systems created are different for different versions..
could you please comment on this...

aix said...

Hi, yes there are some small differences, for example in 7.1 /ahafs could be there as well.

Unknown said...

Thanks for this blog.

fuser -cux /var
fuser -dV /tmp

I tell you this saved my behind a lot of times. :D keep it up!

aix said...

nice to hear :)

Filme 2015 said...

Thank you sow much, this is good information, i just been assigned to do upskilling for AIX team, sow this info it is gold.

Anonymous said...

How do I expand /tmp (only 300mb) or move it to /opt/tmp where I have lots of free space under /opt?

Anonymous said...

1.check df -gt and get lvname
2.use lslv lvname
thats all you can find the particular vg dear

Anonymous said...

hi balaz in jfs file system hierarchy is linear which can be compressed in order comparative to jfs2 which is not linear and where compression creates disturbances

Neo said...

Hi,
Could you help me how do I auto mount namefs, I am using GPFS and want GPFS to be mounted again using namefs.
But namefs mount fails as GPFS takes time to mount and /etc/filesystem is already read where namefs entry fails.

aix said...

Hi, probably you could place a small script in inittab (or an rc script) which corrects after reboot this problem (umount/remount...)

Unknown said...

Hi,
1) how data consistency is maintained in jfs file systems using logs
2) first when we make changes in file system that is directly saved on file system or log devices or else after metadata is updated changes are going to be updated in file system

Anonymous said...

fuser -kuxc /filesystemname

Unknown said...
This comment has been removed by the author.
Anonymous said...

How much space is required to create inline log device in file system?

Tafsir Mimpi said...

Thank you sow much, this is good information, i just been assigned to do upskilling for AIX team, sow this info it is gold.....

Unknown said...

great info about fs thanks, let me know inlinelog and outlinelog their usage

Unknown said...

I have been reading different blogs but this one is the best i ever found

Hemant Singh

Anonymous said...

very good information, even for an very old aix guy (starting with aix 3.2.5)

Agen Susu Kuda Liar Medan said...

I want to increase the filesystem size to 2GB, SAN team has assigned LUN.In the environment we are using DUAL VIO with NPIV and the nodes are in Two Node Cluster.

My Question is if any new disk came to the server, Do I need to change new disk properties according to the old disk available in the VG before extending the VG, or not required. Means all the disks available in the VG should have same properties or not required.
Please suggest...

Manoel Bezerra said...

Thanks for great documentation !!! These information's help us to understand better how to work AIX filesystems

Anonymous said...

How to unmount a filesystem permanently in AIX

Anonymous said...

Hi, /etc/filesystems contains the mount options for a filesystem, with smitty, chfs or vi you can manage it.