linux 阵列调整,如何使用mdadm调整RAID1阵列的大小?

我运行的是Ubuntu 11.04(内核2.6.38-11).我用2x500GB驱动器替换了2x160GB.它们配置为RAID1.

分区表显示正确的大小.这是sfdisk:

# sfdisk -d /dev/sdb

# partition table of /dev/sdb

unit: sectors

/dev/sdb1 : start= 63, size= 192717, Id=fd, bootable

/dev/sdb2 : start= 192780, size= 7807590, Id=fd

/dev/sdb3 : start= 8000370, size=968767695, Id=fd

/dev/sdb4 : start= 0, size= 0, Id= 0

和fdisk:

# fdisk -l /dev/sdb

Disk /dev/sdb: 500.1 GB, 500107862016 bytes

255 heads, 63 sectors/track, 60801 cylinders

Units = cylinders of 16065 * 512 = 8225280 bytes

Sector size (logical/physical): 512 bytes / 512 bytes

I/O size (minimum/optimal): 512 bytes / 512 bytes

Disk identifier: 0x0006c78f

Device Boot Start End Blocks Id System

/dev/sdb1 * 1 12 96358+ fd Linux raid autodetect

/dev/sdb2 13 498 3903795 fd Linux raid autodetect

/dev/sdb3 499 60801 484383847+ fd Linux raid autodetect

但我没有看到新的空间:

root@green:~# df -h

Filesystem Size Used Avail Use% Mounted on

/dev/md2 143G 134G 8.3G 95% /

root@green:~# mdadm --examine /dev/sdb3

/dev/sdb3:

Magic : a92b4efc

Version : 0.90.00

UUID : b8f83980:f60d820c:74c46fbf:0baa68bc

Creation Time : Sun Mar 29 18:48:46 2009

Raid Level : raid1

Used Dev Size : 152247936 (145.19 GiB 155.90 GB)

Array Size : 152247936 (145.19 GiB 155.90 GB)

Raid Devices : 2

Total Devices : 2

Preferred Minor : 2

Update Time : Mon Oct 10 19:22:36 2011

State : clean

Active Devices : 2

Working Devices : 2

Failed Devices : 0

Spare Devices : 0

Checksum : 7b5debb7 - correct

Events : 10729526

Number Major Minor RaidDevice State

this 0 8 19 0 active sync /dev/sdb3

0 0 8 19 0 active sync /dev/sdb3

1 1 8 3 1 active sync /dev/sda3

我试过mdadm和resize2fs:

# mdadm --grow /dev/md2 --size=max

mdadm: component size of /dev/md2 has been set to 152247936K

# resize2fs /dev/md2

resize2fs 1.41.14 (22-Dec-2010)

The filesystem is already 38061984 blocks long. Nothing to do!

有任何想法吗?

根据请求添加

# cat /proc/mdstat

Personalities : [linear] [multipath] [raid0] [raid1] [raid6] [raid5] [raid4] [raid10]

md2 : active raid1 sdb3[0] sda3[1]

152247936 blocks [2/2] [UU]

md0 : active raid1 sdb1[0] sda1[1]

96256 blocks [2/2] [UU]

md1 : active raid1 sdb2[0] sda2[1]

3903680 blocks [2/2] [UU]

unused devices:

分区

# cat /proc/partitions

major minor #blocks name

8 0 488386584 sda

8 1 96358 sda1

8 2 3903795 sda2

8 3 152248005 sda3

8 16 488386584 sdb

8 17 96358 sdb1

8 18 3903795 sdb2

8 19 152248005 sdb3

9 1 3903680 md1

9 0 96256 md0

9 2 152247936 md2

分手:

# parted

GNU Parted 2.3

Using /dev/sda

Welcome to GNU Parted! Type 'help' to view a list of commands.

(parted) print all

Model: ATA WDC WD5000AAKX-0 (scsi)

Disk /dev/sda: 500GB

Sector size (logical/physical): 512B/512B

Partition Table: msdos

Number Start End Size Type File system Flags

1 32.3kB 98.7MB 98.7MB primary ext3 boot, raid

2 98.7MB 4096MB 3997MB primary linux-swap(v1) raid

3 4096MB 500GB 496GB primary ext3 raid

Model: ATA WDC WD5000AAKS-4 (scsi)

Disk /dev/sdb: 500GB

Sector size (logical/physical): 512B/512B

Partition Table: msdos

Number Start End Size Type File system Flags

1 32.3kB 98.7MB 98.7MB primary ext3 boot, raid

2 98.7MB 4096MB 3997MB primary linux-swap(v1) raid

3 4096MB 500GB 496GB primary ext3 raid

Model: Linux Software RAID Array (md)

Disk /dev/md1: 3997MB

Sector size (logical/physical): 512B/512B

Partition Table: loop

Number Start End Size File system Flags

1 0.00B 3997MB 3997MB linux-swap(v1)

Model: Linux Software RAID Array (md)

Disk /dev/md0: 98.6MB

Sector size (logical/physical): 512B/512B

Partition Table: loop

Number Start End Size File system Flags

1 0.00B 98.6MB 98.6MB ext3

Model: Linux Software RAID Array (md)

Disk /dev/md2: 156GB

Sector size (logical/physical): 512B/512B

Partition Table: loop

Number Start End Size File system Flags

1 0.00B 156GB 156GB ext3

电子邮件评论:

the problem is in metadata, you just need to assemble raid array with

parameter –update devicesize

and after that -G /dev/md? -z max will done job 🙂

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值