How to Remove existing filesystems from Veritas Volume Manager
How to Remove existing filesystems from Veritas Volume Manager: (all the filesystems were under veritas)
Sometimes when databases will decommissioned, in that case we need to remove the unused filesystems from the Server in order to clean up the storage.
Below is the complete process which will present how to remove existing filesystem under vxvm.
yogesh-test $ df -k | grep ORACLE
/dev/vx/dsk/yogesh-dg/ORACLE_admin 1048576 52834 935768 6% /data/oracle/ORACLE/admin
/dev/vx/dsk/yogesh-dg/ORACLE_backup1 2084864 308850 1665020 16% /data/oracle/ORACLE/backup1
/dev/vx/dsk/yogesh-dg/ORACLE_temp01 4194304 284281 3665654 8% /data/oracle/ORACLE/temp01
/dev/vx/dsk/yogesh-dg/ORACLE_data01 36700160 17510880 17989955 50% /data/oracle/ORACLE/data01
/dev/vx/dsk/yogesh-dg/ORACLE_data02 164626432 91177483 68858394 57% /data/oracle/ORACLE/data02
/dev/vx/dsk/yogesh-dg/ORACLE_backup2 2084864 308850 1665020 16% /data/oracle/ORACLE/backup2
/dev/vx/dsk/yogesh-dg/ORACLE_flashback 10485760 19038 9812559 1% /data/oracle/ORACLE/flashback
Note: Before proceeding with the activity, you should take the necessary outputs like vxprint, vxdg, vxdisk, vxinfo etc..
1.First check whether all the filesystems are in use or not.
#fuser -cu /data/oracle/ORACLE/admin
If the output show some userid/username it means those ID’s are sitting somewherer in the listed FS’s i.e Filesystem is open and some read/write operation are under progress. We need to kill them and clear the FS so that the FS should be clean/free before stopping the volume & before umounting. Usually this process is used to avoid any data loss during the read/write operation in case of open Filesystems.
#fuser -ck <FS-mountpoint>
2. Now we will proceed with the Volume stop and Filesystem unmount operation. If we will try to stop the volume before un-mounting the Filesystem it will give errors as volumes are open, so we have to unmount the volumes first.
#vxvol -g yogesh-dg stop ORACLE_admin
# vxvol -g yogesh-dg stop ORACLE_admin
vxvm:vxvol: ERROR: Volume ORACLE_admin is currently open or mounted
It means we have to firstly un-mount the Filesystems and then proceed with the volume stop operation.
#umount /data/oracle/ORACLE/admin
3. After that stop the volumes:
#vxvol -g yogesh-dg stop ORACLE_admin
4. Check volume status by below command:
#vxprint -htv ORACLE_admin
#umount /data/oracle/ORACLE/backup1
#umount /data/oracle/ORACLE/temp01
#umount /data/oracle/ORACLE/data01
#umount /data/oracle/ORACLE/data02
#umount /data/oracle/ORACLE/backup2
#umount /data/oracle/ORACLE/flashback
#vxvol -g yogesh-dg stop ORACLE_backup1
#vxvol -g yogesh-dg stop ORACLE_temp01
#vxvol -g yogesh-dg stop ORACLE_data01
#vxvol -g yogesh-dg stop ORACLE_data02
#vxvol -g yogesh-dg stop ORACLE_backup2
#vxvol -g yogesh-dg stop ORACLE_flashback
5.Below command will remove the volumes:
#vxassist -g yogesh-dg remove volume ORACLE_admin
#vxassist -g yogesh-dg remove volume ORACLE_backup1
#vxassist -g yogesh-dg remove volume ORACLE_temp01
#vxassist -g yogesh-dg remove volumeORACLE_data01
#vxassist -g yogesh-dg remove volume ORACLE_data01
#vxassist -g yogesh-dg remove volume ORACLE_data02
#vxassist -g yogesh-dg remove volume ORACLE_backup2
#vxassist -g yogesh-dg remove volume ORACLE_flashback
or
#vxedit -g yogesh-dg -rf rm <volume-name>
#vxdisk -o alldgs list
#vxdisk -o alldgs list | grep -i yogesh-dg
#vxprint -htg yogesh-dg
#df -k | grep -i ORACLE
6. Check all the volumes have been cleared by below command:
#vxprint -htg yogesh-dg | grep -i ORACLE
Note: Here if your all Filesystems are unmounted from DG and you have to clean up the storage then you have to destroy the DG and free up the disks.
#vxdg -g <DG> destory
#/etc/vx/bin/vxdiskunsetup -C <disk-name without S#>
or
#vxdg -g <DG> rmdisk <disk-name>
#/etc/vx/bin/vxdiskunsetup -C <disk-name without S#>
#vxdg -g <DG> destroy
7. Finally remove or hashed the removed Filesystems entries from /etc/vfstab file:
#cp /etc/vfstab /etc/vfstab.backup
#vi /etc/vfstab
#egrep “ORACLE_admin|ORACLE_backup1|ORACLE_temp01|ORACLE_data01|ORACLE_data02|ORACLE_backup2|ORACLE_flashback” /etc/vfstab
8. Done with the activity.
good doc yogesh.
@Kishore, thanks mate.
good one :)
@Sateesh, thank you :)
Yogesh, the way you explained is really superb!!
@John, I will keep this compliment in my pocket!!!…:-), thank you.
hi yogesh,
need procedure for kernel patch in solaris 10
@Sekhar, Pls refer below link for Kernal Patching.
http://gurkulindia.com/main/2011/09/general-procedure-for-kernel-patching-in-solaris/
good one…
@Saurabh, thanks…
Yogesh, whenever i have doubt, i’m always refering this document. Now i have a doubt in open files. In linux, using lsof command to find the open files PID to kill, but in solaris how it possible? fuser -cu doesn’t showing PID,running process, memory consuming.
suggest the command equal to lsof, Thanks for this article.
I do use this if i have to know all the openfiles and corresponding pids related to a filesystem
 # /usr/bin/pfiles `/usr/sbin/fuser -c /data  2>/dev/null` | /usr/bin/egrep ‘^[0-9]|/data’
how it works?
fuser -c will list all the PIDs which are using the /data, and “2> /dev/null ” moves any errors or warning to /dev/null. Â the output of fuser will be passed to pfiles ( the command used to find openfiles related a specific process), and from the output we are filtering only openfiles related to data and the lines which are having PID.
use pfiles command
How do you perform same steps in VCS considering DG is a part of VCS.
Yogesh . nice to see your document . good one !!