1

My initial raid setup was 2x2TB RAID 1 using mdadm.

I have bought a 3rd 2TB drive in the hopes to upgrade the RAID's total capacity to 4 TB using mdadm.

I have already run the following two commands, but dont see a capacity change:

sudo mdadm --grow /dev/md0 --level=5
sudo mdadm --grow /dev/md0 --add /dev/sdd --raid-devices=3

with the mdadm details :

$ sudo mdadm --detail /dev/md0
[sudo] password for userd: 
/dev/md0:
           Version : 1.2
     Creation Time : Wed Jul  5 19:59:17 2017
        Raid Level : raid5
        Array Size : 1953383488 (1862.89 GiB 2000.26 GB)
     Used Dev Size : 1953383488 (1862.89 GiB 2000.26 GB)
      Raid Devices : 3
     Total Devices : 3
       Persistence : Superblock is persistent

     Intent Bitmap : Internal

       Update Time : Wed May 22 17:58:37 2019
             State : clean, reshaping 
    Active Devices : 3
   Working Devices : 3
    Failed Devices : 0
     Spare Devices : 0

            Layout : left-symmetric
        Chunk Size : 64K

Consistency Policy : bitmap

    Reshape Status : 5% complete
     Delta Devices : 1, (2->3)

              Name : userd:0  (local to host userd)
              UUID : 986fca95:68ef5344:5136f8af:b8d34a03
            Events : 13557

    Number   Major   Minor   RaidDevice State
       0       8        0        0      active sync   /dev/sda
       1       8       16        1      active sync   /dev/sdb
       2       8       48        2      active sync   /dev/sdd

UPDATE : With the reshape now finished, only 2TB of the 4TB is available.

/dev/md0:
           Version : 1.2
     Creation Time : Wed Jul  5 19:59:17 2017
        Raid Level : raid5
        Array Size : 3906766976 (3725.78 GiB 4000.53 GB)
     Used Dev Size : 1953383488 (1862.89 GiB 2000.26 GB)
      Raid Devices : 3
     Total Devices : 3
       Persistence : Superblock is persistent

     Intent Bitmap : Internal

       Update Time : Thu May 23 23:40:16 2019
             State : clean 
    Active Devices : 3
   Working Devices : 3
    Failed Devices : 0
     Spare Devices : 0

            Layout : left-symmetric
        Chunk Size : 64K

Consistency Policy : bitmap

              Name : userd:0  (local to host userd)
              UUID : 986fca95:68ef5344:5136f8af:b8d34a03
            Events : 17502

    Number   Major   Minor   RaidDevice State
       0       8        0        0      active sync   /dev/sda
       1       8       16        1      active sync   /dev/sdb
       2       8       48        2      active sync   /dev/sdd

How can I get mdadm to use all of the 4TB instead of just 2TB?

5

Look at the reshape status:

   Update Time : Wed May 22 17:58:37 2019
         State : clean, reshaping 
...
Reshape Status : 5% complete
 Delta Devices : 1, (2->3)

You won't get any extra storage until it's completed, and the report you've provided shows that it's currently at only 5% complete.

DO NOT interrupt the process or try to change the shape again while this reshape is in progress.

  • Thanks for your answer. Maybe I jumped the gun by asking before it is finished, but I just wanted to be sure. I could not find anything online that clarifies this. – cloudcalvin May 22 '19 at 16:21
  • please see the update. – cloudcalvin May 24 '19 at 7:06
0

According to Gparted, the answer was to do a filesystem check in order to utilize the extra space.

To solve the problem I had to:

  1. unmount the filesystem.
  2. open gparted
  3. select the raid device (in my case /dev/md0)
  4. run check (Partition -> Check)

This successfully resized the md0 partition to use all of the available space.

The exact operation's output from gparted is the following :

GParted 0.33.0 --enable-libparted-dmraid --enable-online-resize

Libparted 3.2
Check and repair file system (ext4) on /dev/md0  00:03:51    ( SUCCESS )

calibrate /dev/md0  00:00:00    ( SUCCESS )

path: /dev/md0 (device)
start: 0
end: 7813533951
size: 7813533952 (3.64 TiB)
check file system on /dev/md0 for errors and (if possible) fix them  00:02:43    ( SUCCESS )

e2fsck -f -y -v -C 0 '/dev/md0'  00:02:43    ( SUCCESS )

Pass 1: Checking inodes, blocks, and sizes
Inode 30829505 extent tree (at level 1) could be shorter. Optimize? yes

Inode 84025620 extent tree (at level 1) could be narrower. Optimize? yes

Inode 84806354 extent tree (at level 2) could be narrower. Optimize? yes

Pass 1E: Optimizing extent trees
Pass 2: Checking directory structure
Pass 3: Checking directory connectivity
/lost+found not found. Create? yes

Pass 4: Checking reference counts
Pass 5: Checking group summary information

StorageArray0: ***** FILE SYSTEM WAS MODIFIED *****

5007693 inodes used (4.10%, out of 122093568)
23336 non-contiguous files (0.5%)
2766 non-contiguous directories (0.1%)
# of inodes with ind/dind/tind blocks: 0/0/0
Extent depth histogram: 4942467/2090/2
458492986 blocks used (93.89%, out of 488345872)
0 bad blocks
52 large files

4328842 regular files
612231 directories
0 character device files
0 block device files
3 fifos
1396 links
66562 symbolic links (63077 fast symbolic links)
45 sockets
------------
5009079 files
e2fsck 1.45.1 (12-May-2019)
grow file system to fill the partition  00:01:08    ( SUCCESS )

resize2fs -p '/dev/md0'  00:01:08    ( SUCCESS )

Resizing the filesystem on /dev/md0 to 976691744 (4k) blocks.
The filesystem on /dev/md0 is now 976691744 (4k) blocks long.

resize2fs 1.45.1 (12-May-2019)

========================================
  • 2
    Well, yes, if you've got a single filesystem on top of that RAID of course you're going to have to tell it to use the new available space (resize2fs). The RAID subsystem knows nothing about the structure of the data stored on it. For all I knew you were running LVM on top of your RAID devices, in which the correct command would have been pvresize. You could even have been using it as a block of raw storage for something like S3. But none of this answers your question, "How can I get mdadm to use all of the 4TB [...]?". – roaima May 24 '19 at 8:55
  • IF you needed more context, you were welcome to ask. I will update the question to be more specific to my context if it improves the quality of the question. – cloudcalvin May 24 '19 at 9:54
  • You asked a perfectly reasonable question. I did my best to answer it for you. However, if your own answer matches your new question better, feel free to accept your own. I'd rather you were happy than pedantic. – roaima May 24 '19 at 10:02

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.