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.


Showing posts with label filesystem. Show all posts
Showing posts with label filesystem. Show all posts

Filesystem commands in AIX

lsfs Lists all filesystems in the /etc/filesystems entry


lsfs -a To list all filesystems (default)


lsfs -q List all filesystems with detailed info (shows size of FS and LV in it. so we can check whether size of LV=size os FS)


lsfs -l Specify the output in list format


lsfs -c Specify the output in column format


lsfs -v jfs Lists all jfs filesystems


chfs -a size=24576 /test Change size of FS /test to 24576(blocks)x 512 bytes  (12 MB)


chfs -a size=+24576 /test Add 24576(blocks)x512 byte  to FS /test


chfs -a size=+64M /test Add 64 MB to /test


chfs -a size=10G /test fix size of the FS /test to 10 GB


chfs -m /test /new Change the mount point from /test to /new


chfs -A /test To auto mount the filesystem test


chfs -d account /test Remove account attribute of /test.(from /etc/filesystems file)


chfs -a splitcopy=/backup -a copy=2 /oracle This will mount the 2nd copy of mirrored filesystem oracle to /backup in read-only mode for backup purpose


crfs -v jfs2 -g newvg -a size=100M -m /test Creates FS /test of type jfs in VG newvg of size 100 MB with default LV.


crfs -v jfs -d /dev/lv00 -m /test Create FS /test of type jfs on device /dev/lv00


rmfs /test Deletes FS /test and associated LV


rmfs -r /test Deletes FS /test its mount point and associated LV


defragfs /test To defragment the file system /test


defragfs -q /test Display the current defrag status of the file system


fsck -y n /dev/lv00 To check the filesystem associated to /dev/lv00 assuming response "yes"


fsck -p /dev/lv00 To restore superblock from backup superblock




Unix filesystems explained

A filesystem is a logical collection of files on a partition or disk. A partition is a container for information and can span an entire hard drive if desired.
Everything in Unix is considered to be a file, including physical devices such as DVD-ROMs, USB devices, floppy drives, and so forth.

Unix uses a hierarchical file system structure, much like an upside-down tree, with root (/) at the base of the file system and all other directories spreading from there.
A UNIX filesystem is a collection of files and directories that has the following properties:
  • It has a root directory (/) that contains other files and directories.
  • Each file or directory is uniquely identified by its name, the directory in which it resides, and a unique identifier, typically called an inode.
  • By convention, the root directory has an inode number of 2 and the lost+found directory has an inode number of 3. Inode numbers 0 and 1 are not used. File inode numbers can be seen by specifying the -i option to ls command.
  • It is self contained. There are no dependencies between one filesystem and any other.
The directories have specific purposes and generally hold the same types of information for easily locating files. Following are the directories that exist on the major versions of Unix:

DirectoryDescription
/This is the root directory which should contain only the directories needed at the top level of the file structure.
/binThis is where the executable files are located. They are available to all user.
/devThese are device drivers.
/etcSupervisor directory commands, configuration files, disk configuration files, valid user lists, groups, ethernet, hosts, where to send critical messages.
/libContains shared library files and sometimes other kernel-related files.
/bootContains files for booting the system.
/homeContains the home directory for users and other accounts.
/mntUsed to mount other temporary file systems, such as cdrom and floppy for the CD-ROM drive and floppy diskette drive, respectively
/procContains all processes marked as a file by process number or other information that is dynamic to the system.
/tmpHolds temporary files used between system boots
/usrUsed for miscellaneous purposes, or can be used by many users. Includes administrative commands, shared files, library files, and others
/varTypically contains variable-length files such as log and print files and any other type of file that may contain a variable amount of data
/sbinContains binary (executable) files, usually for system administration. For example fdisk and ifconfig utlities.
/kernelContains kernel files