Search This Blog

Saturday, September 24, 2011

When you try to shrink Volume/File system using '-' sign in the command as follows, it results in an error..

When you try to shrink Volume/File system using '-' sign in the command as follows, it results in an error..


#/etc/vx/bin/vxresize -g DG Volume_Name -Size
E.g. #/etc/vx/bin/vxresize -g testdg testvol -2g
#/etc/vx/bin/vxresize -g testdg testvol -2g
vxresize: invalid option -- 2
VxVM vxresize INFO V-5-1-10092 usage: vxresize [-hHvMDxsnbf] [-F fstype] [-g diskgroup] [-t tag] [-o verify|override] volume length [media...]


Since '-2g' starts with '-' character, the standard UNIX getopt will treat it as an option.
Resolution:
In order to tell getopt(3) to terminate the option scanning, you have to specify '--'.


#/etc/vx/bin/vxresize -g DG Volume_Name -- -Size
E.g. #/etc/vx/bin/vxresize -g testdg testvol -- -2g