I'm working on a 2TB array RAID5 setup (and very slowly making progress I might add with all the oopses and SCSI errors). At least I solved this small problem though. Using Linux-2.4.19-pre2-ac3 and mdadm-0.7 mdadm --detail gives a bogus "Array Size". Also, the "human_size" value is calculated wrong since both "Array Size" and "Device Size" are in 1024 byte units already and not 1000 byte units. /dev/md6: Version : 00.90.00 Creation Time : Sun Mar 10 05:19:28 2002 Raid Level : raid5 Array Size : -197258624 Device Size : 177293184 (169 GiB) Raid Disks : 12 Total Disks : 13 Preferred Minor : 6 Persistance : Superblock is persistant I changed Detail.c to use BLKGETSIZE64 but noticed that this returns a much larger number due to this line in md.c: case BLKGETSIZE64: /* Return device size */ err = md_put_user((u64)md_hd_struct[minor].nr_sects << 9, (u64 *) arg); Why are we multiplying by 512??? Seems unnecessary to me. Anyway -- the following mods (also attached) are necessary for mdadm to print out the correct answer (and it prints out correctly for all of my RAID sets): /dev/md6: Version : 00.90.00 Creation Time : Sun Mar 10 05:19:28 2002 Raid Level : raid5 Array Size : 1950225024 (1904 GiB) Device Size : 177293184 (173 GiB) Raid Disks : 12 Total Disks : 13 Preferred Minor : 6 Persistance : Superblock is persistant *** ../mdadm-0.7.old/mdadm.h Thu Mar 7 18:59:25 2002 --- mdadm.h Sun Mar 10 06:23:31 2002 *************** *** 149,152 **** extern mddev_ident_t conf_get_ident(char *, char*); extern mddev_dev_t conf_get_devs(char *); ! extern char *human_size(long kbytes); --- 149,152 ---- extern mddev_ident_t conf_get_ident(char *, char*); extern mddev_dev_t conf_get_devs(char *); ! extern char *human_size(long long kbytes); *** ../mdadm-0.7.old/Detail.c Thu Mar 7 18:59:29 2002 --- Detail.c Sun Mar 10 07:13:30 2002 *************** *** 81,90 **** if (brief) printf("ARRAY %s level=%s disks=%d", dev, c?c:"-unknown-",array.raid_disks ); else { ! int array_size; ! if (ioctl(fd, BLKGETSIZE, &array_size)) array_size = 0; ! else array_size>>= 1; printf("%s:\n", dev); printf(" Version : %02d.%02d.%02d\n", array.major_version, array.minor_version, array.patch_version); --- 81,91 ---- if (brief) printf("ARRAY %s level=%s disks=%d", dev, c?c:"-unknown-",array.raid_disks ); else { ! typedef unsigned long long u64; ! u64 array_size; ! if (ioctl(fd, BLKGETSIZE64, &array_size)) array_size = 0; ! else array_size >>= 10; printf("%s:\n", dev); printf(" Version : %02d.%02d.%02d\n", array.major_version, array.minor_version, array.patch_version); *************** *** 92,100 **** printf(" Creation Time : %.24s\n", ctime(&atime)); printf(" Raid Level : %s\n", c?c:"-unknown-"); if (array_size) ! printf(" Array Size : %d%s\n", array_size, human_size(array_size)); if (array.level >= 1) ! printf(" Device Size : %d%s\n", array.size, human_size(array.size)); printf(" Raid Disks : %d\n", array.raid_disks); printf(" Total Disks : %d\n", array.nr_disks); printf("Preferred Minor : %d\n", array.md_minor); --- 93,101 ---- printf(" Creation Time : %.24s\n", ctime(&atime)); printf(" Raid Level : %s\n", c?c:"-unknown-"); if (array_size) ! printf(" Array Size : %llu%s\n", array_size, human_size(array_size*1024/1000)); if (array.level >= 1) ! printf(" Device Size : %d%s\n", array.size, human_size((u64)array.size*1024/1000)); printf(" Raid Disks : %d\n", array.raid_disks); printf(" Total Disks : %d\n", array.nr_disks); printf("Preferred Minor : %d\n", array.md_minor); *** ../mdadm-0.7.old/util.c Thu Mar 7 18:57:37 2002 --- util.c Sun Mar 10 06:23:47 2002 *************** *** 425,431 **** return csum; } ! char *human_size(long kbytes) { static char buf[30]; --- 425,431 ---- return csum; } ! char *human_size(long long kbytes) { static char buf[30]; ________________________________________ Michael D. Black Principal Engineer mblack@csihq.com 321-676-2923,x203 http://www.csihq.com Computer Science Innovations http://www.csihq.com/~mike My home page FAX 321-676-2355
*** ../mdadm-0.7.old/mdadm.h Thu Mar 7 18:59:25 2002 --- mdadm.h Sun Mar 10 06:23:31 2002 *************** *** 149,152 **** extern mddev_ident_t conf_get_ident(char *, char*); extern mddev_dev_t conf_get_devs(char *); ! extern char *human_size(long kbytes); --- 149,152 ---- extern mddev_ident_t conf_get_ident(char *, char*); extern mddev_dev_t conf_get_devs(char *); ! extern char *human_size(long long kbytes); *** ../mdadm-0.7.old/Detail.c Thu Mar 7 18:59:29 2002 --- Detail.c Sun Mar 10 07:13:30 2002 *************** *** 81,90 **** if (brief) printf("ARRAY %s level=%s disks=%d", dev, c?c:"-unknown-",array.raid_disks ); else { ! int array_size; ! if (ioctl(fd, BLKGETSIZE, &array_size)) array_size = 0; ! else array_size>>= 1; printf("%s:\n", dev); printf(" Version : %02d.%02d.%02d\n", array.major_version, array.minor_version, array.patch_version); --- 81,91 ---- if (brief) printf("ARRAY %s level=%s disks=%d", dev, c?c:"-unknown-",array.raid_disks ); else { ! typedef unsigned long long u64; ! u64 array_size; ! if (ioctl(fd, BLKGETSIZE64, &array_size)) array_size = 0; ! else array_size >>= 10; printf("%s:\n", dev); printf(" Version : %02d.%02d.%02d\n", array.major_version, array.minor_version, array.patch_version); *************** *** 92,100 **** printf(" Creation Time : %.24s\n", ctime(&atime)); printf(" Raid Level : %s\n", c?c:"-unknown-"); if (array_size) ! printf(" Array Size : %d%s\n", array_size, human_size(array_size)); if (array.level >= 1) ! printf(" Device Size : %d%s\n", array.size, human_size(array.size)); printf(" Raid Disks : %d\n", array.raid_disks); printf(" Total Disks : %d\n", array.nr_disks); printf("Preferred Minor : %d\n", array.md_minor); --- 93,101 ---- printf(" Creation Time : %.24s\n", ctime(&atime)); printf(" Raid Level : %s\n", c?c:"-unknown-"); if (array_size) ! printf(" Array Size : %llu%s\n", array_size, human_size(array_size*1024/1000)); if (array.level >= 1) ! printf(" Device Size : %d%s\n", array.size, human_size((u64)array.size*1024/1000)); printf(" Raid Disks : %d\n", array.raid_disks); printf(" Total Disks : %d\n", array.nr_disks); printf("Preferred Minor : %d\n", array.md_minor); *** ../mdadm-0.7.old/util.c Thu Mar 7 18:57:37 2002 --- util.c Sun Mar 10 06:23:47 2002 *************** *** 425,431 **** return csum; } ! char *human_size(long kbytes) { static char buf[30]; --- 425,431 ---- return csum; } ! char *human_size(long long kbytes) { static char buf[30];