Solstice DiskSuite 4.0 Administration Guide
只搜寻这本书
以 PDF 格式下载本书

Expanding a File System

11

You can expand a mounted or unmounted UFS file system by using the utilities provided with DiskSuite. Only UFS file systems can be expanded using these utilities.
This chapter provides information about file system expansion with the DiskSuite software package. Use the following table to locate specific information.
File System Expansion Overviewpage 177
Nonexpandable File Systemspage 178
Adding Componentspage 178
The growfs Commandpage 179
Examplespage 179

File System Expansion Overview

Basically, expanding a file system occurs in two steps.
  1. Disk space is added at the end of the metadevice using the DiskSuite dynamic concatenation facilities.

  2. The file system is expanded using the growfs command.


Note - Once a file system is expanded, it cannot be shrunk.

Aborting a growfs(1M) command may cause a temporary loss of free space. The space can be recovered using the fsck(1M) command after the file system is unmounted using umount(1M).
For metamirrors, each of the submirrors must be increased in size before you can expand the file system. If an error is reported while growing any of the submirrors, that error must be resolved before you can expand the file systems.
For metatrans devices, only the logging device or master device can be expanded; not the metatrans device itself. However, the growfs(1M) command should be run on the metatrans device.

Nonexpandable File Systems

A mounted file system cannot be expanded if any of the following conditions exist:
  • When acct(1M) is activated and the accounting file is on the target file system.
  • There is a local swap file in the target file system.
  • C2 security is activated and the logging file is on the target file system.
  • The file system is root, /usr, or swap.

Adding Components

When a component is available, the metattach command is used to add the component to the existing metadevice without interrupting service.
If more than one component is added in a single use of metattach, those components are striped. This stripe is then concatenated onto the metadevice.
Disk space can be expanded by one or all of the following:
  • Adding a physical partition to a metadevice.
  • Adding a stripe to a metadevice.
  • Adding a physical partition or stripe to all submirrors of a metamirror.
  • Adding partitions to a RAID device.

The growfs Command

The growfs command nondestructively expands a file system up to the size of the file system's physical device or metadevice. The growfs command is actually a ''friendly'' front-end to the mkfs(1M) command.
growfs write-locks (see lockfs(1M)) the file system when expanding a mounted file system. Access times are not kept while the file system is write-locked. The lockfs command can be used to check the file system lock status and unlock the file system in the unlikely event that growfs aborts without unlocking the file system.
The file system can be expanded to use only part of the additional disk space using the growfs -s option.

Examples

Several step-by-step examples that show how to expand a file system are provided in this section. These examples include:
  • Expanding a nonmetadevice component
  • Expanding a mounted file system
  • Expanding a mounted file system to an existing metamirror
  • Expanding an unmounted file system
  • Expanding a mounted file system using stripes

Expanding a Nonmetadevice Component

The following example shows the expansion of a nonmetadevice component. In this example, the existing component is converted to a metadevice so additional components can be concatenated. This procedure necessitates unmounting the file system (/var is used as the example) and remounting the file system under the new metadevice.
  1. Edit the /etc/opt/SUNWmd/md.tab file, adding a line that defines the metadevice that will consist of the existing component (/dev/dsk/c1t0d0s3) and a new component (/dev/dsk/c2t0d0s3) to be concatenated onto the existing one.


  d8 2 1 /dev/dsk/c1t0d0s3 1 /dev/dsk/c2t0d0s3  

  1. The file system on /var must now be unmounted, using the following command:


  # /sbin/umount /var  

  1. metainit is now used to create the new metadevice.


  # /usr/opt/SUNWmd/sbin/metainit d8  

  1. Edit the /etc/vfstab file to change the entry for the /var file system to be the newly defined metadevice name rather than the component name. For instance, change the following line:


  /dev/dsk/c1t0d0s3 /dev/rdsk/c1t0d0s3  /var  ufs  4  yes  --  

to read:

  /dev/md/dsk/d8 /dev/md/rdsk/d8  /var  ufs  4  yes  --  

  1. The file system can now be remounted, using mount.


  # /sbin/mount /var  

  1. Use the growfs command to expand the file system.


  # /usr/opt/SUNWmd/sbin/growfs -M /var /dev/md/rdsk/d8  

All of /dev/md/rdsk/d8 will be used to expand the file system. The -M option allows growfs to expand a mounted file system. The -s option can be used to limit the size. During this expansion /var is not available for write
access because of the write-lock. Write accesses are transparently suspended and are restarted when growfs unlocks the file system. Read accesses are not affected, though access times are not kept while the lock is in effect.

Expanding a Mounted File System

The following example shows how to expand a file system mounted on /var by concatenating a single disk drive to an existing metadevice. In this example, the metadevice is named d8. The metadevice is not a metamirror.
  1. Use the metattach command to dynamically concatenate the new drive to the end of the existing metadevice.


  # /usr/opt/SUNWmd/sbin/metattach d8 /dev/dsk/c0t1d0s2  

  1. Use the growfs command to expand the file system.


  # /usr/opt/SUNWmd/sbin/growfs -M /var /dev/md/rdsk/d8  

All of /dev/md/rdsk/d8 will be used to expand the file system. The -M option allows growfs to expand a mounted file system. The -s option can be used to limit the size. During this expansion /var is not available for write access because of the write-lock. Write accesses are transparently suspended and are restarted when growfs unlocks the file system. Read accesses are not affected, though access times are not kept when the lock is in effect.

Expanding a Mounted File System

to an Existing Metamirror

The following example shows how to expand a mounted file system by concatenating three disk drives to an existing three-way metamirror. In this example, the metamirror is named d8 and contains three submirrors named d9, d10, and d11.
  1. Use the metattach command to dynamically concatenate the new drives to the end of each existing submirror within the metamirror. metattach must be run for each of the submirrors.


  # /usr/opt/SUNWmd/sbin/metattach d9 /dev/dsk/c0t2d0s5  
  # /usr/opt/SUNWmd/sbin/metattach d10 /dev/dsk/c0t3d0s5  
  # /usr/opt/SUNWmd/sbin/metattach d11 /dev/dsk/c0t4d0s5  

The metamirror will automatically grow when the last submirror is dynamically concatenated. The metamirror grows to the size of the smallest submirror.
  1. Use the growfs command to expand the file system.


  # /usr/opt/SUNWmd/sbin/growfs -M /var /dev/md/rdsk/d8  

All of /dev/md/rdsk/d8 will be used to expand the file system. The -M option allows growfs to expand a mounted file system. The -s option can be used to limit the size. During this expansion /var is not available for write access because of the write-lock. Write accesses are transparently suspended and are restarted when growfs unlocks the file system. Read accesses are not affected, though access times are not kept when the lock is in effect.

Expanding an Unmounted File System

The following example shows how to expand an unmounted file system. This example has a single disk drive, like the first example. Because the file system is not mounted, no file system locking occurs. The metadevices in this example must have already been initialized using metainit.
  1. Use the metattach command to dynamically concatenate the new drive to the end of the existing metadevice.


  # /usr/opt/SUNWmd/sbin/metattach d8 /dev/dsk/c0t1d0s5  

  1. Use the growfs command to grow the file system.


  # /usr/opt/SUNWmd/sbin/growfs /dev/md/rdsk/d8  

Expanding a Mounted File System Using Stripes

The following example shows how to expand a mounted file system by concatenating four disk drives to an existing metadevice. These four drives will be added to the metadevice as a stripe. In this example, the metadevice is named d8.
  1. Use the metattach command to dynamically concatenate the new IPI drive to the end of the existing metadevice.


  # /usr/opt/SUNWmd/sbin/metattach d8 /dev/dsk/c0t1d0s5 \  
         /dev/dsk/c0t2d0s5 /dev/dsk/c0t3d0s5 /dev/dsk/c0t4d0s5  

  1. Use the growfs command to exapnd the file system.


  # /usr/opt/SUNWmd/sbin/growfs -M /var /dev/md/rdsk/d8  

All of /dev/md/dsk/d8 will be used to expand the file system. The -M option allows growfs to expand a mounted file system. The -s option can be used to limit the size. During this expansion /var is not available for write access because of the write-lock. Write accesses are transparently suspended and are restarted when growfs unlocks the file system. Read accesses are not affected, though access times are not kept when the lock is in effect.