Linux – Extend RAID 1 (HP SmartArray P410i) running Linux

hardware-raidhphp-prolianthp-smart-arraylinux

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)

Best Answer

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).