100% found this document useful (1 vote)
140 views7 pages

Practical Guide To AIX Filesystems

This document provides an overview of commands and operations for managing file systems in AIX, including creating, mounting, listing, resizing, modifying, removing file systems as well as commands for checking usage, defragmenting, freezing, splitting mirrored copies and repairing file systems.

Uploaded by

Rajeev Ghosh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
140 views7 pages

Practical Guide To AIX Filesystems

This document provides an overview of commands and operations for managing file systems in AIX, including creating, mounting, listing, resizing, modifying, removing file systems as well as commands for checking usage, defragmenting, freezing, splitting mirrored copies and repairing file systems.

Uploaded by

Rajeev Ghosh
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

AIX FileSystems:

Contents
1.

Creation of Filesystem

2.

Mount/Unmount Filesystem

3.

List Filesystems

4.

Display Filesystem usage

5.

Resize Filesystems

6.

Modify/Change Filesystem

7.

Remove Filesystems

8.

Freeze File System

9.

Split mirrored copy from FS

10.

defrag filesystem

11.

fuser & file systems

12.

Filesystem Checking & Repairing

13.

Miscellaneous Filesystem Commands

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

To unmount filesystem use "umount"

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

4) Display Filesystem usage:


To display information about all mounted file systems, enter: df
Command Examples
1) If your system has the /, /usr, /site, and /usr/venus file systems mounted, the
output from the df command resembles the following:
df
Filesystem 512-blocks Free
/dev/hd0
19368
9976
/dev/hd1
24212
4808
/dev/hd2
9744
9352
/dev/hd3
3868
3856

%Used
48%
80%
4%
0%

Iused
4714
5031
1900
986

%Iused
5%
19%
4%
0%

Mounted on
/
/usr
/site
/usr/venus

2) To display information about /test file system in 1024-byte blocks, enter:


df -k /test
Filesystem
/dev/lv11

1024 blocks
16384

Free
15824

%Used
4%

Iused
18

%Iused
1%

Mounted on
/tmp/ravi1

This displays the file system statistics in 1024-byte disk blocks.


3) To display information about /test file system in MB blocks, enter:
df -m /test
Filesystem
/dev/lv11

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:

chfs -a size=<new size> <fs>


Command Examples
chfs -a size=1G /var (specific size, can be used to increase and decrease)
chfs -a size=+1G /var (increase by 1GB)
chfs -a size=-1GB /var (reduce by 1GB)
Note1:This will automatically increase or decrease the underlying logical volume as
well.
Note2:You can't reduce jfs filesystem

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.

8) Freeze File System:


If you don't want your file system to perform any writes for a period of time, maybe due to an admin task
like a split copy or a backup, you can freeze the file system. After the admin tasks are completed, you can
thaw the file system.
chfsafreeze=<timeinseconds><fs>
chfsafreeze=off<fs>

9) Split mirrored copy of filesystem:

chfsasplitcopy=<splitcopymountpoint>acopy=2<fs>
chfsasplitcopy=/backupacopy=2/testfs
Thiswillmountthe2ndcopyofmirroredfilesystemtestfsto/backupinreadonly
modeforbackuppurpose

10) defrag fielsystem:


The defragfs command can be used to improve or report the status of contiguous space within a file
system.
Command Examples
defragfs /test ==>To defragment the file system /test
defragfs -q /test ==>Display the current defrag status of the file system
For example, to defragment the file system /home, use the following command:
defragfs /home
Here is an example output:
# defragfs /home
Defragmenting device /dev/hd1. Please wait.
Total allocation groups : 32
Allocation groups skipped - entirely free : 26
Allocation groups defragmented : 6
defragfs completed successfully.
Total allocation groups : 32
Allocation groups skipped - entirely free : 26
Allocation groups that are candidates for defragmenting : 6
Average number of free runs in candidate allocation groups : 1
#

11) fuser & filesystem:


Command Examples
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

12) Checking and Repairing:


Command Examples

fsck [-y|-n] <fs> (check a filesystem)


fsck -p lt;fs> (restores primary superblock from backup copy if corrupt)
fsck -y n /dev/lv00 ==>To check the filesystem associated to /dev/lv00 assuming
response "yes"

13) Miscellaneous Filesystem Commands:


Command Examples
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

You might also like