Re: [PATCH 018 of 29] md: Support changing rdev size on running arrays.

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hello,

Am 31.03.2010 um 07:41 Uhr schrieb Neil Brown <neilb@xxxxxxx>:
> On Tue, 30 Mar 2010 16:52:13 +0200
> Markus Hochholdinger <Markus@xxxxxxxxxxxxxxxxx> wrote:
> > Am 28.06.2008 um 01:41 Uhr schrieb Neil Brown <neilb@xxxxxxx>:
> > > On Friday June 27, Markus@xxxxxxxxxxxxxxxxx wrote:
> > > > Am Freitag, 27. Juni 2008 08:51 schrieb NeilBrown:
> > > > > From: Chris Webb <chris@xxxxxxxxxxxx>
[..]
> > Then I change the size of xvda1 and get the following kernel message:
> > [ 3281.905317] Setting capacity to 4194304
> > [ 3281.905317] xvda1: detected capacity change from 1073741824 to
> > 2147483648
> > After this i do:
> > echo "0" > /sys/block/md1/md/rd0/size
> > No kernel message so far and
> >   cat /sys/block/md1/md/rd0/size
> > still shows 1048570.
> That is very odd.  The number printed out in the "detected capacity change"
> line is exactly the name that should be used when you write to
> "md/rd0/size".

it's good to hear this isn't normal, so the error must be on my side.

OK, from the beginning:
# dd if=/dev/zero of=/dev/xvda1 bs=16M
# dd if=/dev/zero of=/dev/xvdb1 bs=16M
# blockdev --getsz /dev/xvda1
4194304
# blockdev --getsz /dev/xvdb1
4194304
# 
mdadm --create /dev/md1 --raid-disks=2 --level=1 --metadata=0.9 /dev/xvda1 /dev/xvdb1
[  715.153257] md: bind<xvda1>
[  715.156154] md: bind<xvdb1>
[  715.192298] raid1: md1 is not clean -- starting background reconstruction
[  715.192298] raid1: raid set md1 active with 2 out of 2 mirrors
[  715.192320] md1: detected capacity change from 0 to 2147418112
mdadm: array /dev/md1 started.
[  715.197762]  md1: unknown partition table

=> resize xvda1 to 3GB

Here i need to say that the new size will show up until someone asks for the 
new size! I've done this with "fdisk -l". But now i see:
# blockdev --getsz /dev/xvda1
4194304
# fdisk -l /dev/xvda1
[  867.124950] Setting capacity to 6291456
[  867.124950] xvda1: detected capacity change from 2147483648 to 3221225472

Disk /dev/xvda1: 3221 MB, 3221225472 bytes
255 heads, 63 sectors/track, 391 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000000

Disk /dev/xvda1 doesn't contain a valid partition table
# blockdev --getsz /dev/xvda1
6291456


For me it seems the "blockdev --getsz" was cached somehow.


> You could try
>    strace echo 0 > /sys/block/md1/md/rd0/size
# strace echo 0 > /sys/block/md1/md/rd0/size
execve("/bin/echo", ["echo", "0"], [/* 26 vars */]) = 0
brk(0)                                  = 0x2352000
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 
0x7f5b648c8000
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or 
directory)
mmap(NULL, 8192, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 
0x7f5b648c6000
access("/etc/ld.so.preload", R_OK)      = -1 ENOENT (No such file or 
directory)
open("/etc/ld.so.cache", O_RDONLY)      = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=15141, ...}) = 0
mmap(NULL, 15141, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f5b648c2000
close(3)                                = 0
access("/etc/ld.so.nohwcap", F_OK)      = -1 ENOENT (No such file or 
directory)
open("/lib/libc.so.6", O_RDONLY)        = 3
read(3, "\177ELF\2\1\1\0\0\0\0\0\0\0\0\0\3\0>\0\1\0\0\0\320\353\1\0\0\0\0\0"..., 
832) = 832
fstat(3, {st_mode=S_IFREG|0755, st_size=1379752, ...}) = 0
mmap(NULL, 3487784, PROT_READ|PROT_EXEC, MAP_PRIVATE|MAP_DENYWRITE, 3, 0) = 
0x7f5b64359000
mprotect(0x7f5b644a3000, 2097152, PROT_NONE) = 0
mmap(0x7f5b646a3000, 20480, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|
MAP_DENYWRITE, 3, 0x14a000) = 0x7f5b646a3000
mmap(0x7f5b646a8000, 18472, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_FIXED|
MAP_ANONYMOUS, -1, 0) = 0x7f5b646a8000
close(3)                                = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 
0x7f5b648c1000
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 
0x7f5b648c0000
arch_prctl(ARCH_SET_FS, 0x7f5b648c06f0) = 0
mprotect(0x7f5b646a3000, 16384, PROT_READ) = 0
mprotect(0x7f5b648c9000, 4096, PROT_READ) = 0
munmap(0x7f5b648c2000, 15141)           = 0
brk(0)                                  = 0x2352000
brk(0x2373000)                          = 0x2373000
open("/usr/lib/locale/locale-archive", O_RDONLY) = 3
fstat(3, {st_mode=S_IFREG|0644, st_size=3519008, ...}) = 0
mmap(NULL, 3519008, PROT_READ, MAP_PRIVATE, 3, 0) = 0x7f5b63ffd000
close(3)                                = 0
fstat(1, {st_mode=S_IFREG|0644, st_size=4096, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 
0x7f5b648c5000
write(1, "0\n", 2)                      = -1 EINVAL (Invalid argument)
close(1)                                = 0
munmap(0x7f5b648c5000, 4096)            = 0
open("/usr/share/locale/locale.alias", O_RDONLY) = 1
fstat(1, {st_mode=S_IFREG|0644, st_size=2570, ...}) = 0
mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 
0x7f5b648c5000
read(1, "# Locale name alias data base.\n#"..., 4096) = 2570
read(1, "", 4096)                       = 0
close(1)                                = 0
munmap(0x7f5b648c5000, 4096)            = 0
open("/usr/share/locale/en_US.utf8/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 
ENOENT (No such file or directory)
open("/usr/share/locale/en_US/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT 
(No such file or directory)
open("/usr/share/locale/en.utf8/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 
ENOENT (No such file or directory)
open("/usr/share/locale/en/LC_MESSAGES/coreutils.mo", O_RDONLY) = -1 ENOENT 
(No such file or directory)
write(2, "echo: ", 6echo: )                   = 6
write(2, "write error", 11write error)             = 11
open("/usr/share/locale/en_US.utf8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT 
(No such file or directory)
open("/usr/share/locale/en_US/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No 
such file or directory)
open("/usr/share/locale/en.utf8/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT 
(No such file or directory)
open("/usr/share/locale/en/LC_MESSAGES/libc.mo", O_RDONLY) = -1 ENOENT (No 
such file or directory)
write(2, ": Invalid argument", 18: Invalid argument)      = 18
write(2, "\n", 1
)                       = 1
exit_group(1)                           = ?
# echo $?
1
# cat /sys/block/md1/md/rd0/size 
2097088


> to be sure there is no error return.

Hm, there seems to be some error, but i don't get it what it is.


> And maybe
>    blockdev --getsz /dev/xvda1

# blockdev --getsz /dev/xvda1
6291456


> and
>    blockdev --getsz /dev/xvda

There is no xvda! I use Xen and i can assign a logical volume directly to 
xvda1, so i don't have to put a partition table on this block device! Perhaps 
this is the error!?


> to double check that the block size looks right.

Yeah, the block size looks right.


> Are you sure the message didn't say "xvda: detected capacity change...",
> and you still need to change the size of the partition?

Yes, i'm sure and i used copy&paste, so no write error here. There is no xvda 
because i can assign a logical volume direct to xvda1 inside my virtual xen 
machine.

So i try to use partitions, assigning hole disks (xvdc and xvdd) to md1 
doesn't work also. But with partitions i have the problem that 
after "resizing" the partition, my partition xvdc1 seems to be not grown from 
the view of the linux system:
# blockdev --getsz /dev/xvdc1
2088387
# blockdev --getsz /dev/xvdc
4194304
# fdisk -l /dev/xvdc

Disk /dev/xvdc: 2147 MB, 2147483648 bytes
255 heads, 63 sectors/track, 261 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Disk identifier: 0x00000000

    Device Boot      Start         End      Blocks   Id  System
/dev/xvdc1               1         261     2096451   fd  Linux raid autodetect


Is it possible that this raid1 grow only works with lvm?

Another note to
  echo 0 > /sys/block/md1/md/rd0/size
The first time after a grow it works only once, giving a return code of 0 and 
no error message. And after that it will return:
# echo 0 > /sys/block/md1/md/rd0/size
-bash: echo: write error: Invalid argument
# echo $?
1

Is this supposed to work only once (after a grow)? But also if it has a return 
code of 0 the value of /sys/block/md1/md/rd0/size doesn't change. Still 
puzzled...

Which superblock version should i use for this grow? My live servers all have 
0.9 so i first try this with 0.9. But if you say this will only work with 
1.0, 1.1 or 1.2 i'll try all this with this specific superblock version.

Any further ideas what i can try?

Many thanks in advance.


-- 
greetings

eMHa

Attachment: signature.asc
Description: This is a digitally signed message part.


[Index of Archives]     [Linux RAID Wiki]     [ATA RAID]     [Linux SCSI Target Infrastructure]     [Linux Block]     [Linux IDE]     [Linux SCSI]     [Linux Hams]     [Device Mapper]     [Device Mapper Cryptographics]     [Kernel]     [Linux Admin]     [Linux Net]     [GFS]     [RPM]     [git]     [Yosemite Forum]


  Powered by Linux