Skip to contentSkip to conversation

raidreconf won't resize a RAID 5 array. Can it be done with mkraid -f ?

DISCUSSION TJ Harrell 2 participants 3 messages May 17, 2004 MD RAID

lore
Share & tools
lore

TJ Harrell

author
#0 lore raw

I have a raid 5 array consisting of 3 disks. The smallest disk is 195191168 blocks. The array only uses 172551296 blocks from each device. Numbers ar from output of mdadm. I would like to grow the array to the largest posssible size. I tried doing a raidreconf using identical settings in raidtab.old and raidtab.new, and it said the size would remain unchanged when it asked for confirmation. Is there a way to tweak it to do what I want, or could I just mkraid -f the existing array? I'm afraid if I just do a mkraid -f it will fubar the old array by laying out parity info differently or something since the size of the array will be different.

Raidtab:
raiddev /dev/md0
raid-level linear
nr-raid-disks 3
persistent-superblock 1
chunk-size 128

device      /dev/hdk1
raid-disk   0
device      /dev/hdi1
raid-disk   1
device      /dev/hda3
raid-disk   2

raiddev /dev/md1
raid-level 5
nr-raid-disks 3
persistent-superblock 1
chunk-size 64

device      /dev/hdg1
raid-disk   0
device      /dev/md0

failed-disk 1
device /dev/hdc1
raid-disk 2

Output of "raidreconf -o /etc/raidtab -n /etc/raidtab.new -m /dev/md1"

Working with device /dev/md1
Parsing /etc/raidtab
Parsing /etc/raidtab.new
Size of old array: 1171815940 blocks, Size of new array: 1171815940 blocks Old raid-disk 0 has 3052474 chunks, 195358336 blocks
Old raid-disk 1 has 3049861 chunks, 195191104 blocks
Old raid-disk 2 has 3052474 chunks, 195358336 blocks
New raid-disk 0 has 3052474 chunks, 195358336 blocks
New raid-disk 1 has 3049861 chunks, 195191104 blocks
New raid-disk 2 has 3052474 chunks, 195358336 blocks
Using 64 Kbyte blocks to move from 64 Kbyte chunks to 64 Kbyte chunks. Detected 418432 KB of physical memory in system
A maximum of 1394 outstanding requests is allowed
---------------------------------------------------
I will convert your old device /dev/md1 of 6102335 blocks
to a new device /dev/md1 of same size
using a block-size of 64 KB
Is this what you want? (yes/no): no

#1 lore raw

I don't understand the size of your array!
If you have 3 disks about 200G each, your RAID5 array should be about 400G. But your array is 1171815940 blocks! That's 1171G, about 3 times larger than it should be.

Just to verify the size of the disks and the array, do these commands:
fdisk -l /dev/hdg
fdisk -l /dev/hdc
fdisk -l /dev/hdk
fdisk -l /dev/hdi
fdisk -l /dev/hda
cat /proc/mdstat
mdadm -D /dev/md0
mdadm -D /dev/md1

Guy

-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of TJ Harrell
Sent: Monday, May 17, 2004 11:09 AM
To: [email protected]
Subject: raidreconf won't resize a RAID 5 array. Can it be done with mkraid -f ?

I have a raid 5 array consisting of 3 disks. The smallest disk is 195191168 blocks. The array only uses 172551296 blocks from each device. Numbers ar from output of mdadm. I would like to grow the array to the largest posssible size. I tried doing a raidreconf using identical settings in raidtab.old and raidtab.new, and it said the size would remain unchanged when it asked for confirmation. Is there a way to tweak it to do what I want, or could I just mkraid -f the existing array? I'm afraid if I just do a mkraid -f it will fubar the old array by laying out parity info differently or something since the size of the array will be different.

Raidtab:
raiddev /dev/md0
raid-level linear
nr-raid-disks 3
persistent-superblock 1
chunk-size 128

device      /dev/hdk1
raid-disk   0
device      /dev/hdi1
raid-disk   1
device      /dev/hda3
raid-disk   2

raiddev /dev/md1
raid-level 5
nr-raid-disks 3
persistent-superblock 1
chunk-size 64

device      /dev/hdg1
raid-disk   0
device      /dev/md0

failed-disk 1
device /dev/hdc1
raid-disk 2

Output of "raidreconf -o /etc/raidtab -n /etc/raidtab.new -m /dev/md1"

Working with device /dev/md1
Parsing /etc/raidtab
Parsing /etc/raidtab.new
Size of old array: 1171815940 blocks, Size of new array: 1171815940 blocks Old raid-disk 0 has 3052474 chunks, 195358336 blocks
Old raid-disk 1 has 3049861 chunks, 195191104 blocks
Old raid-disk 2 has 3052474 chunks, 195358336 blocks
New raid-disk 0 has 3052474 chunks, 195358336 blocks
New raid-disk 1 has 3049861 chunks, 195191104 blocks
New raid-disk 2 has 3052474 chunks, 195358336 blocks
Using 64 Kbyte blocks to move from 64 Kbyte chunks to 64 Kbyte chunks. Detected 418432 KB of physical memory in system
A maximum of 1394 outstanding requests is allowed
---------------------------------------------------
I will convert your old device /dev/md1 of 6102335 blocks
to a new device /dev/md1 of same size
using a block-size of 64 KB
Is this what you want? (yes/no): no

-
To unsubscribe from this list: send the line "unsubscribe linux-raid" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

author
#2 lore raw

I bit my tongue and tried doing a "mkraid -f /dev/md1" after ensuring that my raidtab had the correct order of disks. The raid array did successfully resize without any loss of data, and began to resync. My current status is:

cat /proc/mdstat

md1 : active raid5 hdc1[2] md0[1] hdg1[0]

      390382208 blocks level 5, 64k chunk, algorithm 0 [3/3] [UUU]
      [>....................]  resync =  3.7% (7268880/195191104)
finish=6181.6min speed=504K/sec
md0 : active linear hda3[2] hdi1[1] hdk1[0]
      195191168 blocks 128k rounding

Summary: I had a RAID 5 array that did not take up all available disk space on the drives. I stopped the raid array, ensured that my raidtab was up to date, and ran mkraid -f on the array. This overwrote the old array's superblocks and created a new array on top of the old one that took up the maximum available space and preserved the contents of the old array.

The output from raidreconf is very odd to me too. The size of the array is incorrect. The size of the disks look pretty close, though. Here's the output after I resized the array. Before I did it, everything was the same except that the array was only approx 345102528 blocks.

root@darkstar:/home# fdisk -l /dev/hdg

Disk /dev/hdg: 200.0 GB, 200049647616 bytes
255 heads, 63 sectors/track, 24321 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot    Start       End    Blocks   Id  System
/dev/hdg1             1     24321 195358401   83  Linux
root@darkstar:/home# fdisk -l /dev/hdc

Disk /dev/hdc: 200.0 GB, 200049647616 bytes
255 heads, 63 sectors/track, 24321 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot    Start       End    Blocks   Id  System
/dev/hdc1             1     24321 195358401   fd  Linux raid autodetect
root@darkstar:/home# fdisk -l /dev/hdk

Disk /dev/hdk: 120.0 GB, 120034123776 bytes
255 heads, 63 sectors/track, 14593 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

   Device Boot    Start       End    Blocks   Id  System
/dev/hdk1             1     14593 117218241   83  Linux
root@darkstar:/home# fdisk -l /dev/hdi

Disk /dev/hdi: 46.1 GB, 46115758080 bytes
16 heads, 63 sectors/track, 89355 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes

   Device Boot    Start       End    Blocks   Id  System
/dev/hdi1             1     89355  45034888+  83  Linux
root@darkstar:/home# fdisk -l /dev/hda

Disk /dev/hda: 40.0 GB, 40020664320 bytes
16 heads, 63 sectors/track, 77545 cylinders
Units = cylinders of 1008 * 512 = 516096 bytes

   Device Boot    Start       End    Blocks   Id  System
/dev/hda1             1     10159   5120104+  83  Linux
/dev/hda2         10160     12191   1024128   82  Linux swap
/dev/hda3         12192     77545  32938416   83  Linux
root@darkstar:/home# mdadm -D /dev/md0
/dev/md0:
        Version : 00.90.00
  Creation Time : Sat May 15 13:07:11 2004
     Raid Level : linear
     Array Size : 195191168 (186.15 GiB 199.88 GB)
   Raid Devices : 3
  Total Devices : 3
Preferred Minor : 0
    Persistence : Superblock is persistent

Update Time : Sat May 15 13:07:11 2004
State : dirty, no-errors
Active Devices : 3
Working Devices : 3
Failed Devices : 0
Spare Devices : 0

Rounding : 128K

Number Major Minor RaidDevice State
0 57 1 0 active sync /dev/hdk1
1 56 1 1 active sync /dev/hdi1
2 3 3 2 active sync /dev/hda3
UUID : f9f7071e:b673fea6:ff12b406:9bb0576a
Events : 0.1

root@darkstar:/home# mdadm -D /dev/md1
/dev/md1:
        Version : 00.90.00
  Creation Time : Mon May 17 11:19:55 2004
     Raid Level : raid5
     Array Size : 390382208 (372.30 GiB 399.75 GB)
    Device Size : 195191104 (186.15 GiB 199.88 GB)
   Raid Devices : 3
  Total Devices : 3
Preferred Minor : 1
    Persistence : Superblock is persistent

Update Time : Mon May 17 11:19:55 2004
State : dirty, no-errors
Active Devices : 3
Working Devices : 3
Failed Devices : 0
Spare Devices : 0

Layout : left-asymmetric
Chunk Size : 64K

Rebuild Status : 5% complete

Number Major Minor RaidDevice State
0 34 1 0 active sync /dev/hdg1
1 9 0 1 active sync /dev/md0
2 22 1 2 active sync /dev/hdc1
UUID : 5cf50002:0bcbc32e:07694ae5:d5735f48
Events : 0.1

----- Original Message -----
From: Guy
To: 'TJ Harrell' ; [email protected]
Sent: Monday, May 17, 2004 4:28 PM
Subject: RE: raidreconf won't resize a RAID 5 array. Can it be done with mkraid -f ?

I don't understand the size of your array!
If you have 3 disks about 200G each, your RAID5 array should be about 400G. But your array is 1171815940 blocks! That's 1171G, about 3 times larger than it should be.

Just to verify the size of the disks and the array, do these commands:
fdisk -l /dev/hdg
fdisk -l /dev/hdc
fdisk -l /dev/hdk
fdisk -l /dev/hdi
fdisk -l /dev/hda
cat /proc/mdstat
mdadm -D /dev/md0
mdadm -D /dev/md1

Guy