How to increase size of RAID1 in Linux !
This summer I had to raise a raid partition from 1 TB to 2 TB.
I found some information, put link down.
This video explain how to increase size:
A good start for information:
https://www.howtoforge.com/how-to-resize-raid-partitions-shrink-and-grow-software-raid-p2
https://raid.wiki.kernel.org/index.php/A_guide_to_mdadm
I will show my steps: Intent Bitmap : Internal Active Devices : 2 Partition /dev/sda3 Disk /dev/sda3: 995.5 GB, 995471917056 bytes Partition /dev/sdb3 Disk /dev/sdb3: 995.5 GB, 995471917056 bytes Fist step: fail one partition and remove, afther this grow partition. Result: md2 : active raid1 sda3[2] md1 : active raid1 sdb2[3] sda2[2] Remove raid block The device presents a logical sector size that is smaller than WARNING: DOS-compatible mode is deprecated. It's strongly recommended to Command (m for help): p Disk /dev/sdb: 2000.4 GB, 2000398934016 bytes Device Boot Start End Blocks Id System Command (m for help): d Command (m for help): p Disk /dev/sdb: 2000.4 GB, 2000398934016 bytes Device Boot Start End Blocks Id System Command (m for help): n Command (m for help): p Disk /dev/sdb: 2000.4 GB, 2000398934016 bytes Device Boot Start End Blocks Id System Command (m for help): t Command (m for help): p Disk /dev/sdb: 2000.4 GB, 2000398934016 bytes Device Boot Start End Blocks Id System Command (m for help): w Calling ioctl() to re-read partition table. Now add new raid device. md2 : active raid1 sda3[2] md1 : active raid1 sdb2[3] sda2[2] [root@dc ~]# mdadm -a /dev/md2 /dev/sdb3 md2 : active raid1 sdb3[3] sda3[2] md1 : active raid1 sdb2[3] sda2[2] We wait until the next day when it ends in sync. Day 2. We do the same with the other hard drive, /dev/sda3 but first we restart! Warning After you change your hard drive and increase partitions you may have problems with grub because it changes the hardships. I will put a short video with my steps în other post !
Details
[root@dc ~]# mdadm --detail /dev/md2
/dev/md2:
Version : 1.1
Creation Time : Wed Jul 16 16:28:06 2014
Raid Level : raid1
Array Size : 972009280 (926.98 GiB 995.34 GB)
Used Dev Size : 972009280 (926.98 GiB 995.34 GB)
Raid Devices : 2
Total Devices : 2
Persistence : Superblock is persistent
Update Time : Wed Jul 19 17:15:01 2017
State : active
Working Devices : 2
Failed Devices : 0
Spare Devices : 0 Name : serverp0.probiting.ro:2
UUID : 20c27ff9:81cb1db1:91f3d123:77844d9c
Events : 82177
Number Major Minor RaidDevice State
3 8 19 0 active sync /dev/sdb3
2 8 3 1 active sync /dev/sda3
<co[root@dc ~]# fdisk -l /dev/sda3
255 heads, 63 sectors/track, 121025 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0xfffefffede>
[root@dc ~]# fdisk -l /dev/sdb3
255 heads, 63 sectors/track, 121025 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0xfffefffe
[root@dc ~]# mdadm --manage /dev/md2 --fail /dev/sdb3
[root@dc ~]# mdadm --manage /dev/md2 --remove /dev/sdb3
[root@dc ~]# cat /proc/mdstat
Personalities : [raid1]
md0 : active raid1 sda1[2] sdb1[3]
524224 blocks super 1.0 [2/2] [UU]
972009280 blocks super 1.1 [2/1] [_U]
bitmap: 5/8 pages [20KB], 65536KB chunk
4093888 blocks super 1.1 [2/2] [UU]
[root@dc ~]# mdadm --zero-superblock /dev/sdb3
Now change size on /dev/sdb3
[root@dc ~]# fdisk /dev/sdb
the physical sector size. Aligning to a physical sector (or optimal
I/O) size boundary is recommended, or performance may be impacted.
switch off the mode (command 'c') and change display units to
sectors (command 'u').
255 heads, 63 sectors/track, 243201 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00000000
/dev/sdb1 * 1 66 524288 fd Linux raid autodetect
Partition 1 does not end on cylinder boundary.
/dev/sdb2 66 576 4096000 fd Linux raid autodetect
Partition 2 does not end on cylinder boundary.
/dev/sdb3 576 121602 972140544 fd Linux raid autodetect
Partition number (1-4): 3
255 heads, 63 sectors/track, 243201 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00000000
/dev/sdb1 * 1 66 524288 fd Linux raid autodetect
Partition 1 does not end on cylinder boundary.
/dev/sdb2 66 576 4096000 fd Linux raid autodetect
Partition 2 does not end on cylinder boundary.
Command action
e extended
p primary partition (1-4)
p
Partition number (1-4): 3
First cylinder (576-243201, default 576):
Using default value 576
Last cylinder, +cylinders or +size{K,M,G} (576-243201, default 243201):
Using default value 243201
255 heads, 63 sectors/track, 243201 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00000000
/dev/sdb1 * 1 66 524288 fd Linux raid autodetect
Partition 1 does not end on cylinder boundary.
/dev/sdb2 66 576 4096000 fd Linux raid autodetect
Partition 2 does not end on cylinder boundary.
/dev/sdb3 576 243201 1948890720+ 83 Linux
Partition number (1-4): 3
Hex code (type L to list codes): fd
Changed system type of partition 3 to fd (Linux raid autodetect)
255 heads, 63 sectors/track, 243201 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 4096 bytes
I/O size (minimum/optimal): 4096 bytes / 4096 bytes
Disk identifier: 0x00000000
/dev/sdb1 * 1 66 524288 fd Linux raid autodetect
Partition 1 does not end on cylinder boundary.
/dev/sdb2 66 576 4096000 fd Linux raid autodetect
Partition 2 does not end on cylinder boundary.
/dev/sdb3 576 243201 1948890720+ fd Linux raid autodetect
The partition table has been altered!
[root@dc ~]# cat /proc/mdstat
Personalities : [raid1]
md0 : active raid1 sda1[2] sdb1[3]
524224 blocks super 1.0 [2/2] [UU]
972009280 blocks super 1.1 [2/1] [_U]
bitmap: 5/8 pages [20KB], 65536KB chunk
4093888 blocks super 1.1 [2/2] [UU]
mdadm: added /dev/sdb3
[root@dc ~]# cat /proc/mdstat
Personalities : [raid1]
md0 : active raid1 sda1[2] sdb1[3]
524224 blocks super 1.0 [2/2] [UU]
972009280 blocks super 1.1 [2/1] [_U]
[>....................] recovery = 0.0% (295168/972009280) finish=109.7min speed=147584K/sec
bitmap: 5/8 pages [20KB], 65536KB chunk
4093888 blocks super 1.1 [2/2] [UU]
@luciancovaci
If you liked it
Upvote and Follow!
Created on 20170918 at 10:52 EET
This post has received a 23.22 % upvote from @boomerang thanks to: @luciancovaci
@boomerang distributes 100% of the SBD and up to 80% of the Curation Rewards to STEEM POWER Delegators. If you want to bid for votes or want to delegate SP please read the @boomerang whitepaper.
Downvoting a post can decrease pending rewards and make it less visible. Common reasons:
Submit