<

Go Premium for a chance to win a PS4. Enter to Win

x

Expanding a Solaris File System Dynamically

Published on
11,944 Points
4,344 Views
1 Endorsement
Last Modified:
A metadevice consists of one or more devices (slices). It can be expanded by adding slices. Then, it can be grown to fill a larger space while the file system is in use.

However, not all UNIX file systems (UFS) can be expanded this way. The concatenation is good only for small random I/O and for even I/O distribution. On the other hand, striping is advantageous for large sequential I/O and for uneven I/O distribution, because striping will increase performance by accessing data in parallel.
Note: If you wish to expand a file system to be a single striped metadevice, you can't do it on the fly. You have to dismount the file system, then copy or "move" over to a new partition.

How to Expand a File System With a Single Stripe, On the Fly

First, the file system has to be created and mounted as a one-way mirror metadevice; as in this example, with d80 mounted by /opt:
   # metastat d80
   d80: Mirror
       Submirror 0: d81
         State: Okay
       Pass: 1
       Read option: roundrobin (default)
       Write option: parallel (default)
       Size: 10261520 blocks

   d81: Submirror of d80
       State: Okay
       Size: 10261520 blocks
       Stripe 0: (interlace: 32 blocks)
           Device              Start Block  Dbase State        Hot Spare
           c1t12d0s0                  0     No    Okay
           c1t13d0s0               1520     No    Okay
           c1t14d0s0               1520     No    Okay
           c1t15d0s0               1520     No    Okay

Open in new window

Next, use the metattach command to dynamically concatenate a new slice, /dev/dsk/c0t1d0s1, to the end of the existing submirror of d80, d81:
   # metattach d81 c0t1d0s1
   # metastat d80
   d80: Mirror
       Submirror 0: d81
         State: Okay
       Pass: 1
       Read option: roundrobin (default)
       Write option: parallel (default)
       Size: 10261520 blocks

   d81: Submirror of d80
       State: Okay
       Size: 10261520 blocks
       Stripe 0: (interlace: 32 blocks)
           Device              Start Block  Dbase State        Hot Spare
           c1t12d0s0                  0     No    Okay
           c1t13d0s0               1520     No    Okay
           c1t14d0s0               1520     No    Okay
           c1t15d0s0               1520     No    Okay
       Stripe 1:
           Device              Start Block  Dbase State        Hot Spare
           c0t1d0s1                   0     No    Okay

Open in new window

Then, use the growfs command to expand the mounted file system ( /opt) onto the raw metadevice /dev/md/rdsk/d80:
  # growfs -M /opt /dev/md/rdsk/d80

/dev/md/rdsk/d80: 12336320 sectors in 8116 cylinders of 19 tracks, 
   80 sectors
           6023.6MB in 129 cyl groups (63 c/g, 46.76MB/g, 5888 i/g)
super-block backups (for fsck -F ufs -o b=#) at:
 32, 95872, 191712, 287552, 383392, 479232, 575072, 670912, 766752, 862592,
 958432, 1054272, 1150112, 1245952, 1341792, 1437632, 1533472, 1629312,
 1725152, 1820992, 1916832, 2012672, 2108512, 2204352, 2300192, 2396032,
 2491872, 2587712, 2683552, 2779392, 2875232, 2971072, 3064352, 3160192,
 3256032, 3351872, 3447712, 3543552, 3639392, 3735232, 3831072, 3926912,
 4022752, 4118592, 4214432, 4310272, 4406112, 4501952, 4597792, 4693632,
 4789472, 4885312, 4981152, 5076992, 5172832, 5268672, 5364512, 5460352,
 5556192, 5652032, 5747872, 5843712, 5939552, 6035392, 6128672, 6224512,
 6320352, 6416192, 6512032, 6607872, 6703712, 6799552, 6895392, 6991232,
 7087072, 7182912, 7278752, 7374592, 7470432, 7566272, 7662112, 7757952,
 7853792, 7949632, 8045472, 8141312, 8237152, 8332992, 8428832, 8524672,
 8620512, 8716352, 8812192, 8908032, 9003872, 9099712, 9192992, 9288832,
 9384672, 9480512, 9576352, 9672192, 9768032, 9863872, 9959712, 10055552,
 10151392, 10247232, 10343072, 10438912, 10534752, 10630592, 10726432,
 10822272, 10918112, 11013952, 11109792, 11205632, 11301472, 11397312,
 11493152, 11588992, 11684832, 11780672, 11876512, 11972352, 12068192,
 12164032, 12257312,

Open in new window

Now the file system (/opt) has been expanded dynamically, but it contains two stripes: stripe 0, which is the original one, and stripe 1, which is the expanded one.

The next step is to create a single stripe metadevice d82, which is the same size as the submirror d81.
In the following example, we create a stripe with three 2.1-Gbyte disks:
   # metainit d82 1 3 c0t11d0s2 c0t12d0s2 c0t13d0s2
   d82: Concat/Stripe is setup

   # metastat d82
   d82: Concat/Stripe
       Size: 12457920 blocks
       Stripe 0: (interlace: 32 blocks)
           Device              Start Block  Dbase
           c0t11d0s2                  0     No
           c0t12d0s2               1520     No
           c0t13d0s2               1520     No

Open in new window

Then, add the metadevice d82 as the second submirror to d80, and resync will automatically take place:
   # metattach d80 d82
   d80: submirror d82 is attached

   # metastat d80
   d80: Mirror
       Submirror 0: d81
         State: Okay
       Submirror 1: d82
         State: Resyncing
       Resync in progress: 20 % done
       Pass: 1
       Read option: roundrobin (default)
       Write option: parallel (default)
       Size: 12336320 blocks
   ......

Open in new window

After the resync is complete, we have the following two-way mirrors:
   # metastat d80
   d80: Mirror
       Submirror 0: d81
         State: Okay
       Submirror 1: d82
         State: Okay
       Pass: 1
       Read option: roundrobin (default)
       Write option: parallel (default)
       Size: 12336320 blocks

   d81: Submirror of d80
       State: Okay
       Size: 12336320 blocks
       Stripe 0: (interlace: 32 blocks)
           Device              Start Block  Dbase State        Hot Spare
           c1t12d0s0                  0     No    Okay
           c1t13d0s0               1520     No    Okay
           c1t14d0s0               1520     No    Okay
           c1t15d0s0               1520     No    Okay
       Stripe 1:
           Device              Start Block  Dbase State        Hot Spare
           c0t1d0s1                   0     No    Okay

   d82: Submirror of d80
       State: Okay
       Size: 12336320 blocks
       Stripe 0: (interlace: 32 blocks)
           Device              Start Block  Dbase State        Hot Spare
           c0t11d0s2                  0     No    Okay
           c0t12d0s2               1520     No    Okay
           c0t13d0s2               1520     No    Okay

Open in new window

Finally, you can detach the submirror d81 from d80, and remove it completely:
   # metadetach d80 d81
   # metaclear d81

   # metastat d80
   d80: Mirror
       Submirror 1: d82
         State: Okay
       Pass: 1
       Read option: roundrobin (default)
       Write option: parallel (default)
       Size: 12336320 blocks

   d82: Submirror of d80
       State: Okay
       Size: 12336320 blocks
       Stripe 0: (interlace: 32 blocks)
           Device              Start Block  Dbase State        Hot Spare
           c0t11d0s2                  0         No        Okay
           c0t12d0s2               1520     No        Okay
           c0t13d0s2               1520     No        Okay

Open in new window

Now, you have dynamically expanded the file system (/opt) with a single stripe metadevice.

Please note: This procedure must be done during a quiet period, or the file system must be locked, in order to avoid possible changes to the file system during the sync. You can use the fuser -u command to check that no one is using the file system. If users are logged on overnight in their logging directory, the system admin could write-lock the file system if it is possible. In that case, users can still read files in the directory. As long as no one creates files during the sync, everything will be fine.
1
Comment
Author:Joseph Gan
0 Comments

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

Join & Write a Comment

Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Suggested Courses
Course of the Month9 days, 4 hours left to enroll

Keep in touch with Experts Exchange

Tech news and trends delivered to your inbox every month