Extend RAID 1 (HP SmartArray P410i) running Linux

I took over a fairly simple server setup with the following RAID 1 config running Ubuntu 11.10 (Kernel 3.0.0-12-server x86_64):

=> ctrl all show config

Smart Array P410i in Slot 0 (Embedded)    (sn: removed)

   array A (SAS, Unused Space: 1335535 MB)


      logicaldrive 1 (279.4 GB, RAID 1, OK)

      physicaldrive 1I:1:1 (port 1I:box 1:bay 1, SAS, 1 TB, OK)
      physicaldrive 1I:1:2 (port 1I:box 1:bay 2, SAS, 1 TB, OK)

Initially there were two 300GB disks that got replaced by 1TB disks and I now have to extend the logical volume to use that extra space.

However, when trying to do so I get the following warning:

=> ctrl slot=0 ld 1 modify size=max

Warning: Extension may not be supported on certain operating systems.
         Performing extension on these operating systems can cause data to
         become inaccessible. See ACU documentation for details. Continue?
         (y/n)

Is it safe to say yes or am I at risk of corrupting the file system / loosing data? Rearranging and extending the file system afterwards shouldn't be an issue as I can take the server offline and boot from a gparted live disk.

Here's the config of the RAID controller in use:

=> ctrl all show detail

Smart Array P410i in Slot 0 (Embedded)
   Bus Interface: PCI
   Slot: 0
   Serial Number: removed
   RAID 6 (ADG) Status: Disabled
   Controller Status: OK
   Hardware Revision: Rev C
   Firmware Version: 5.12
   Rebuild Priority: Medium
   Expand Priority: Medium
   Surface Scan Delay: 15 secs
   Surface Scan Mode: Idle
   Wait for Cache Room: Disabled
   Surface Analysis Inconsistency Notification: Disabled
   Post Prompt Timeout: 0 secs
   Cache Board Present: False
   Drive Write Cache: Disabled
   SATA NCQ Supported: True

And the partition table:

Number  Start   End    Size    Type      File system     Flags
 1      1049kB  274GB  274GB   primary   ext4            boot
 2      274GB   300GB  25.8GB  extended
 5      274GB   300GB  25.8GB  logical   linux-swap(v1)

As far as Linux is concerned it looks like the RAID array is a single device, so it is no different from migrating from a smaller single drive to a larger one. Unfortunately you are not using LVM which makes the process of using the extra space by extending / a little more complicated.

The extension process shoudl be perfectly safe. When you next run fdisk or similar you'll see a chunk of unallocated space at the end of the disk.

The simple way to use this space is to mount it as another filesystem: use fdisk to create /dev/sda6, create a filesystem there and mount it. What you would use the filesystem for (and so where you are best to mount it) depends on the use of your server. For a shared web hosting server you'd probably use it for /home, for one example of many.

If you want to extend your current root partition to use the space that is a little more concoluted (if you were using LVM it would be a little easier and safer). You will need to remove the swap partition, extend the root partition, then recreate your swap. This isn't difficult to do mnaually, though unless you are confident I recomend jusing a tool like gparted (http://gparted.sourceforge.net/) instead. The manual steps would be something like:

  1. Turn swap off with swapoff
  2. Comment out the swap area from the partitions list in /etc/fstab
  3. With fdisk remove the swap partition and the extended partition it lives in
  4. Extend the root partition. With standard fdisk you will need to do this by removing the existing one (take careful note of the start sector first) and recreating a larger one over the top
  5. You will probably need to reboot at this point
  6. Run ext2resize /dev/sda -v to extend the filesystem into the new larger space. It will probably demand you run fsck first - follow this instruction if so and then rerun.ext2resize /dev/sda -v. Resizeing can be done live when you are exending an ext2/3/4 filesystem.
  7. You now have a bigger root filesystem
  8. Use fdisk to recreate the swap area
  9. Add the swap area back to /etc/fstab and use swapon to enable it

Note: I'm assuming th earray appears as /dev/sda - adjust the commands above if not of course.

Even though all the above should be safe, I strongly recommend taking a full backup and verifying that backup before proceeding (even if using tools like gparted instead of DIY).


First thing: It is safe to expand the array. You can accept the warning message with no consequences.

Following that, you have a couple of options...

The HP Smart Array controllers are a form of hardware LVM. They allow online expansion, but it's important to understand the relationship between an array and a logicaldrive.

  • The array is the physical grouping of disks.
  • The logicaldrive is a subdivision of the array with a RAID level and size given to it.

Logicaldrives in the same array can even have different RAID levels! Here's an example of a more complex Smart Array controller layout:

Smart Array P400 in Slot 8                (sn: P61630G9SVN702)

   array A (SAS, Unused Space: 385320  MB)

      logicaldrive 1 (72.0 GB, RAID 1+0, OK)
      logicaldrive 2 (120.0 GB, RAID 1+0, OK)
      logicaldrive 3 (100.0 GB, RAID 6 (ADG), OK)
      logicaldrive 4 (100.0 GB, RAID 1+0, OK)

      physicaldrive 1I:1:1 (port 1I:box 1:bay 1, SAS, 146 GB, OK)
      physicaldrive 1I:1:2 (port 1I:box 1:bay 2, SAS, 146 GB, OK)
      physicaldrive 1I:1:3 (port 1I:box 1:bay 3, SAS, 146 GB, OK)
      physicaldrive 1I:1:4 (port 1I:box 1:bay 4, SAS, 146 GB, OK)
      physicaldrive 2I:1:5 (port 2I:box 1:bay 5, SAS, 146 GB, OK)
      physicaldrive 2I:1:6 (port 2I:box 1:bay 6, SAS, 146 GB, OK)
      physicaldrive 2I:1:7 (port 2I:box 1:bay 7, SAS, 146 GB, OK)
      physicaldrive 2I:1:8 (port 2I:box 1:bay 8, SAS, 146 GB, OK)

For instance, in the "Unused space" showing in your setup, you could create another logical drive of either RAID1 or RAID0 of any size up to 1335535MB (RAID0) or 1335535MB/2 (RAID1), which will present another block device to the operating system; /dev/sdb. Or you could expand the existing block device /dev/sda to use up-to 1335535/2 more Megabytes. In the commands you listed above, you specified growing the array to its largest size.

Since you already took care of the Array Transformation step by inserting the new disks and letting them rebuild, this expansion action will be instant.

Once you've done this, you have a couple of options for your operating system. I'd like to ask what you'd like the final partition and filesystem layout to look like...

You could expand your /dev/sda by rescanning the SCSI block device or rebooting. The rescan would look something like the following for your system:

echo 1 > /sys/class/scsi_disk/0\:0\:0\:0/device/rescan

That will grow /dev/sda. Confirm with dmesg and fdisk.

From there, you could add partitions, or expand the existing partitions. What's your specific layout goal?