Tuesday 7 January 2014

Rename & Moving AIX Logical Volume

I would like to discuss about two scenarios  here.



I. Renaming LV in the Same Volume Group:

Steps:

Let us consider , here we need to rename testlv_old  to testlv_new
1: Unmount the FS associated with the testlv_old  ( lets us say  /testfs)
 #umount  /testfs
2: Rename the logical volume type
# chlv -n  testlv_new testlv_old
3:  Verify  dev parameters of the mount point of the filesystem associates with the logical volume in the /etc/filesystems file to match the new name of the logical volume
4: Note If you rename a JFS log , you will be prompted to run chfs on all filesystems that was renamed
5: remount the filesystem type
mount /testfs
6: Verfication
# df -k /testfs
# ls -ltr /testfs
# cd /testfs  point / then create an file using the touch comand

II. Moving LV  to different Volume Group with Different Name

assumptions:

"testlv_old" logical volume belongs to "testvg1" and mounted on "/testfs"
You need to create a samemount point "/testfs" with different logical volume name "testlv_new" and on different vg "testvg2"

Steps:

Pre-Checks:
[root@umlapr root]# lsvg -l testvg1
testvg1:
LV NAME             TYPE       LPs     PPs     PVs  LV STATE      MOUNT POINT
loglv00             jfs2log    1       1       1    open/syncd    N/A
testlv_old          jfs2       702     702    1    open/syncd    /testfs

[root@umlapr root]# ls -ld /testfs
drwxr_xr_x   8 tadmin  tgroup   4096 Sep 19 09:57 /testfs

[root@umlapr root]#df -g
Filesystem    GB blocks      Free %Used    Iused %Iused Mounted on
/dev/testlv_old   351.00    127.58   64%      143     1% /testfs
[root@umlapr root]
1: Take backup of the /testfs either locally or whichever the backtools you are using ( eg: TSM /netbackup)
  if you are taking backup locally  make sure you use '-p' option with 'cp' command
  #cp -pr /testfs/*  /backup/testfs_back/
2:Unmount the FS associated with the testlv_old ,here its  "/testfs"
  #umount /testfs
3: Change mount point name  in /etc/filesystem
/testfs:
        dev             = /dev/testlv_old
        vfs             = jfs2
        log             = /dev/loglv00
        mount           = true
        options         = rw
        account         = false
      
to
/testfs_old:
        dev             = /dev/testlv_old
        vfs             = jfs2
        log             = /dev/loglv00
        mount           = true
        options         = rw
        account         = false
4: Create new lv "testlv_new"
#mklv -y <lv name=""> -t jfslog <vg> <# of PP's>
#mklv -y testlv_new -t jfs2 testvg2  702   ( 702 may change depending upon the pp size of the new vg "testvg2" , here we assugmed both testvg1 and testvg2 have same pp size)
5: Create Filesystem with name "/testfs"
#crfs -v jfs2 -d <lv> -m <mountpoint> -A yes
#crfs -v jfs2 -d testlv_new -m /testfs -A yes
above command creates an entry into /etc/filesystems like below
/testfs:
        dev             = /dev/testlv_new
        vfs             = jfs2
        log             = /dev/loglv00
        mount           = true
        options         = rw
        account         = false
6: Mount the filesystem /testfs
#mount /testfs
7: Change the ownership and permisson on the mount point
  #chown -R tadmin:tgroup /testfs
  #chmod 775 /testfs
8: Restore the backup data taken previously
if you taken it locally
#cp -pr /backup/testfs_back/* /testfs
9: validate lv and fs
[root@umlapr root]# lsvg -l testvg2
testvg2:
LV NAME             TYPE       LPs     PPs     PVs  LV STATE      MOUNT POINT
loglv00             jfs2log    1       1       1    open/syncd    N/A
testlv_new          jfs2       702     702    1    open/syncd    /testfs

[root@umlapr root]# df -g /testfs
Filesystem    GB blocks      Free %Used    Iused %Iused Mounted on
/dev/testlv_new    351.00    127.58   64%      143     1% /testfs
[root@umlapr root]

Thats it, I hope this article will help you

1 comment: