V
V
vlarkanov2018-09-06 11:41:24
linux
vlarkanov, 2018-09-06 11:41:24

How to expand file system on mdadm RAID volume?

Hello!
There is such a RAID1


Personalities : [raid1] [linear] [multipath] [raid0] [raid6] [raid5] [raid4] [raid10]
md0 : active raid1 vda1[2] vdb1[3]
5236736 blocks super 1.2 [2/2] [UU]
unused devices:

From such partitions on such disks:

NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sr0 11:0 1 248M 0 rom
vda 254:0 0 10G 0 disk
└─vda1 254:1 0 5G 0 part
└─md0 9:0 0 5G 0 raid1 /
vdb 254:16 0 10G 0 disk
└─vdb1 254:17 0 5G 0 part
└─md0 9:0 0 5G 0 raid1 /
Disk /dev/vda: 10 GiB, 10737418240 bytes, 20971520 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xe6cdecc3
Device Boot Start End Sectors Size Id Type
/dev/vda1 * 2048 10483711 10481664 5G 83 Linux
Disk /dev/vdb: 10 GiB, 10737418240 bytes, 20971520 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xedf06c71
Device Boot Start End Sectors Size Id Type
/dev/vdb1 * 2048 10483711 10481664 5G fd Linux raid autodetect
Disk /dev/md0: 5 GiB, 5362417664 bytes, 10473472 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes

How to "stretch" the /dev/md0 file system so that it takes up the entire available space of the disks participating in the raid?
Did

mdadm --grow /dev/md0 --size=max
mdadm: component size of /dev/md0 unchanged at 5236736K
- i.e. nothing has changed
Tried to boot into recovery - resize2fs /dev/md0 says Nothing to do.
gparted shows that on /dev/md0 the fs occupies 5 out of 5 available Gb, and does not allow expanding partitions on /dev/vda /dev/vdb (lock icon), only editing flags like boot, etc. is available.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
M
Melkij, 2018-09-06
@vlarkanov

So you have an array and only half of the volume is allocated.
Eject the disk from the array
mdadm /dev/md0 -f /dev/vda
mdadm /dev/md0 -r /dev/vda
repartition the disk to full capacity and add back
mdadm /dev/md0 -a /dev/vda
Watch the synchronization process, when finished repeat with another disk.
However, through parted resizepart it should be possible to expand the partition without resynchronizing the array.
Then
mdadm --grow /dev/md0 --size=max
resize2fs /dev/md0
And the question aside: vda/vdb - usually denote a virtual machine. Are you sure that you need a guest raid at all? Usually a raid on the host system is done.

D
Dmitry, 2018-09-06
@Tabletko

First you need to expand the partitions on which md0 lies or cut new ones and add them to md0.
Then expand md0
And then expand the file system on md0
What's in the output of mdadm --detail /dev/md0?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question