cancel
Showing results for 
Search instead for 
Did you mean: 

vxresize to shrink FS and to free a disk

kodaali
Level 3

Hello,

I have to shrink this file system so that disk ndg01 is out of this volume. I tried vxresize different combinations, never got the expected result.

 # df -h /nmnt
Filesystem                  size   used  avail capacity  Mounted on
/dev/vx/dsk/ndg/nvol   6.0G   3.0G   2.8G    53%    /nmnt

# vxprint -htqQ nvol
v  nvol         -            ENABLED  ACTIVE   12517376 SELECT    -        fsgen
pl nvol-01      nvol         ENABLED  ACTIVE   12517376 CONCAT    -        RW
sd ndg01-01     nvol-01      ndg01    0        4169728  0         c2t0d0   ENA
sd ndg02-01     nvol-01      ndg02    0        4173824  4169728   c2t1d0   ENA
sd ndg03-01     nvol-01      ndg03    0        4173824  8343552   c2t2d0   ENA
#
 

Please share your thoughts.

Thanks in Advance

Nagesh.

1 ACCEPTED SOLUTION

Accepted Solutions

g_lee
Level 6

Please provide the platform and filesystem type in order to investigate further.

For filesystem type, provide the output of:

# fstyp -v /dev/vx/rdsk/ndg/nvol

eg: if this is a Solaris machine, and the filesystem is ufs (not vxfs), the filesystem cannot be shrunk, as this is a limitation of ufs filesystems.

If the filesystem is a type (eg: vxfs) that can be shrunk, please provide the exact commands you ran to try to shrink the filesystem, to determine if it was a problem with the syntax/inputs provided to the command.

EDIT: Apologies, I missed the requirement to shrink the volume off the disk ndg01.

Presumably when you attempted to shrink the volume earlier, it shrank off ndg03 instead?

ndg01 is the first subdisk in the volume, so shrinking it won't remove that disk / will shrink off the other/subsequent subdisks first.

If you have a spare disk, you could evacuate the ndg01 to that disk to free up the space on ndg01. Presumably this is not the case since you're looking to shrink the volume to free up the space.

A horrible, convoluted way of doing it is:
1. shrink the volume to 4G (so it will be on ndg01, ndg02)
2. create a new subdisk on ndg03 (where the extra 2G used to be)
3. move the subdisk on ndg01 to the new subdisk ndg03

Note: if you do wish to proceed with this approach, would recommend performing during a downtime window, or at the very least during a quiet period / when the system is not fully loaded

Commands:
--------------------
1. # vxresize -F <fstype> -g ndg nvol 8343552   ## absolute size in sectors, minus space on ndg03

2. # vxdg -g ndg free
#### there should be 4173824 sectors free on ndg03 since this has been freed up now

Make the new subdisk on ndg03 (see vxmake man page for further options/details)
# vxmake -g ndg sd ndg03-<XX> medianame,<offset>,4169728

where <XX> is subdisk number, <offset> is offset from vxdg free output, 4169728 is the length of the subdisk being replaced on ndg01

3. Move the subdisk on ndg01 to ndg03 (see vxsd man page for further options/details)
# vxsd -g ndg mv ndg01-01 ndg03-<XX>
--------------------

If this still does not work, or you are unsure of the offsets/values to use, please provide the platform and SF version being used and the output of the following to determine what values/course of action should be used:

# vxdg -g ndg free
# vxprint -qhtrg ndg

View solution in original post

4 REPLIES 4

g_lee
Level 6

Please provide the platform and filesystem type in order to investigate further.

For filesystem type, provide the output of:

# fstyp -v /dev/vx/rdsk/ndg/nvol

eg: if this is a Solaris machine, and the filesystem is ufs (not vxfs), the filesystem cannot be shrunk, as this is a limitation of ufs filesystems.

If the filesystem is a type (eg: vxfs) that can be shrunk, please provide the exact commands you ran to try to shrink the filesystem, to determine if it was a problem with the syntax/inputs provided to the command.

EDIT: Apologies, I missed the requirement to shrink the volume off the disk ndg01.

Presumably when you attempted to shrink the volume earlier, it shrank off ndg03 instead?

ndg01 is the first subdisk in the volume, so shrinking it won't remove that disk / will shrink off the other/subsequent subdisks first.

If you have a spare disk, you could evacuate the ndg01 to that disk to free up the space on ndg01. Presumably this is not the case since you're looking to shrink the volume to free up the space.

A horrible, convoluted way of doing it is:
1. shrink the volume to 4G (so it will be on ndg01, ndg02)
2. create a new subdisk on ndg03 (where the extra 2G used to be)
3. move the subdisk on ndg01 to the new subdisk ndg03

Note: if you do wish to proceed with this approach, would recommend performing during a downtime window, or at the very least during a quiet period / when the system is not fully loaded

Commands:
--------------------
1. # vxresize -F <fstype> -g ndg nvol 8343552   ## absolute size in sectors, minus space on ndg03

2. # vxdg -g ndg free
#### there should be 4173824 sectors free on ndg03 since this has been freed up now

Make the new subdisk on ndg03 (see vxmake man page for further options/details)
# vxmake -g ndg sd ndg03-<XX> medianame,<offset>,4169728

where <XX> is subdisk number, <offset> is offset from vxdg free output, 4169728 is the length of the subdisk being replaced on ndg01

3. Move the subdisk on ndg01 to ndg03 (see vxsd man page for further options/details)
# vxsd -g ndg mv ndg01-01 ndg03-<XX>
--------------------

If this still does not work, or you are unsure of the offsets/values to use, please provide the platform and SF version being used and the output of the following to determine what values/course of action should be used:

# vxdg -g ndg free
# vxprint -qhtrg ndg

kodaali
Level 3

Thanks for the reply. This is vxfs file system.

 # fstyp -v /dev/vx/rdsk/ndg/nvol
vxfs
magic a501fcf5  version 6  ctime Thu Jan 13 22:00:50 2011
logstart 0  logend 0
bsize  1024 size  6258688 dsize  6258688  ninode 0  nau 0
defiextsize 0  ilbsize 0  immedlen 96  ndaddr 10
aufirst 0  emap 0  imap 0  iextop 0  istart 0
bstart 0  femap 0  fimap 0  fiextop 0  fistart 0  fbstart 0
nindir 2048  aulen 32768  auimlen 0  auemlen 8
auilen 0  aupad 0  aublocks 32768  maxtier 15
inopb 4  inopau 0  ndiripau 0  iaddrlen 8 bshift 10
inoshift 2  bmask fffffc00  boffmask 3ff  checksum f23ad39c
oltext1 32  oltext2 18690  oltsize 1  checksum2 0
free 3094337  ifree 0
efree  3 1 1 1 1 1 0 0 1 1 1 0 1 1 0 2 2 2 2 2 1 0 0 0 0 0 0 0 0 0 0 0
# 

I tried the following with the intention that ndg01 will be freed. But, the results are different.

 v  nvol         -            ENABLED  ACTIVE   12517376 SELECT    -        fsgen
pl nvol-01      nvol         ENABLED  ACTIVE   12517376 CONCAT    -        RW
sd ndg01-01     nvol-01      ndg01    0        4169728  0         c2t0d0   ENA
sd ndg02-01     nvol-01      ndg02    0        4173824  4169728   c2t1d0   ENA
sd ndg03-01     nvol-01      ndg03    0        4173824  8343552   c2t2d0   ENA

# vxresize -b -F vxfs -g ndg nvol -4169728 ndg02 ndg03
VxVM vxassist WARNING V-5-1-364 dm:ndg03: No disk space matches specification

# vxprint -htqQ nvol
v  nvol         -            ENABLED  ACTIVE   8347648  SELECT    -        fsgen
pl nvol-01      nvol         ENABLED  ACTIVE   8347648  CONCAT    -        RW
sd ndg01-01     nvol-01      ndg01    0        4169728  0         c2t0d0   ENA
sd ndg02-01     nvol-01      ndg02    0        4173824  4169728   c2t1d0   ENA
sd ndg03-01     nvol-01      ndg03    0        4096     8343552   c2t2d0   ENA
#
 

I tried to shrink the volume by exatly by the size of subdisk ndg01-01 and used other two disks for the volume.

I even tried the other way, shrink the volume to the combined size of other two subdisks. still no luck.

 # vxprint -htqQ nvol
v  nvol         -            ENABLED  ACTIVE   12517376 SELECT    -        fsgen
pl nvol-01      nvol         ENABLED  ACTIVE   12517376 CONCAT    -        RW
sd ndg01-01     nvol-01      ndg01    0        4169728  0         c2t0d0   ENA
sd ndg02-01     nvol-01      ndg02    0        4173824  4169728   c2t1d0   ENA
sd ndg03-01     nvol-01      ndg03    0        4173824  8343552   c2t2d0   ENA

# bc
4173824 + 4173824
8347648
quit
#

# vxresize -b -F vxfs -g ndg nvol 8347648 ndg02 ndg03
VxVM vxassist WARNING V-5-1-364 dm:ndg03: No disk space matches specification

# vxprint -htqQ nvol
v  nvol         -            ENABLED  ACTIVE   8347648  SELECT    -        fsgen
pl nvol-01      nvol         ENABLED  ACTIVE   8347648  CONCAT    -        RW
sd ndg01-01     nvol-01      ndg01    0        4169728  0         c2t0d0   ENA
sd ndg02-01     nvol-01      ndg02    0        4173824  4169728   c2t1d0   ENA
sd ndg03-01     nvol-01      ndg03    0        4096     8343552   c2t2d0   ENA
# 

I guess, i'm missing some fundamentals. This is test scenario which i'm simulating to do the same on the production env with 8 to 10 luns volumes to free some luns.

Marianne
Moderator
Moderator
Partner    VIP    Accredited Certified

Please try to follow the steps suggested by Grace.

The way I read vxresize man page is that medianame is used to specify disk to be used to allocate new disk space (i.e. when growing the volume).

Extract from man page (http://sfdoccentral.symantec.com/sf/5.0MP3/solaris/manpages/vxvm/man1m/vxresize.html) :

... medianame operands can be specified to name the disks that are to be used for allocating new space for a volume. These arguments can be a simple name for a disk media record, or they can be of the form medianame, offset to specify an offset within the named disk. If an offset is specified, then regions from that offset to the end of the disk are considered candidates for allocation. If a medianame operand is prefixed by !, the specified storage is excluded from the allocation process.

 

As far as I can see, you won't be able to do it in one step - you will have to evacuate desired disk after completion of vxresize.

kodaali
Level 3

Thanks for your time g_lee, Marianne. Its clear to me now. I will try this and post the results.