Tuesday, January 18, 2011

AIX: Howto setup a new /home directory on a new harddrive

Our AIX 5.3 IntelliStation was running out of space in the /home directory and we needed to move the /home directory to a different location.

Fortunately, the IntelliStation we are using had a second harddrive "hdisk1" which was not used at all.

Please note: I am working as a software engineer, not as an admin. But since we don't have a dedicated AIX admin, I am feeling somehow responsible for this machine.

I am very confused with all this AIX specific stuff:

  • Volume Groups
  • Physical Volumes
  • Logical Volumes
  • Journaled Filesystems and Filesystem Logs

... and I need some help.

  • Meanwhile I found a solution for the topic mentioned. But I would like to let others know how I did that.

    I found this great description from a guy whose name is "Ryan".

    see: Ryan's AIX description

    The only thing I had to change was: use jfs instead of jfs2 (for whatever reason).

    Here is a summary of the commands I used to get this working:

    1. mkvg -y homevg hdisk1                    # create a new volume group on the new/free  harddisk
    2. mklv -t jfslog -y loghomevg homevg 1     # prepare log for the new filesystem
    3. mklv -t jfs    -y    homelv homevg 64G   # prepare a 64G partition for the new /home
    4. mkfs -o log=/dev/loghomevg  -V jfs /dev/homelv # create new jfs filesystem.
    5. mkdir /home2                             # create a mountpoint for the new filesystem
    6. chown bin:bin /home2                     # set ownership according to /home
    7. mount -o log=/dev/loghomevg  /dev/homelv /home2 # mount the new filesystem
    

    Note: in (4) you have to answer with "Yes". Afterwards it will take a while to complete.

    After all that I copied the original content of the /home directory to /home2. I did so by using gnu tar, but other approaches should also work:

    cd /home
    gtar -cvpf - * | gtar -C /home2 -xpf -
    

    you are done now!

    finally you could unmount /home and use /home2 as the new /home directory, e.g. by modifying /etc/filesystems appropriately. Alternatively you could assign a new home directory to the users defined in /etc/passwd, e.g. use /home2/buildsys instead of /home/buildsys

0 comments:

Post a Comment