digiturf.net

Move /usr/local/www from SAN filesystem to local disk, destroy unused LV’s, VGs, etc.


* /usr/local/www is on vg01, which is on SAN.  SAN is to be retracted from “blgate” server, so /usr/local/www needs to be moved to local disk.

# Extend /usr by 512MB
[blgate]#  chfs -a size=+512M /usr
Filesystem size changed to 9437184

# Unmount /usr/local/www
[blgate]#  umount /usr/local/www

# mount /dev/wwwlv as /mnt
[blgate]#  mount /dev/wwwlv /mnt

# Listing files after the mount
[blgate :/mnt]# ls
.history       .profile       MPL            gu.c           local          nohup.out      repository     vdkw_cgi@7273
.mc.ini        .sh_history    a.out          isirad         lost+found     ns-home        start_verity
.pine-debug1   ISIHDRV1.GIF   bin            linkchecker    mail           old_stuff      test
.pinerc        MLogon-frozen  form.html      live           new            perl5.003      usage.html

# Checking if there are any files existed already in destination Dir.
[blgate:/usr/local/www]# ls -la
total 16
drwxr-xr-x   2 root     system          512 Apr 06 2007  .
drwxr-xr-x  22 root     system          512 Dec 10 2012  ..

# Copy contents of /mnt to /usr/local/www
[blgate:/usr/local/www]# cp -Rp /mnt/*  .    ^^ This error and then ” #cp -RP ” solved this, but permissions of files are reset.
cp: jtquery.cgi: There are too many levels of symbolic links to translate a path name.
cp: jtsearch.cgi: There are too many levels of symbolic links to translate a path name.

# Copy contents of /mnt to /usr/local/www
[blgate:/usr/local/www]# cp -RP /mnt/* .

# Backup filesystem config file.
[blgate]#  cp -p /etc/filesystems /filesystems04072014

# Unmount /mnt
[blgate]#  umount /mnt

[blgate]#  ls -l /mnt
total 0

# To find list of LV’s from vg01
[blgate]#  lsvg -l vg01
vg01:
LV NAME             TYPE       LPs   PPs   PVs  LV STATE      MOUNT POINT
loglv02                   jfs2log        1       1     1    closed/syncd  N/A
fslv01                     jfs2           592   592   1    closed/syncd  N/A
wwwlv                   jfs2            16     16    1    closed/syncd  N/A

# Removing the LV’s Listed from vg01.
[blgate]#  rmlv loglv02 fslv01 wwwlv
Warning, all data contained on logical volume loglv02 will be destroyed.
rmlv: Do you wish to continue? y(es) n(o)? y
rmlv: Logical volume loglv02 is removed.
Warning, all data contained on logical volume fslv01 will be destroyed.
rmlv: Do you wish to continue? y(es) n(o)? y
rmlv: Logical volume fslv01 is removed.
Warning, all data contained on logical volume wwwlv will be destroyed.
rmlv: Do you wish to continue? y(es) n(o)? y
rmlv: Logical volume wwwlv is removed.

# Verifying to make sure, there are no LV’s left in vg01.
[blgate]#  lsvg -l vg01
vg01:
LV NAME             TYPE       LPs   PPs   PVs  LV STATE      MOUNT POINT

# Removing the volume group by executing the following, this will not return any message on console and gives the prompt. 
[blgate]#  varyoffvg vg01
[blgate]#  exportvg vg01

# To find the disks associated / unassociated with vg01.
[blgate]#  lspv
hdisk1          0000153ff1ba173e                    rootvg          active
hdisk0          00584d0e5180facd                    rootvg          active
hdisk24         0000153f5da79954                    None
hdisk25         0000153f5da79ef4                    None
hdisk26         0000153f5da7a44c                    None
hdisk27         0000153f5da7a92d                    None
hdisk28         0000153f5da7ae57                    None
hdisk29         0000153f5da7b370                    None
hdisk30         0000153f5da7b867                    None
hdisk31         0000153f5da35f5d                    None
hdisk32         0000153f5da7bdc6                    None
hdisk33         0000153f5da7c38e                    None
hdisk34         0000153f5da7c8f9                    None
hdisk35         0000153feb7b7919                    None
hdisk36         0000153feb7b7e42                    None
hdisk37         0000153feb7b8390                    None
hdisk38         0000153feb7b88ba                    None
hdisk39         0000153feb7b8df9                    None

# Execute the following “One Liner” to remove all un-associated disks at once.
[blgate]# for i in hdisk24 hdisk25 hdisk26 hdisk27 hdisk28  hdisk29 hdisk30 hdisk31 hdisk32 hdisk33 hdisk34 hdisk35 hdisk36 hdisk37 hdisk38 hdisk39;
> do rmdev -dl $i ;
> done
hdisk24 deleted
hdisk25 deleted
hdisk26 deleted
hdisk27 deleted
hdisk28 deleted
hdisk29 deleted
hdisk30 deleted
hdisk31 deleted
hdisk32 deleted
hdisk33 deleted
hdisk34 deleted
hdisk35 deleted
hdisk36 deleted
hdisk37 deleted
hdisk38 deleted
hdisk39 deleted

# Make sure the disks / devices are removed.
[blgate]#  lspv
hdisk1          0000153ff1ba173e                    rootvg          active
hdisk0          00584d0e5180facd                    rootvg          active

# As we’ve already copied the files to existing /usr filesystem which is local and part of “rootvg”, files are there in it at /usr/local/www.
[blgate:/]# df -g
Filesystem    GB blocks      Free %Used    Iused %Iused Mounted on
. . . . . . . . . . . . . . . . . . . . .
/dev/hd2           4.50      0.00  100%    47446     5% /usr
. . . . . . . . . . . . . . . . . . . . .

# one last thing to mention here is after i took the backup of /etc/filesystems file, i’ve removed the following entry from it, which is a part of removed SAN Filesystem / volume group “vg01” which is removed / destroyed./usr/local/www:
        dev             = /dev/wwwlv
        vfs             = jfs2
        log             = /dev/loglv00
        mount           = true
        check           = false
        options         = rw
        account         = false

Leave a Reply