9/22/13

AIX File Commands Tips Support

What We Do Custom Development For the Web Maintenance Testimonials Development Concepts Usability Metatags Anti-Virus Anti-Spam Business Accounting Backup EDGE Digital Signage Linux Scalix Shop OnLine Document Management Applications Business Info Hardware Info Microsoft Info Linux 101 AIX 101 OnLine Help Help Desk Blog Backup EDGE Eudora mySQL PowerTerm uniBasic Business Pro & Yes I Can Analyze Your Needs Software Ownership Password Creation Effective Presentations Buses Cables Chips DVD Memory Monitors Networks Power Protection RAID SCSI Versions & LIcenses About Office Windows XP Access Excel Word Contact Us What's New Horizon Newsletter Our Customers Employment

Set-up & Status General Commands Shell Commands Other Tips File Info Networking Printing Backup

File Commands
Understanding the AIX File System | Maximums | Path Definitions/Usage File System crfs - create new mkfs - create chlv - expand beyond max LV's chfs - change attributes fsck - check or fix rmfs - remove mount - mount umount - unmount sync - flushes system buffers to disk Disk Status df - display status of mounted file systems du - display disk usage istat - display dates of access for a file ls - display contents of a directory fuser - display users using a file system

More...
File Commands DOS Files

Directories & Files ln - link files or directories unlink - unlink a file or directory mv - rename files or directories mvdir - rename directories dircmp - compare files in different directories cat - display contents of text or ascii file cp - copy files or directories del - delete file rm - remove files or directories

Understanding the AIX File System
The AIX file system contains 3 major elements: Physical Volumes (PV) Volume Groups (VG) Logical Volumes (LV) IBM likes to use ab b reviations, so get used to calling Physical Volumes PV's, etc. Definition What is it Examples

Physical A Physical Volume is an actual physical device, i.e. disk drive. A system with 2 drives, could contain Volumes Each disk drive contains a Physical Volume. Physical Volume's Physical Volume's hdisk0 and hdisk1. are broken into Physical Partitions (PP's) where each Physical Partition is 4MB in size.

Volume Groups
www.ahinc.com/aix/file.htm

Volume Group's are a set of one or more Physical Volume's. Each Volume Group can contain one or more Logical Volumes

Physical Volume hdisk0 could contain Volume Group rootvg and Physical Volume hdisk1 could contain

1/8

Maximums length of a filename : 255 characters number of open files per process : 2. 1024 inodes are allocated to that file system. The following commands only display information.htm 2/8 .e.000 www. Where the mounting points for hd1 = '/' (root). State and Physical Partition information <volumegroup> lsvg -l Displays Logical Volume name. Physical Partitions. free and used Physical Partitions <volumegroup> lsvg -p Displays Physical Volume. <volumegroup> Logical Volume State and Mounting Point Logical Volume Information Examples What it does lslv Displays Volume Group. hd2. then the value for this field is zero lspv -l Displays what Logical Volumes reside on the named Physical Volume along with Logical <physicalvolume> Partition's Physical Partition's and Mounting Point.000 number of open files system-wide : 200. When a file system is extended by 1 Physical Partition (4 MB). Logical Logical Volume's are used to define groups of files. a 4K block will be allocated from the free list to accommodate that request. hd3 = /tmp Here's a tab le to help make this clearer. free and used Physical Partitions. i. Physical Volumes. I hope.ahinc. Region. Here are some commands that smit uses that you can use at the command line to provide the necessary information.9/22/13 AIX File Commands Tips Support Physical Volume hdisk1 could contain Volume Group datavg. lspv -p Displays distribution of Physical Partitions for each Logical Volume that reside on the named <physicalvolume> Physical Volume along with State.. free and used Physical Partitions and other information. File Volumes Systems. <physicalvolume> lsvg -n Displays total. Each Logical Volume contains Logical Partitions (LP's) Volume Group rootvg could contain Logical Volume's hd1. hd2 = /usr. <logicalvolume> lslv -l Displays Physical Volume.com/aix/file. If the Physical Volume <physicalvolume> has no mirrored Logical Partitions. Stale partitions refers to mirroring. <physicalvolume> Volume Group Information Examples lsvg Displays all Volume Groups What it does lsvg Displays all Volume Groups. Distribution info <logicalvolume> top of page Maximums The smallest file extension is 4Kb. total.000 number of record locks per process: 200.000 number of record locks system-wide: 200. Type. Type and Mounting Point. If a user creates or extends a file anywhere from 0-4096 bytes. Logical Partitions. Physical Volume drive 1 = hdisk0 drive 2 = hdisk1 Volume Group rootvg datavg Logical Volume hd1 mounted as / hd2 mounted as /var hd3 mounted as /tmp You can use smit to display or configure your file systems. Copies.. total. Mirror State. lspv -s Displays Physical Volume. hd3. Mount Point and more. Physical Volume Information Examples lspv What it does Displays a list of all Physical Volume's with the drive name and associated Volume Group's lspv Displays a specific Physical Volume.

com/aix/file. Displays the control codes generated to your terminal to clear the screen.192 bytes per message queue : 65.768 number of pipes per process : 2.htm 3/8 . Examples cat -v textfile tput clear | cat -v top of page What it does The -v option will display non-printing characters. Needs to be at least 12 MB common executables that are shared across the same architecture administrative commands and files utilities (overflow for /bin) archive libraries. including terminfo data about optional program products (OPP) system logging and accounting files preserved data from interrupted edit sessions spool iles for printing temporary files What's in it cat Concatenates or displays one or more files. text processing macros Email files utilities used in system administration.ahinc.767 adjust on exit : 16.192 number of segments system-wide : 16 MB number of shared memory segments : 4. shareable text files manual pages spelling dictionary and its indexes InfoExplorer database files architecture-independent data files.096 number of segments per process : 10 bytes per segment 256 MB top of page PathDefinitions Directory /bin /sbin /dev /etc /home /lib /tmp /usr /usr/adm /usr/bin /usr/lib /usr/spool/mail /usr/sbin /usr/share /usr/share/man /usr/share/dict /usr/share/info /usr/share/lib /usr/share/lpp /var/adm /var/preserve /var/spool /var/tmp top of page utilities files needed to boot the machine and mount the /usr file system special files (I/O devices) miscellaneous administrative utilities user directories and files libraries temporary files.024 semaphore value : 32. chlv www. including smit architecture-independent.000 bytes per pipe : 32.000 number of semaphore IDs : 4.9/22/13 AIX File Commands Tips Support number of record locks system-wide: 200.536 messages per message queue : 8.096 number of semaphores per ID : 100 K number of operations per semop call : 1.096 bytes per message : 8.384 number of message queue IDs : 4.

returns disk info in 1024 byte blocks. when you extend a file system. top of page df www. Block size for this command is 512 byte blocks. del /u/roger/* If 'y' is entered for yes.htm 4/8 . where the command df. -i If a filename already exists in the destination directory.c in the directory /u/roger to the /tmp directory Copies all the files and subdirectories from the current directory to the directory named /tmp/temp. all files will be removed. If the file system size is to be extended to 12MB in size. where the command df. the system will prompt you to overwrite this file with the one being copied from the source directory. then 12 * 2000 = 24000. size=100000 The above command creates a 50MB journeled file system named /mydata with read/write permissions. chlv -x 256 <lv_name> (Where logical volume name is entered without the /dev) top of page chfs Changes attributes of a file system. crfs -v jfs -g rootvg -m /mydata -p rw -a size=100000 -v file systems type. The simplest method of extending a file system is to Take the target size of the file system in MB's and multiple by 2000.) top of page cp Copies one or more files. returns disk info in 1024 byte blocks. /tmp/temp What it does Copies the file test. Block size for this command is 512 byte blocks.c /tmp cp -ipr . you extend the logical volume that resides under it. and modification attributes of the file beingcopied to it's new destination. Most systems have a default Physical Partition size of 4MB (review output of lsvg rootvg command) and therefore when the file system increases in size. chfs -a size=24000 /usr (Increase the /usr file system to 12 MBs. /mydata -p access permissions. cp -r /usr/data /home/data top of page Copies all files and directories from /usr to /home crfs Adds a new file system.9/22/13 chlv AIX File Commands Tips Support Used to expand beyond the maximum Logical Volume limit.ahinc. -r Copies all files and subdirectories. it will increase by a multiple of 4MBs.com/aix/file. jfs=journalized file system -g volume group name where filesystem will reside. created under the volume group. Examples cp /u/roger/test. rootvg -m mount point for new filesystem. Remember. -p Preserves file permissions. rw=read/write -a file system attribute. group. owner. rootvg top of page del Delete files where system will prompt you to delete the file(s).

Bad blocks are only relocated on a write operation. its safe to mount the file system in question.ahinc. df -v top of page dircmp Compares two directories and the contents of all files found in both directories. dircmp /tmp/COMPANY /u/COMPANY | grep different Displays only those files that are found in both directories but have differences top of page du Display a summary of disk usage for directories (output in 512 byte blocks). Also updates the JFS log ./dev hd8 Examples 1) fsck -fp /dev/hd1 2) mount /u What it does To make sure the /dev/hd1 (/u file system) is not damaged. -f (fast check) Won't check file systems cleanly unmounted.htm 5/8 . If a file system is cleanly unmounted via the umount command. Examples du /tmp What it does Displays total number of 512 byte blocks used by /tmp filesystem and all directories underneath it Summarizes disk allocation for /tmp filesystem (including ALL files and subdirectories) in 512 byte blocks Summarizes disk allocation for a particular file du -s /tmp du -a /u/roger/doc. Fsck performs read operations and therefore is useful for soft errors . Use this command in case the superblock is corrupted.com/aix/file. -p Will fix minor problems without prompting user whether the problem detected should be fixed or not. the file is linked into the subdirectory named lost+found directory.errors top of page fuser www.txt top of page fsck Checks and interactively repairs inconsistent file systems. Fsck can only be run on a file system that is unmounted (fsck will not make changes to a mounted file-system). The -y option gives fsck permission to automatically repair file systems when necessary. followed by mounting that file system for user access. Without an argument. it's unlikely to encounter any problems when the fsck command is run on the file system again. If there's a discrepancy between the number of directory references to a file and the link count in the file and the file contains data (UNCLAIMED BLOCKS).not hard errors. File systems are normally checked everytime the system is rebooted. fsck -y /dev/hd1 dd count=1 bs=4k skip=31 seek=1 if=/dev/hd4 of=/dev/hd4 fsck /dev/hd4 2>&1 | tee /tmp/fsck. du lists the current directory. If fsck passes without errors. This will restore the BACKUP COPY of the superblock to the CURRENT copy.9/22/13 AIX File Commands Tips Support Displays summary of disk usage for mounted file systems. fsck does not flag a bad block on your Physical Volume.

Use unlink to remove a link./junk 1) cd /u/COMPANY 2) ln -s /u/roger/* top of page What it does Creates a link from the original file named test1 to a new file named test2 Links subdirectory junk under the current directory to directory /tmp. means no Long listing ." Examples ls -ld . ls -aeltFR ls -l ls -lc ls -lu top of page mkfs Makes a file system. What it does Lists all entries including hidden files that start with a ". Displays the last time the data in a file has been accessed. Symbolic links can link either a file or directory across a file system. ls Displays the contents of a directory Options -a -d -e -l -t -F -R -b List directories only Indicates if a file has extended security information ..9/22/13 AIX File Commands Tips Support Identifies processes using a file or file system fuser -u /dev/hd3 Sample output: /dev/hd3: 2964(root) 6615c(root) 8465(casado) 11290(bonner) top of page istat Displays dates of access for a file istat myfile (Displays attributes about the file named myfile) top of page ln Gives a file more than one name (alias). Examples ln test1 test2 ln -s /tmp . An * (asterisk) after each filename if the file can be executed.ahinc.more detail Sorts by time of last modification (latest listed first) Puts a / (slash) after each filename if the file is a directory. The symbolic link (-s) allows a user to point to a file and/or a directory.11th character: + means yes. -print|backup -ivqf/dev/rmt0 cd / www. Displays the last time the attributes of a file have been changed. ls -ld . All the files under /u/roger will now have links to /u/COMPANY. Example: cd /u find . An @ for a symbolic link Lists all subdirectories recursively Lists garbage or hidden characters in octal What it does List directory attributes for CURRENT directory List directory attributes for PARENT directory (one level up) Lists all files and subdirectories under current directory Displays the last time the data in a file has been changed.htm 6/8 .com/aix/file.

etc) 7/8 rm `find . thousands of additions. that resides on node cad mv Renames one or more files mv report1 report2 (Renames the file named report1 to eport2) top of page mvdir Renames a directory. creation. exec. By increasing the buffer size. top of page mount Displays file system attributes or makes file system available for use. less I/O operations will be needed. This results in multiple disk accesses that formally may have taken only one. Since NFS verifies each packet that gets written to the server before it requests the next packet from the client. Over the course of time. thereby increasing performance. writes will take longer to execute than a read. and extensions of files and/or records will create a file system that looks like Swiss cheese. Mount a remote file system (type=nfs) on the mount point named /transfer. rsize=8192 mount -n cad -v nfs /transfer top of page What it does Displays attributes about all file systems that are on-line Mounts the file system named /u/data for accessibility. then you can mount the space from the /usr filesystem onto /tmp Set the read/write buffers to 8K to increase performance for NFS file systems. -i system prompt if you wish to remove. Examples mount mount /u/data mount /usr/tmp /tmp mount -o wsize8192.htm . If you don't have enough room in the /tmp filesystem for a specific utility to work properly. Removes the file named S&38912. Removes all files from current directory including hidden files (file names such as {}. -print` www. and you do have enough room in the /usr filesystem..9/22/13 AIX File Commands Tips Support cd / umount /u mkfs dev/hd1 fsck -p /dev/hd1 mount /u cd /u restore -xvf/dev/rmt0 The above procedure is one way of making a file system contiguous again. Since this file has a special character ('&') that the shell treats differently than most. deletions. the system appears sluggish. As a result. . Will recursively remove all files and any subdirectories found under /u/roger/docs.ahinc.com/aix/file. mv /u/roger /u/scott (Renames the directory roger to scott) top of page rm Removes a file or directory Examples rm -i * rm -r /u/roger/docs rm -i S###BOT_TEXT###amp;e38912 What it does Will prompt the user to remove each of the files in the current directory beforeremoving them EXCEPT for hidden files.

. The 'umount' will fail if one or more users are either currently on that file system or somebody has a file opened on that file system.. Inc. the following error message would be generated: usage: rm [-fir] file . top of page sync Flushes system buffers to disk. The file system must be unmounted prior to the 'rmfs' command being executed else you will get a 'BUSY' error message./).ahinc. umount /u Unmounts a file system so that files found under that file system will not be able to be accessed. If this was not done.. top of page unlink Used to remove a link or symbolic link. There's a sync daemon (/etc/syncd) that flushes buffers automatically every 60 seconds (default).htm 8/8 . . The '/u' entry in /etc/filesystems will also be removed.com/aix/file. Removes all files named mbox found under any of the subdirectories located in /home. unlink MyDoc (Removes the link MyDoc from the system) top of page Services | Products | Support | About Us | Privacy Policy | Legal Stuff Send Email © Advanced Horizons. you are able to hide the '-' character that starts the filename. etc) rm . All Rights Reserved www.9/22/13 AIX File Commands Tips Support exec. top of page umount Unmounts a file system from system usage./-junkfile By preceding the filename (-junkfile) with the pathname (. rm /home/*/mbox top of page rmfs Removes a file system rmfs /u Removes a file system and the logical volume under it.