Practical Guide To AIX Filesystems
Practical Guide To AIX Filesystems
Contents
1.
Creation of Filesystem
2.
Mount/Unmount Filesystem
3.
List Filesystems
4.
5.
Resize Filesystems
6.
Modify/Change Filesystem
7.
Remove Filesystems
8.
9.
10.
defrag filesystem
11.
12.
13.
1) Creation of Filesystem:
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.
Commands
##With an existing logical volume:
# crfs -v jfs2 -d <lv> -m <mountpoint> -A yes
-v vfs type (Specifies the virtual file system type)
-d Specifies the device name of a device or logical volume on which to make the file
system.
-m Specifies the mount point, which is the directory where the file system will be
made available
-A Specifies whether the file system is mounted at each system restart:
yes:File system is automatically mounted at system restart.
no:File system is not mounted at system restart (default value).
Note: start of changeThe crfs command accesses the first letter for the auto mount -A
option.end of change
## Create logical volume, filesystem, mountpoint, add entry to /etc/filesystems at the
specified size
# crfs -v jfs2 -g <vg> -m <mountpoint> -a size=<size in 512k blocks|M|G) -A yes
Note: there are two types of filesystems jfs and jfs2, jfs2 allows you to decrease the
filesystem size , you cannot reduce a jfs filesystem.
2) mount/unmount Filesystems:
mount is the command used to mount filesystems
mount[<fs>|<lv>]
mounta>>Mountallfilesystemsmentionedin/etc/filesystems.
mountall
umount<fs>
Note:Youcan'twriteintoorreadanycontentfromfilesystemwhenitsinunmounted
state
funmountfilesystemforcibly
umountf<fs>
forv7.1onwardsyoucanusenamefor"unmount"commandaswell.
umountall:Unmountsgroupsofdismountabledevicesorfilesystems(applicableto
v7.1)
3) List Filesystems:
To list filesysem use "lsfs" or "mount"
lsfsListsallfilesystemsinthe/etc/filesystemsentry
lsfsaTolistallfilesystems(default)
lsfsq<fs>(detailed)
lsfsqListallfilesystemswithdetailedinfo(showssizeofFSandLVinit.sowe
cancheckwhethersizeofLV=sizeosFS)
lsfslSpecifytheoutputinlistformat
lsfscSpecifytheoutputincolumnformat
lsfsvjfsListsalljfsfilesystems
mount(tolistallmountedfilesystems)
mount<fs>(tolistthemountedfilesysem)
Note:usethe'q'toseeifthelogicalvolumesizeisbiggerthanthefilesystem
size
%Used
48%
80%
4%
0%
Iused
4714
5031
1900
986
%Iused
5%
19%
4%
0%
Mounted on
/
/usr
/site
/usr/venus
1024 blocks
16384
Free
15824
%Used
4%
Iused
18
%Iused
1%
Mounted on
/tmp/ravi1
MB blocks
16.00
Free
15.46
%Used
4%
Iused
18
%Iused
1%
Mounted on
/tmp/ravi1
This displays file system statistics in MB disk blocks rounded off to nearest 2nd
decimal digit.
4) To display information about the /test file system in GB blocks, enter:
df -g /test
Filesystem
/dev/lv11
GB blocks
0.02
Free
0.02
%Used
0%
Iused
18
%Iused
1%
Mounted on
/tmp/ravi1
This displays file system statistics in GB disk blocks rounded off to nearest 2nd
decimal digit.
5) Resize Filesystems:
6) Modify/Change Filesystems:
Command Examples
## Change the mountpoint
chfs -m <new mountpoint>
chfs -m /test /new ==>Change the mount point from /test to /new
## Do not mount after a restart
chfs -A no <fs>
## Mount read-only
chfs -p ro <fs>
## Remvoe attribute of a filesystem
Remove account attribute of /test.(from /etc/filesystems file)
chfs -d account /test
chfs -a options='rw' /shadow ==> shows with lsfs rw (I think rw is the deafault
anyway)
7) Remove Filesystems:
Command Examples
rmfs <fs>
rmfs -r /test ==>Deletes FS /test its mount point and associated LV
Note1: You need to unmount the filesyem before removing.
Note2: if all filesystems have been removed from a logical volume then the logical
volume is removed as well.
chfsasplitcopy=<splitcopymountpoint>acopy=2<fs>
chfsasplitcopy=/backupacopy=2/testfs
Thiswillmountthe2ndcopyofmirroredfilesystemtestfsto/backupinreadonly
modeforbackuppurpose