This is for anyone with a Broadcom (LSI/Avago) MegaRAID RAID 5 of aging drives who wants bigger ones without rebuilding the server. At the end every member is a larger drive, the virtual drive is expanded, and the partition and filesystem are grown to match, with the volume mounted throughout. It assumes Linux, root on the server, StorCLI, and hands at the chassis.

This procedure can destroy the array. Every time you pull a member, RAID 5 has no redundancy left until the rebuild finishes. On drives this size a rebuild takes most of a day. If a second drive fails during that window, the virtual drive is gone. If a surviving drive hits an unrecoverable read error during the rebuild, the data in that stripe is gone at minimum. Do not start without a verified backup on separate storage, one you have actually restored from. A snapshot does not count, and neither does the RAID itself; Virtual Machines: Snapshot Before You Touch Production explains the difference.

Last verified: December 2026. Hardware in this story: MegaRAID SAS 9361-8i (SAS3108), firmware version 4.680.00-8519, StorCLI 007.2310, Ubuntu 22.04 with kernel 5.15, e2fsprogs 1.46.5. The StorCLI syntax applies to StorCLI (v1, the storcli/storcli64 binary, still updated by Broadcom in 2026) on 12Gb/s MegaRAID controllers, checked against Broadcom’s StorCLI User Guide v1.8 and HPE’s StorCLI User Guide (September 2025). It does not apply as written to MegaRAID 9600-series cards (9600, 9620, 9660, 9670), which use StorCLI2.

What Happened

The server was a production storage server with eight bays, set up as two 4-drive RAID 5 drive groups. Each group held one virtual drive, and each virtual drive showed up in Linux as one disk with a GPT partition table and a single ext4 partition. Six of the original 16 TB SAS drives had more than six years of power-on time, so I replaced all eight with 20 TB drives over October and November 2026. Each rebuild took about 21 hours, and all eight finished with zero errors. Three things nearly wrecked the schedule.

A 32-day rebuild estimate (January 2026). Before the project, one drive failed on a server of the same type. The replacement started rebuilding automatically when it was inserted (state Rbld), which is what auto-rebuild does. show rebuild estimated 32 days and 10 hours. The controller’s rebuild rate was 30%, which is Broadcom’s default; storcli64 /c0 set rebuildrate=<n> raises it.

A 12-day estimate during a planned swap. During one of the planned rebuilds, the estimate jumped to 12 days. iostat showed the virtual drive 97 to 99% busy while moving only 0.4 to 0.7 MB/s of random reads. The cause was updatedb.plocate, the daily job that builds the locate file index, crawling the data volume while it was degraded. On a degraded RAID 5, every block that lived on the missing drive has to be recalculated from the other three, so a metadata crawl keeps every disk seeking and the rebuild’s long sequential reads barely move. pkill -f updatedb dropped the estimate to about 20 hours. The permanent fix is to keep updatedb off the data mounts and to check for it before every swap.

resize2fs: Permission denied to resize filesystem. The first group expanded and grew online: the virtual drive went from 43.656 TB to 54.569 TB as StorCLI reports it, and resize2fs grew ext4 while mounted. On the second group, resize2fs ended with this:

Copied!
resize2fs: Permission denied to resize filesystem

It looks like a permissions problem and isn’t one. The kernel refuses to grow an ext4 filesystem online while the superblock says errors were detected. tune2fs -l showed errors recorded since July 2026, after three unclean reboots. The grow had to wait for an offline e2fsck. The check, repair and offline resize went through cleanly, and the volume came back with the new capacity. Troubleshooting below has the procedure.

How It Works

A MegaRAID controller builds a drive group (also called an array) from physical drives and carves one or more virtual drives (VDs) out of it. Linux never sees the physical drives. It sees each VD as an ordinary SCSI disk, /dev/sda and so on. Each layer above that, partition, LVM if you use it, and filesystem, has its own idea of its size, and each has to be grown on purpose.

Storage stack: physical drives, drive group, virtual drive, SCSI disk, GPT partition, optional LVM, filesystem, each paired with the step that grows it Each layer keeps its old size until you grow it, in order from the drives down to the filesystem.

When you replace a RAID 5 member with a larger drive, the controller rebuilds onto it, but only the part the drive group already uses: the old member size. The extra space on the new drive sits unused. After every member is larger, the controller still does nothing on its own. The VD stays the same size until you expand it with expandarray. Then Linux keeps the old disk size cached until you rescan, the partition stays the old size until you grow it, and so on.

A rebuild reads the matching block from every surviving drive, XORs them to recreate the missing block, and writes it to the new drive. Patrol read scans drives for media errors and fixes them while redundancy still exists. A consistency check (CC) reads every stripe and verifies that parity matches the data. Broadcom’s user guide recommends running one at least monthly. Both are worth running before you degrade the array, and neither should run during a rebuild.

The Exposure, in Numbers

Each rebuild reads the used part of every surviving member. In a 4-drive group of 16 TB drives that is 3 x 16 TB = 48 TB, about 3.8 x 10^14 bits. A typical 20 TB enterprise drive datasheet specifies one non-recoverable read error (one sector) per 10^15 bits read. If the drives performed exactly at that specification, you would expect about 0.4 unrecoverable read errors per rebuild (3.8 x 10^14 / 10^15). Check your own drives’ datasheet, and watch for the “10 per 10^16” form of the same figure. One data point: my eight rebuilds read about 384 TB from survivors and none of them logged an error. That is no guarantee for yours.

An unrecoverable read error on a survivor during a rebuild is a double fault: two drives can’t supply the same stripe, and that stripe’s data is lost. A MegaRAID-family controller such as Dell’s PERC can finish the rebuild anyway with that stripe’s data lost, which Dell calls a puncture (or “rebuild with errors”). Dell’s documented fix is to delete the array, recreate it and restore from backup. A second drive failure during the rebuild loses the whole VD.

When Not to Do This In Place

In-place replacement means one degraded window per drive, and you are trusting old drives to carry each rebuild. A fresh array plus a restore is the better plan when:

  • Any surviving drive shows media errors, predictive failures or SMART reallocations. Replace that drive first, or don’t degrade the array at all.
  • You have a backup you can restore from in an acceptable time and can take the volume offline for that long.
  • You are buying every drive new anyway and want to change the RAID level.

RAID 6 keeps two parity blocks per stripe, so a single-drive rebuild survives an unrecoverable read error or even a second failure, at the cost of one more drive of capacity per group. In an eight-bay chassis, two 4-drive RAID 5 groups and one 8-drive RAID 6 group both give six drives of usable capacity, but the RAID 6 group survives any two failures. The price is a larger failure domain, rebuilds that read seven drives instead of three, and a full restore to get there. This article does not cover RAID level migration.

Prerequisites

  • A verified, restorable backup of every VD on the controller, on separate storage.
  • A MegaRAID controller managed by StorCLI. Dell PERC 9 to 11 cards use perccli, Dell’s build of the same tool with the same command structure; PERC 12 uses perccli2. MegaRAID 9600-series cards need StorCLI2, which is not backward compatible; check its user guide instead.
  • A root shell (sudo -i); the commands below assume one.
  • StorCLI on the server. Broadcom’s Linux package usually installs it at /opt/MegaRAID/storcli/storcli64; the examples call it storcli64, so put it on your PATH or use the full path.
  • smartmontools, sysstat (for iostat) and, for GPT partitions, growpart from cloud-guest-utils on Debian and Ubuntu.
  • Replacement drives at least as large as the old ones, same interface (SAS or SATA) and same logical sector size as the existing members (StorCLI’s SeSz column, for example 512B). Don’t mix 512-byte and 4K-logical drives in one group.
  • Values on hand: controller number (/c0), enclosure ID (for example e252), each slot’s drive group, array and row number, each VD’s number, and which /dev/sdX each VD is. Step 1 finds them.
  • Time. Budget one full rebuild per drive, plus a consistency check and a background initialization per group.

Step 1: Map Controller, Drives, VDs and Block Devices

Confirm which controller you have and which Linux disk each VD is, so you never grow or check the wrong volume.

Copied!
storcli64 /c0 show all | grep -iE 'Product Name|FW Package|FW Version'
storcli64 /c0/dall show
storcli64 /c0/vall show

/c0/dall show prints the topology: one row per member with DG, Arr, Row, EID:Slot, DID (the controller’s device ID), State and size. Write down DG, Arr and Row for every slot; you will need them in Step 5. /c0/vall show lists each VD with its RAID level, state (Optl means optimal) and size. StorCLI’s “TB” is binary terabytes (TiB), which is why a 16 TB drive shows as 14.551 TB.

Now match each VD to its Linux disk by WWN:

Copied!
storcli64 /c0/v0 show all | grep -iE 'SCSI NAA|OS Drive Name'
lsblk -o NAME,SIZE,TYPE,FSTYPE,MOUNTPOINT,WWN

The VD’s SCSI NAA value must equal the disk’s WWN in lsblk (without the 0x). Repeat for each VD. In this article VD 0 is /dev/sda, mounted at /data1, with enclosure 252 and slots 0 to 3.

Step 2: Run the Pre-Checks

These checks decide whether it is safe to degrade the array today. Any failure means stop.

Copied!
storcli64 /c0/vall show                     # every VD: Optl
storcli64 /c0/eall/sall show                # every member: Onln
for s in 0 1 2 3; do
  echo "== s$s"
  storcli64 /c0/e252/s$s show all | grep -iE 'Media Error Count|Other Error Count|Predictive Failure Count|S.M.A.R.T alert'
done
storcli64 /c0 show events type=sincereboot | grep -ciE 'puncture|medium error|unrecover'

Every drive that stays in the group while another is out must show zero media errors, zero predictive failures and no SMART alert, and the event count should be 0. If a survivor fails any of these, don’t pull a different drive: the weak survivor would have to carry the rebuild.

Check the drives’ own SMART data too. <DID> is the DID column from Step 1, and the device path is any disk on the controller:

Copied!
smartctl -a -d megaraid,<DID> /dev/sda | grep -iE 'health|power on|grown defect|non-medium|^read:|^write:'

Then check that no background job is running and that the cache state is what you expect:

Copied!
storcli64 /c0 show patrolread | grep -i 'state'
for v in 0 1; do                            # one number per VD
  storcli64 /c0/v$v show cc
  storcli64 /c0/v$v show bgi
done
storcli64 /c0/cv show
storcli64 /c0/bbu show

The guides document show cc and show bgi per VD (/c0/v0), so loop over your VD numbers. Idle show cc and show bgi print Not in progress, so a plain grep 'in progress' matches the idle case too. Read the Status column. A controller has at most one cache protection module, a CacheVault (cv) or a battery (bbu), so at least one of the last two commands will fail. If neither reports a healthy module, the controller runs your VDs write-through (the Cache column in /c0/vall show shows WT inside a code like RWTD). Mine ran write-through, which is slower but safe.

Step 3: Quiet the Array and Set the Rebuild Rate

The rebuild competes with everything else that touches the disks.

Stop the locate indexer from crawling the data volumes. Find its timer, then either exclude the mounts or disable it:

Copied!
systemctl list-timers --all | grep -iE 'locate|updatedb'
pgrep -a updatedb || echo "updatedb not running"
vim /etc/updatedb.conf

In vim (press i to insert, Esc then :wq to save and quit), add your data mounts inside the existing PRUNEPATHS="..." list, separated by spaces, for example ... /data1 /data2". If nobody uses locate on this server, disable the job instead (the timer name is the one list-timers showed; on my Ubuntu 22.04 server it was this one):

Copied!
systemctl disable --now plocate-updatedb.timer

Put patrol read into manual mode so it does not start itself between swaps. stop ends the current pass and leaves the schedule alone, so an automatic pass can start again later.

Copied!
storcli64 /c0 stop patrolread
storcli64 /c0 set patrolread=on mode=manual

Now choose a rebuild rate. It is the share of controller effort given to the rebuild, from 0 to 100; the default is 30, and Broadcom advises against 0 or 100. Higher means a shorter degraded window and slower I/O for everything else. The example uses 80. On a latency-sensitive database, a lower rate with a longer window can be the better trade.

Copied!
storcli64 /c0 show rebuildrate
storcli64 /c0 set rebuildrate=80

You can change the rate during a rebuild.

Step 4: Take One Drive Out and Swap It

Turn auto-rebuild off first. With it on, the controller starts rebuilding onto whatever you insert before you can check it. Then take the member offline, mark it missing, spin it down and light its locate LED. The VD goes to Dgrd (degraded) at the set offline line, so do the physical swap promptly after.

Copied!
storcli64 /c0 set autorebuild=off
storcli64 /c0/e252/s0 set offline
storcli64 /c0/e252/s0 set missing
storcli64 /c0/e252/s0 spindown
storcli64 /c0/e252/s0 start locate
storcli64 /c0/vall show

Pull the drive with the lit LED, move the new drive into the caddy, seat it, and label the old drive with its slot number. Keep the old drive until the rebuild finishes.

Step 5: Inspect the New Drive, Then Rebuild

Check the new drive before you trust the array to it:

Copied!
storcli64 /c0/e252/s0 show
storcli64 /c0/e252/s0 show all | grep -iE 'State|Model|SN|Intf|Size|SeSz|Media Error|Other Error|Predictive'
smartctl -a -d megaraid,<NEW_DID> /dev/sda | grep -iE 'product|serial|health|power on|grown defect'

You want state UGood (unconfigured good), the expected model, interface and sector size, a size larger than the old member, power-on hours near zero, and zero grown defects. <NEW_DID> is the DID column in the show output; the new drive gets a new one. If the state is JBOD, convert it with storcli64 /c0/e252/s0 set good force. force overrides the check for an existing OS or filesystem, so use it only on a drive you know is blank.

Now insert it into the missing member’s position, using the DG, Arr and Row you recorded in Step 1:

Copied!
storcli64 /c0/e252/s0 insert dg=0 array=0 row=0
storcli64 /c0/e252/s0 show rebuild
storcli64 /c0 set autorebuild=on
storcli64 /c0/e252/s0 stop locate

insert starts the rebuild by itself. If show rebuild says Not in progress, start it with storcli64 /c0/e252/s0 start rebuild.

Step 6: Watch the Rebuild and Estimate the Time

The controller’s estimate is unreliable for the first few percent. Take two readings an hour or two apart and do the arithmetic yourself:

Copied!
date; storcli64 /c0/e252/s0 show rebuild | grep -E 'Drive-ID|e252'
iostat -xm 5 2 | grep -E 'Device|^sda '

Example output (your numbers will differ):

Copied!
Drive-ID    Progress% Status      Estimated Time Left
/c0/e252/s0        12 In progress 17 Hours 40 Minutes

Hours remaining = (100 - current %) x (hours between readings) / (% gained between readings). For example, 12% at 10:00 and 22% at 12:00 is 5% per hour, so 78% remaining takes about 15.6 more hours. For the whole project, multiply one rebuild by the number of drives, then add a consistency check and a background initialization per group (Steps 7 and 8).

On my hardware, with nothing else competing, each rebuild of a 16 TB member onto a 20 TB drive took about 21 hours, which works out to roughly 210 MB/s. The consistency check took about 19 hours and the post-expansion background initialization about 8. Those figures are from one controller and one drive model. Measure your own first swap and plan from that.

Two signs mean something is competing for the disks: progress well under what the first swap managed, or iostat showing the VD near 100% %util while moving only a few MB/s. Find the process (pgrep -a updatedb first, then iotop or your backup and indexing jobs) and stop it.

If another drive in the group starts logging media errors, or fails, stop all writes to that VD and get the data you care about off it. Don’t pull more drives.

When the rebuild finishes, confirm the VD is Optl, the new drive is clean, and nothing was logged:

Copied!
storcli64 /c0/vall show
storcli64 /c0/e252/s0 show all | grep -iE 'Media Error|Other Error|Predictive'
storcli64 /c0 show events type=sincereboot | grep -ciE 'puncture|medium error|unrecover'

Then go back to Step 2 for the next slot (s1, row=1, and so on).

Flowchart of the per-drive loop: pre-checks, take member out, physical swap, inspect, insert and rebuild, watch, back to optimal, repeat for each drive; amber stop branches for survivor errors, a bad replacement drive, and a second failure during rebuild One member out at a time, and three places where the right move is to stop.

Step 7: Run a Consistency Check and Confirm Expansion Is Offered

After the last member of a group is replaced, verify parity across the whole group before restructuring it. The VD stays online during the check.

Copied!
storcli64 /c0/v0 start cc
storcli64 /c0/v0 show cc

When it finishes, look for the completion event and for any inconsistency, then ask the controller what it can expand:

Copied!
storcli64 /c0 show events type=latest=100 | grep -iE 'consistency|inconsistent'
storcli64 /c0/v0 show expansion

You want Consistency Check done on VD 00/0, not done with corrections, and no inconsistent parity lines. In show expansion, OCE (online capacity expansion) must be Y and WithArrExp shows the space available once the array is expanded into the larger drives. On my controller it reported OCE N until the consistency check completed, then OCE Y with WithArrExp 10.913 TB. That is one controller’s behavior; Broadcom’s guides do not list a consistency check as a requirement for expansion.

Step 8: Expand the Virtual Drive

expandarray tells the controller to grow the drive group into the larger members, not just the VD into free space that already exists. The guides document the size value in MB and say the controller rounds the request up to the nearest percent of free space. The command I used passed the size as show expansion printed it, with size=10912GB as the fallback if the controller rejected the rounded value. Confirm the unit format against your controller’s reference before running.

Copied!
storcli64 /c0/v0 expand size=10.913TB expandarray
storcli64 /c0/vall show                     # the VD should report its new size

The controller then runs a background initialization on the new space. Mine took about 8 hours, and the volume stayed usable throughout. Follow it with:

Copied!
storcli64 /c0/v0 show bgi
storcli64 /c0/vall show

Step 9: Make Linux See the Bigger Disk

The kernel read the disk’s size at attach time. Make it read it again:

Copied!
echo 1 > /sys/class/block/sda/device/rescan
lsblk /dev/sda

sda should now show the new size while sda1 still shows the old one.

Step 10: Grow the Partition

growpart moves the end of the partition to the end of the disk. On GPT it also moves the backup partition table to the new end of the disk. It works on a mounted partition. Do a dry run first:

Copied!
growpart -N /dev/sda 1
growpart /dev/sda 1
lsblk /dev/sda

The real run prints a CHANGED: line with the old and new partition size in sectors. If the filesystem sits directly on the disk with no partition table, skip this step.

Step 11: Grow LVM (Only If You Use It)

If the partition is an LVM physical volume, grow the PV, then the logical volume:

Copied!
pvresize /dev/sda1
vgs
lvextend -l +100%FREE <VG_NAME>/<LV_NAME>
lvs

vgs should show the new space as free before lvextend and none after. lvextend -r would also grow the filesystem; running Step 12 separately makes a filesystem error easier to spot.

Step 12: Grow the Filesystem

For ext4, resize2fs with no size grows to fill the device, online:

Copied!
resize2fs /dev/sda1                    # or /dev/<VG_NAME>/<LV_NAME>
df -h /data1

For XFS, xfs_growfs takes the mount point, and the filesystem must be mounted:

Copied!
xfs_growfs /data1
df -h /data1

With 4 KiB blocks, growing ext4 past 16 TiB requires the 64bit feature (tune2fs -l /dev/sda1 | grep features). Mine had 64bit but no resize_inode, which is fine: when a filesystem without resize_inode needs more group descriptor blocks (resize2fs prints old_desc_blocks and new_desc_blocks), the 5.15 kernel converts it to meta_bg as part of the online resize and logs Converting file system to meta_bg. If resize2fs fails with Permission denied, see Troubleshooting.

On a data-only ext4 volume, the 5% of blocks reserved for root is a lot of space. tune2fs -m 1 /dev/sda1 cuts it to 1%, which frees about 2.2 TiB on a volume the size of mine. Keep the default on any filesystem that holds / or /var.

Step 13: Put the Controller Back to Normal

After the last group is expanded and its background initialization is done, run a final consistency check overnight, then restore the settings you changed:

Copied!
storcli64 /c0/v0 start cc                   # repeat for v1 and any other VD
storcli64 /c0 set patrolread=on mode=auto
storcli64 /c0 show autorebuild
storcli64 /c0 show rebuildrate

Decide whether to keep the higher rebuild rate: it shortens the next unplanned degraded window and slows I/O during it. Keep updatedb off large data mounts permanently.

Verify

Copied!
storcli64 /c0/vall show                     # every VD Optl, new size, Consist Yes
storcli64 /c0/dall show                     # every member Onln at the new drive size
storcli64 /c0 show events type=sincereboot | grep -ciE 'puncture|medium error|unrecover'
lsblk -o NAME,SIZE,MOUNTPOINT
df -h /data1 /data2
dmesg -T | grep -iE 'ext4|xfs' | tail

The VD, disk, partition and filesystem sizes should agree with each other, the event count should be 0, and dmesg should show the resize with no errors. Then test a restore from the backup you took at the start.

Troubleshooting

  • Rebuild estimate says days or weeks: something is competing for the disks, or the rebuild rate is low, or the rebuild has barely started. Check storcli64 /c0 show rebuildrate (30 is the default), then iostat -xm 5 2 and pgrep -a updatedb. A disk near 100% busy at under 1 MB/s is a metadata crawl; mine was updatedb.plocate, and killing it took the estimate from 12 days to about 20 hours. Ignore any estimate taken in the first few percent.

  • Patrol read is Active again in the middle of the project: stop patrolread ends the current pass but leaves the mode set to auto. Set patrolread=on mode=manual until you are done.

  • New drive shows JBOD instead of UGood: run set good force on that slot, only if the drive is blank.

  • show expansion reports OCE N: on my controller it said this until a consistency check completed, then flipped to OCE Y. Other likely causes are another background operation still running or a member that is not larger yet. Check show cc, show bgi, show patrolread and /c0/dall show.

  • expand rejects the size: the request has to fit the free space after rounding. Try a slightly smaller value in MB or GB; my fallback was size=10912GB. Confirm against your controller’s reference before running.

  • lsblk still shows the old disk size after expanding: the kernel hasn’t re-read it. Run the rescan in Step 9.

  • growpart says the partition cannot be grown: same cause, or the partition already ends at the end of the disk.

  • resize2fs: Permission denied to resize filesystem: ext4 has recorded errors, and the kernel refuses online resize while that flag is set (dmesg shows There are errors in the filesystem, so online resizing is not allowed). The examples here use the second VD, /dev/sdb1 mounted at /data2. Confirm with tune2fs -l /dev/sdb1 | grep -iE 'state|error': look for with errors in the state and a first error time. The fix needs the filesystem unmounted. Stop everything that writes to it, then:

    Copied!
    umount /data2
    chattr +i /data2
    e2fsck -fn /dev/sdb1 2>&1 | tee ~/e2fsck-preview.log
    e2fsck -fy -C 0 /dev/sdb1 2>&1 | tee ~/e2fsck-repair.log
    e2fsck -fn /dev/sdb1
    resize2fs -p /dev/sdb1
    mount /data2
    df -h /data2

    chattr +i makes the empty mount point immutable, so a stray job can’t write into the root filesystem while the volume is unmounted. Mounting over it still works. Start tmux (a terminal session that survives a dropped SSH connection) before running any of this, because on a large volume each check can take hours. The first -n pass changes nothing and shows what the real pass will do; the second confirms the repair left a clean filesystem before you resize it. Never run e2fsck on a mounted filesystem. If the preview reports multiply-claimed blocks, two files point at the same data, so at least one of them already has the wrong contents. The repair gives each file its own copy but cannot recover what was lost. Collect the affected file names from ~/e2fsck-repair.log and re-copy those files from their source or backup afterward (rsync -c compares contents by checksum, so it catches files whose size and date look right).

  • smartctl can’t see a drive behind the controller: use -d megaraid,<DID> with a block device on that controller, for example /dev/sda, not /dev/bus/0.

  • Event log mentions a PD number that matches no DID: event log PD numbers are hexadecimal. PD 1a is DID 26.

  • show events takes forever: without a limit it dumps the whole log. Use type=latest=100 or type=sincereboot.

Sources and further reading