Growing live Solaris filesystems with metadevices
Solaris Volume Manager has also been variously known as Disksuite or ODS (but not the Solaris Volume Manager which was the rebadged and bundled Veritas Volume Manager!) and comes with lots of neat features. One of the best is simple method for expanding metadevices and filesystems – on a live system!
For my example today, I’m going to use a Sun T2000 which has 4 zones, all of which are running from a metadevice composed of several 10gb LUNs from a SAN. The object of this exercise is to add another 10gb to the zone filesystem, so the developers can fire up another zone.
The fact that we’re using a metaset from a SAN doesn’t matter – the key thing here is that, by encapsulating a disk (or LUN, or partition) and using a metadevice, we can quickly and easily expand live filesystems.
First of all, let’s have a look at the metaset on the host, which has been imaginatively called ‘zones’:
bash-3.00# metaset -s zones Set name = zones, Set number = 2 Host Owner bumpkin Yes (auto) Drive Dbase /dev/dsk/c6t60060E80141189000001118900001918d0 Yes /dev/dsk/c6t60060E80141189000001118900001919d0 Yes /dev/dsk/c6t60060E80141189000001118900002133d0 Yes
We can use the metastat command to print a summary of the metadevices within the metaset:
bash-3.00# metastat -s zones -c zones/d100 s 29GB /dev/dsk/c6t60060E80141189000001118900001918d0s0 /dev/dsk/c6t60060E80141189000001118900001919d0s0 /dev/dsk/c6t60060E80141189000001118900002133d0s0
In this case, we’ve got just one metadevice, named d100, which is composed of three 10gb LUNs from the SAN.
So, our first task is to add the newly available LUN to the metaset:
bash-3.00# metaset -s zones -a c6t60060E80141189000001118900001731d0
We can check that it’s really been added with the metaset command again:
bash-3.00# metaset -s zones Set name = zones, Set number = 2 Host Owner bumpkin Yes (auto) Drive Dbase /dev/dsk/c6t60060E80141189000001118900001918d0 Yes /dev/dsk/c6t60060E80141189000001118900001919d0 Yes /dev/dsk/c6t60060E80141189000001118900002133d0 Yes /dev/dsk/c6t60060E80141189000001118900001731d0 Yes
Rock on! We’ve now got our 4 10gb LUNs added to the metaset. Now we need to attach the new LUN to our existing 30gb metadevice, d100:
bash-3.00# metattach zones/d100 /dev/dsk/c6t60060E80141189000001118900001731d0s0 zones/d100: component is attached
Note that we don’t need to bring down the three running zones – we can do all of this live, with the system at the multi-user-server milestone.
If we query the metadevice now we can see that it’s grown, from a stated 29GB to 39GB, and that our new LUN is part of the metadevice:
bash-3.00# metastat -s zones -c zones/d100 s 39GB /dev/dsk/c6t60060E80141189000001118900001918d0s0 /dev/dsk/c6t60060E80141189000001118900001919d0s0 /dev/dsk/c6t60060E80141189000001118900002133d0s0 /dev/dsk/c6t60060E80141189000001118900001731d0s0
Now all we need to do is grow the filesystem, using all of that extra 10gb:
bash-3.00# growfs -M /export/zones /dev/md/zones/rdsk/d100 /dev/md/zones/rdsk/d100: 83742720 sectors in 13630 cylinders of 48 tracks, 128 sectors 40890.0MB in 852 cyl groups (16 c/g, 48.00MB/g, 5824 i/g) super-block backups (for fsck -F ufs -o b=#) at: 32, 98464, 196896, 295328, 393760, 492192, 590624, 689056, 787488, 885920, Initializing cylinder groups: ................ super-block backups for last 10 cylinder groups at: 82773280, 82871712, 82970144, 83068576, 83167008, 83265440, 83363872, 83462304, 83560736, 83659168
Here’s the output of df before we hacked about:
bash-3.00# df -k /export/zones Filesystem kbytes used avail capacity Mounted on /dev/md/zones/dsk/d100 30928078 14451085 16270806 48% /export/zones
And there’s the output after we’ve expanded the filesystem:
bash-3.00# df -k /export/zones Filesystem kbytes used avail capacity Mounted on /dev/md/zones/dsk/d100 41237442 14462125 26569130 36% /export/zones
So, a quick and simple way to grow a filesystem under Solaris, using metadevices and with no downtime.
Also, a brief note to Sun product managers: choose a name for your products, and stick with that name for more than a year. Thanks!
6. October 2011 at 12:41 :
Hi Tom,
Great notes!
One question though – your example above shows an increase using all of the extra 10Gb. However, what if you only wanted 5Gb?
E.g. growfs -M /export/zones /dev/md/zones/rdsk/d100 -size 5Gb
Is there an SVM/metaset command to achieve this? I have this situation at the moment.
Thanks,
David