AIX File System Commands


Physical Volumes (PV’s)
———————–

lspv                        Lists all physical volumes (hard disks)
lspv (pv)                   Lists the physical volume details
lspv -l (pv)                Lists the logical volumes on the physical volume
lspv -p (pv)                Lists the physical partition usage for that PV

chdev -l (pv) -a pv=yes     Makes a new hdisk a pysical volume.

chpv -v r (pv)              Removes a disk from the system.
chpv -v a (pv)              Adds the removed disk back into the system.
chpv -a y (pv)              Changes pv allocatable state to YES
chpv -a n (pv)              Changes pv allocatable state to NO

migratepv (old pv) (new pv)     Moves all LV’s from one PV to another PV, both
PV’s must be in the same volume group.

Volume Groups (VG’s)
——————–

lsvg              Lists all volume groups
lsvg (vg)         Lists the volume group details
lsvg -l (vg)      Lists all logical volumes in the volume group
lsvg -p (vg)      Lists all physical volumes in the volume group
lsvg -o           Lists all varied on volume groups

varyonvg (vg)           Vary On a volume group
varyonvg -f (vg)        Forces the varyon process
varyonvg -s (vg)        Vary on a VG in maintenance mode. LV commands can be
used on VG, but LV,s cannot be opened for I/O.
varyoffvg (vg)          Vary Off a volume group

synclvodm (vg)          Tries to resync VGDA, LV control blocks and ODM.

mkvg -y(vg) -s(PP size) (pv)    Create a volume group
mkvg -y datavg -s 4 hdisk1

reducevg -d (vg) (pv)   Removes a volume group
reducevg (vg) (PVID)    Removes the PVID disk reference from the VGDA when a
disk has vanished without the reducevg (vg) (pv)
command being run first.

extendvg (vg) (new pv)        Adds another PV into a VG.

exportvg (vg)                 Exports the volume group eg deletes it!

Note : Cannot export a VG if it has active paging space, turn off paging,
reboot before exporting VG. Exporting removes entries from filesystems
file but does not remove the mount points.

chvg -a y (vg)                  Auto Vary On a volume group at system start.

lqueryvg -Atp (pv)              Details volume group info for the hard disk.

importvg -y (vg name) (pv)      Import a volume group from a disk.
importvg (pv)                   Same as above but VG will be called vg00 etc.

chvg -Q (y/n) (vg name)         Turns on/off Quorum checking on a vg.

Logical Volumes (LV’s)
———————-

lslv (lv)                    Lists the logical volume details
lslv -l (lv)                Lists the physical volume which the LV is on

mklv (vg) (No of PP’s) (pv Name optional)       Create a logical volume
mklv -y (lv) (PP’s) (pv name optional)          Creates a named logical volume

chlv -n (new lv) (old lv)                       Rename a logical volume
extendlv (lv) (extra No of PP’s)                Increase the size of an LV
rmlv (lv)                                       Remove a logical volume

mklv/extendlv -a = PP alocation policy
-am = middle   -ac = center   -ae = edge
-aie = inner edge    -aim = inner middle

migratepv -l (lv) (old pv) (new pv)
Move a logical volume between physical volumes. Both physical volumes
must be in the same volume group !

mklv -y (lv) -t jfslog (vg) (No of PP’s) (pv Name optional)
Creates a JFSlog logical volume.

logform (/dev/lv)       Initialises an LV for use as an JFSlog

getlvcb -AT (lv)        Displays Logical Volume Control Block information

File Systems (FS’s)
——————-

lsfs            Lists all filesystems
lsfs -q (fs)    Lists the file system details

mount               Lists all the mounted filesystems
mount (fs or lv)    Mounts a named filesystem
mount -a            Mounts all filesystems
mount all

mount -r -v cdrfs /dev/cd0 /cdrom        mounts cd0 drive over /cdrom

crfs -v jfs -d(lv) -m(mount point) -A yes
Will create a file system on the whole of the logical volume, adds entry into
/etc/filesystems and will create mount point directory if it does not exist.

crfs -v jfs -g(vg) -m(mount point) -a size=(size of fs) -A yes
Will create a logical volume on the volume group and create the file system on
the logical volume. All at the size stated. Will add entry into
/etc/filesystems and will create the mount point directory if it does not exist.

chfs -A yes (fs)                 Change file system to Auto mount in
/etc/filesystems
chfs -a size=(new fs size)(fs)   Change file system size

rmfs (fs)            Removes the file system and will also remove the
LV if there are no onther file systems on it.

defrag -q (fs)       Reports the fragment status of the file system.
defragfs -r (fs)     Runs in report only defrag mode (no action).
defragfs (fs)        Defragments a file system.

fsck (fs)            Verify a file system, the file system must be unmounted!
fsck (-y or -n) (fs) Pre-answer questions either yes or no !
fsck -p (fs)         Will restore primary superblock from backup copy if the
superblock is corrupt.

Mirroring
———

mklv -y (lv) -c(copies 2 or 3) (vg) (No of PP’s) (PV Name optional)
Creates a mirrored named logical volume.

mklvcopy -s n (lv) (copies 2 or 3) (pv)
Creates a copy of a logical volume onto another physical volume. The physical
volume MUST be in the same volume group as the orginal logical volume !

rmlvcopy (lv) (copies 1 or 2)             Removes logical volume copies.
rmlvcopy (lv) (copies 1 or 2) (pv)        From this pv only!

syncvg -p (pv)                            Synchronize logical partion copies
syncvg -l (lv)
syncvg -v (vg)

mirrorvg (vg) (pv)
Mirrors the all the logical volumes in a volume group onto a new physical
volume. New physical volume must already be part of the volume group.

——————————————————————————–
BOOT LOGICAL VOLUME (BLV)
——————————————————————————–

bootlist -m (normal or service) -o                       displays bootlist
bootlist -m (normal or service) (list of devices)        change bootlist

bootinfo -b                  Identifies the bootable disk
bootinfo -t                  Specifies type of boot

bosboot -a -d (/dev/pv)      Creates a complete boot image on a physical volume.

mkboot -c -d (/dev/pv)       Zero’s out the boot records on the physical volume.

savebase -d (/dev/pv)        Saves customised ODM info onto the boot device.

——————————————————————————–
SYSTEM DUMP
——————————————————————————–

sysdumpdev -l        Lists current dump destination.
sysdumpdev -e        Estimates dumpsize of the current system in bytes.
sysdumpdev -L        Displays information about the previous dump.

sysdumpstart -p      Starts a dump and writes to the primary dump device.
sysdumpstart -s      Starts a dump and writes to the secondary dump device.

(MCA machine can also dump if key is in service position and the reset
button is pressed)

sysdumpdev -p (dump device) -P        Sets the default dump device, permanently

Analyse dump file :-
echo “stat\n status\n t -m” | crash /var/adm/ras/vmcore.0

——————————————————————————–
PAGING SPACE (PS’s)
——————————————————————————–

lsps -a                        Lists out all paging space
lsps -s                        Displays total paging and total useage
lsps (ps)

mkps -s(No of 4M blocks) -n -a (vg)
mkps -s(No of 4M blocks) -n -a (vg) (pv)
-n = don’t activate/swapon now                -a = activate/swapon at reboot

chps -a n (ps)                       Turns off paging space.
chps -s(No of 4M blocks) (ps)        Increases paging space.

chlv -n (new name) (old name)        Change paging space name

rmps (ps)               Remove paging space. PS must have been turned off
and then the system rebooted before it can be removed.

Note : Need to change the swapon entry in /sbin/rc.boot script if you are
changing the default paging space from /dev/hd6. You also need to
do a “bosboot -a -d /dev/hdiskx” before the reboot.

/etc/swapspaces               File that lists all paging space devices that are
activated/swapon during reboot.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s