Tanti Technology

My photo
Bangalore, karnataka, India
Multi-platform UNIX systems consultant and administrator in mutualized and virtualized environments I have 4.5+ years experience in AIX system Administration field. This site will be helpful for system administrator in their day to day activities.Your comments on posts are welcome.This blog is all about IBM AIX Unix flavour. This blog will be used by System admins who will be using AIX in their work life. It can also be used for those newbies who want to get certifications in AIX Administration. This blog will be updated frequently to help the system admins and other new learners. 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.

Monday, 28 April 2014

AIX Basics: Growing a Filesystem


This begins what will be an ongoing series of posts relating to basic AIX tasks.  The first is a quick explanation of how to add and takeaway space from a filesystem:
# df -g
Filesystem GB blocks Free %Used Iused %Iused Mounted on
/dev/hd4 3.00 2.73 10% 11642 2% /
/dev/hd2 4.00 1.90 53% 50028 10% /usr
/dev/hd9var 3.00 1.14 62% 7020 3% /var
/dev/hd3 3.00 1.76 42% 964 1% /tmp
/dev/fwdump 1.00 1.00 1% 4 1% /var/adm/ras/platform
/dev/hd1    3.00    3.00    1%    14    1%    /home

Check the VG for available space.
# lsvg rootvg
VOLUME GROUP:      rootvg                  VG IDENTIFIER:
VG STATE:                    active                    PP SIZE: 512 megabyte(s)
VG PERMISSION:      read/write           TOTAL PPs: 558 (285696 megabytes)
MAX LVs:                       256                        FREE PPs: 454 (232448 megabytes)
LVs:                                    14                         USED PPs: 104 (53248 megabytes)
Now, we add space to our filesystem.
# chfs -a size=+5G /home
Filesystem size changed to 16777216
# df -g
Filesystem GB blocks Free %Used Iused %Iused Mounted on
/dev/hd4 3.00 2.73 10% 11642 2% /
/dev/hd2 4.00 1.90 53% 50028 10% /usr
/dev/hd9var 3.00 1.14 62% 7020 3% /var
/dev/hd3 3.00 1.76 42% 963 1% /tmp
/dev/fwdump 1.00 1.00 1% 4 1% /var/adm/ras/platform
/dev/hd1     8.00     7.99     1%     14 1%     /home
Alternatively, we could specify the total size of our filesystem.
# chfs -a size=10G /home
Filesystem size changed to 20971520
# df -g
Filesystem GB blocks Free %Used Iused %Iused Mounted on
/dev/hd4 3.00 2.73 10% 11642 2% /
/dev/hd2 4.00 1.90 53% 50028 10% /usr
/dev/hd9var 3.00 1.14 62% 7020 3% /var
/dev/hd3 3.00 1.76 42% 963 1% /tmp
/dev/fwdump 1.00 1.00 1% 4 1% /var/adm/ras/platform
/dev/hd1    10.00    9.99    1%    14    1%    /home
Be careful when removing space from a filesystem.  It is possible to lose data if the filesystem is close to full, depending on how much you want to decrease by.  This can only be done with JFS2 filesystems.
# chfs -a size=8G /home
or
# chfs -a size=-2G /home
# df -g
Filesystem GB blocks Free %Used Iused %Iused Mounted on
/dev/hd4 3.00 2.73 10% 11642 2% /
/dev/hd2 4.00 1.90 53% 50028 10% /usr
/dev/hd9var 3.00 1.14 62% 7020 3% /var
/dev/hd3 3.00 1.76 42% 963 1% /tmp
/dev/fwdump 1.00 1.00 1% 4 1% /var/adm/ras/platform
/dev/hd1    8.00    7.99    1%    14    1%    /home

No comments:

Post a Comment