8. Volume Lesson 5: Volume resizing

Lets hit on one more topic, since there have been very few mind numbing concepts in this tutorial, as compaired to the 10+ commands you had to learn, each with it's own options, in the VxMake course. Lets talk about about what we can do to resize volumes and which tools can help us in this task.

At some point you are going to realize that your volume just isn't big enough. At that point you'll need to descide whether you should build a new volume and use both, or if you should just resize the exsisting volume. You already know how you would go about creating a new vol, so let's talk about resizing.

In our last example we created a RAID5 volume of 4g on 3 disks plus a log disk. I've suddenly descided that's not going to cut it and I really need a 12g volume instead. But first I need to see how big I can make the volume before I need to add disks, so let's look at our first tool's syntax:

vxassist -g <diskgroup> maxgrow <volume> [ <disk1> <disk2> <disk3> ] 

Using the "maxgrow" form of vxassist we can find out exactly how much head room we have left to use. Using vxassist maxgrow with only a volume name as an argument will tell us exactly how big the volume can get by utilizing any free space in the disk group. If instead I want a more specific idea of growth ideas I can pass arguments along with the base option, such as specifying the disks that I wish to use. Using the RAID5 vol created earlier let's ask the VM just how big we can get this thing by first asking the max possible size, and then by listing the 3 vmdisks we're using for the volume itself, so that we can find out how big we can grow without using any more disks.

# vxassist -g cuddledg maxgrow raid5vol
Volume raid5vol can be extended by 133038080 to 141426688 (69056Mb)
bash-2.03# vxassist -g cuddledg maxgrow raid5vol cuddle-f0 cuddle-f1 cuddle-f2
Volume raid5vol can be extended by 26968064 to 35356672 (17264Mb)

So we can grow to 70G using everything unused in the DG or up to 17.2G by growing the vol to consume fully the disks it's already using. Early I mentioned needing a 12g volume, so growing to 17G and just filling the current disks seems like a good idea. In order to do this we can use another form of vxassist:

	vxassist -g <diskgroup> growby <volume> <len_to_grow_by> 
		or
	vxassist -g <diskgroup> growto <volume> <new_len>

Notice that we can grow the volume in two ways: either by growing by a certain amount, or growing to a certain size. Using the data we collected from the "maxgrow" check we can use either we like. I often prefer the "growto" method. Growby is nice when you just want to passify a DBA who is screeming "I need 2G NOW!!!!!" (not that DBA's do that).

Let's use the "growto" method using the data from the maxgrow and see what happens:

# vxprint -g cuddledg -hrt raid5vol                      
V  NAME         USETYPE      KSTATE   STATE    LENGTH   READPOL   PREFPLEX
PL NAME         VOLUME       KSTATE   STATE    LENGTH   LAYOUT    NCOL/WID MODE
SD NAME         PLEX         DISK     DISKOFFS LENGTH   [COL/]OFF DEVICE   MODE
SV NAME         PLEX         VOLNAME  NVOLLAYR LENGTH   [COL/]OFF AM/NM    MODE

dm cuddle-f0    c1t0d0s2     sliced   3590     17678493 -
dm cuddle-f1    c1t1d0s2     sliced   3590     17678493 -
dm cuddle-f2    c1t2d0s2     sliced   3590     17678493 -
dm cuddle-f3    c1t3d0s2     sliced   3590     17678493 -

v  raid5vol     raid5        ENABLED  ACTIVE   8388608  RAID      -
pl raid5vol-01  raid5vol     ENABLED  ACTIVE   8395712  RAID      3/32     RW
sd cuddle-f0-01 raid5vol-01  cuddle-f0 0       4197879  0/0       c1t0d0   ENA
sd cuddle-f1-01 raid5vol-01  cuddle-f1 0       4197879  1/0       c1t1d0   ENA
sd cuddle-f2-01 raid5vol-01  cuddle-f2 0       4197879  2/0       c1t2d0   ENA
pl raid5vol-02  raid5vol     ENABLED  LOG      3591     CONCAT    -        RW
sd cuddle-f3-01 raid5vol-02  cuddle-f3 0       3591     0         c1t3d0   ENA
# vxassist -g cuddledg growto raid5vol 35356672
# vxprint -g cuddledg -hrt raid5vol
V  NAME         USETYPE      KSTATE   STATE    LENGTH   READPOL   PREFPLEX
PL NAME         VOLUME       KSTATE   STATE    LENGTH   LAYOUT    NCOL/WID MODE
SD NAME         PLEX         DISK     DISKOFFS LENGTH   [COL/]OFF DEVICE   MODE
SV NAME         PLEX         VOLNAME  NVOLLAYR LENGTH   [COL/]OFF AM/NM    MODE

dm cuddle-f0    c1t0d0s2     sliced   3590     17678493 -
dm cuddle-f1    c1t1d0s2     sliced   3590     17678493 -
dm cuddle-f2    c1t2d0s2     sliced   3590     17678493 -
dm cuddle-f3    c1t3d0s2     sliced   3590     17678493 -

v  raid5vol     raid5        ENABLED  ACTIVE   35356672 RAID      -
pl raid5vol-01  raid5vol     ENABLED  ACTIVE   35356928 RAID      3/32     RW
sd cuddle-f0-01 raid5vol-01  cuddle-f0 0       17678493 0/0       c1t0d0   ENA
sd cuddle-f1-01 raid5vol-01  cuddle-f1 0       17678493 1/0       c1t1d0   ENA
sd cuddle-f2-01 raid5vol-01  cuddle-f2 0       17678493 2/0       c1t2d0   ENA
pl raid5vol-02  raid5vol     ENABLED  LOG      3591     CONCAT    -        RW
sd cuddle-f3-01 raid5vol-02  cuddle-f3 0       3591     0         c1t3d0   ENA
# 

This is a very easy and "quick" method of growing volumes. There are of course other concerns about growing the filesystem as well, but that is beyond the scope of this doc and you will find great instructions on doing so in the VxFS Admin Guide or in the Solaris Administrators Collection for UFS.

It should also be noted that there are reciprical commands for shrinking volumes using the vxassist methods "shrinkto" and "shrinkby" in the same manner we did above. For more information on using these take a look at the man page, but know that it's just as easy as we did in the last example.

Another vxassist method exsists which allows you to completely augment your volumes, using "relayout". With relayout you can change the number of columns (which is important when adding or removing disks from a stripe or RAID5), change the plex type (from stripe to concat, and visa-versa, from stripe-mirror to RAID5, and visa-versa), and almost any other change you could want to make. Relayout can also get you out of some hairy situations, and is a valuable tool, but not to be abused. Relayout is a course unto itself, so for information on it check out my Advanced Theory course and the VxVM Administrators Guide.