Increasing the Size of a Software RAID

Before you begin, review the guidelines in Section 8.1, “Understanding the Resizing Process”.

Increasing the Size of Component Partitions

Apply the procedure in this section to increase the size of a RAID 1, 4, 5, or 6. For each component partition in the RAID, remove the partition from the RAID, modify its size, return it to the RAID, then wait until the RAID stabilizes to continue. While a partition is removed, the RAID operates in degraded mode and has no or reduced disk fault tolerance. Even for RAIDs that can tolerate multiple concurrent disk failures, do not remove more than one component partition at a time.

[Warning]Warning

If a RAID does not have disk fault tolerance, or it is simply not consistent, data loss results if you remove any of its partitions. Be very careful when removing partitions, and make sure that you have a backup of your data available.

The procedure in this section uses the device names shown in the following table. Make sure to modify the names to use the names of your own devices.

Table 8.3. Scenario for Increasing the Size of Component Partitions

RAID Device

Component Partitions

/dev/md0

/dev/sda1

/dev/sdb1

/dev/sdc1


To increase the size of the component partitions for the RAID:

  1. Open a terminal console, then log in as the root user or equivalent.

  2. Make sure that the RAID array is consistent and synchronized by entering

    cat /proc/mdstat
    

    If your RAID array is still synchronizing according to the output of this command, you must wait until synchronization is complete before continuing.

  3. Remove one of the component partitions from the RAID array. For example, to remove /dev/sda1, enter

    mdadm /dev/md0 --fail /dev/sda1 --remove /dev/sda1
    

    In order to succeed, both the fail and remove actions must be done.

  4. Increase the size of the partition that you removed in Step 3 by doing one of the following:

    • Increase the size of the partition, using a disk partitioner such as fdisk(8), cfdisk(8), or parted(8). This is the usual choice.

    • Replace the disk on which the partition resides with a higher-capacity device.

      This option is possible only if no other file systems on the original disk are accessed by the system. When the replacement device is added back into the RAID, it takes much longer to synchronize the data because all of the data that was on the original device must be rebuilt.

  5. Re-add the partition to the RAID array. For example, to add /dev/sda1, enter

    mdadm -a /dev/md0 /dev/sda1
    

    Wait until the RAID is synchronized and consistent before continuing with the next partition.

  6. Repeat Step 2 through Step 5 for each of the remaining component devices in the array. Make sure to modify the commands for the correct component partition.

  7. If you get a message that tells you that the kernel could not re-read the partition table for the RAID, you must reboot the computer after all partitions have been resized to force an update of the partition table.

  8. Continue with Section 8.2.2, “Increasing the Size of the RAID Array”.

Increasing the Size of the RAID Array

After you have resized each of the component partitions in the RAID (see Section 8.2.1, “Increasing the Size of Component Partitions”), the RAID array configuration continues to use the original array size until you force it to be aware of the newly available space. You can specify a size for the RAID or use the maximum available space.

The procedure in this section uses the device name /dev/md0 for the RAID device. Make sure to modify the name to use the name of your own device.

  1. Open a terminal console, then log in as the root user or equivalent.

  2. Check the size of the array and the device size known to the array by entering

    mdadm -D /dev/md0 | grep -e "Array Size" -e "Device
        Size"
    
  3. Do one of the following:

    • Increase the size of the array to the maximum available size by entering

      mdadm --grow /dev/md0 -z max
      
    • Increase the size of the array to a specified value by entering

      mdadm --grow /dev/md0 -z size
      

      Replace size with an integer value in kilobytes (a kilobyte is 1024 bytes) for the desired size.

  4. Recheck the size of your array and the device size known to the array by entering

    mdadm -D /dev/md0 | grep -e "Array Size" -e "Device
        Size"
    
  5. Do one of the following:

Increasing the Size of the File System

After you increase the size of the array (see Section 8.2.2, “Increasing the Size of the RAID Array”), you are ready to resize the file system.

You can increase the size of the file system to the maximum space available or specify an exact size. When specifying an exact size for the file system, make sure the new size satisfies the following conditions:

  • The new size must be greater than the size of the existing data; otherwise, data loss occurs.

  • The new size must be equal to or less than the current RAID size because the file system size cannot extend beyond the space available.

Ext2 or Ext3

Ext2 and Ext3 file systems can be resized when mounted or unmounted with the command resize2fs.

  1. Open a terminal console, then log in as the root user or equivalent.

  2. Increase the size of the file system using one of the following methods:

    • To extend the file system size to the maximum available size of the software RAID device called /dev/md0, enter

      resize2fs /dev/md0
      

      If a size parameter is not specified, the size defaults to the size of the partition.

    • To extend the file system to a specific size, enter

      resize2fs /dev/md0 size
      

      The size parameter specifies the requested new size of the file system. If no units are specified, the unit of the size parameter is the block size of the file system. Optionally, the size parameter may be suffixed by one of the following the unit designators: s for 512 byte sectors; K for kilobytes (1 kilobyte is 1024 bytes); M for megabytes; or G for gigabytes.

    Wait until the resizing is completed before continuing.

  3. If the file system is not mounted, mount it now.

    For example, to mount an Ext2 file system for a RAID named /dev/md0 at mount point /raid, enter

    mount -t ext2 /dev/md0 /raid
    
  4. Check the effect of the resize on the mounted file system by entering

    df -h
    

    The Disk Free (df) command shows the total size of the disk, the number of blocks used, and the number of blocks available on the file system. The -h option print sizes in human-readable format, such as 1K, 234M, or 2G.

JFS

Resizing a JFS partition is done with a special option to the mount command that is specific to the JFS file system:

mount -o remount,resize /mnt

Using the resize option is valid only during a remount when the volume is already mounted read-write. The mount point is specified rather than the device name.

  1. Open a terminal console, then log in as the root user or equivalent.

  2. Increase the size of the file system on the software RAID device mounted at /mnt/point, using one of the following methods:

    • To extend the file system size to the maximum available size of the device, enter

      mount -o remount,resize /mnt/point
      

      The resize option with no value specified grows the volume to the full size of the partition.

    • To extend the file system to a specific size, enter

      mount -o remount,resize=size /mnt/point
      

      Replace size with the desired size in blocks based on the block size used for the file system.

      For example, if you have a 4 GB device with a block size of 4KB, enter

      mount -o remount,resize=1048576 /mnt/point
      

    Wait until the resizing is completed before continuing.

  3. Check the effect of the resize on the mounted file system by entering

    df -h
    

    The Disk Free (df) command shows the total size of the disk, the number of blocks used, and the number of blocks available on the file system. The -h option print sizes in human-readable format, such as 1K, 234M, or 2G.

ReiserFS

As with Ext2 and Ext3, a ReiserFS file system can be increased in size while mounted or unmounted. The resize is done on the block device of your RAID array.

  1. Open a terminal console, then log in as the root user or equivalent.

  2. Increase the size of the file system on the software RAID device called /dev/md0, using one of the following methods:

    • To extend the file system size to the maximum available size of the device, enter

      resize_reiserfs /dev/md0
      

      When no size is specified, this grows the volume to the full size of the partition.

    • To extend the file system to a specific size, enter

      resize_reiserfs -s size /dev/md0
      

      Replace size with the desired size in bytes. You can also specify units on the value, such as 50000K (kilobytes), 250M (megabytes), or 2G (gigabytes). Alternatively, you can specify an increase to the current size by prefixing the value with a plus (+) sign. For example, the following command increases the size of the file system on /dev/md0 by 500 MB:

      resize_reiserfs -s +500M /dev/md0
      

    Wait until the resizing is completed before continuing.

  3. If the file system is not mounted, mount it now.

    For example, to mount an ReiserFS file system for a RAID named /dev/md0 at mount point /raid, enter

    mount -t reiserfs /dev/md0 /raid
    
  4. Check the effect of the resize on the mounted file system by entering

    df -h
    

    The Disk Free (df) command shows the total size of the disk, the number of blocks used, and the number of blocks available on the file system. The -h option print sizes in human-readable format, such as 1K, 234M, or 2G.


SUSE® Linux Enterprise Server Storage Administration Guide 10