--- dmraid/1.0.0.rc16/configure.in 2009-09-16 04:55:23.000000000 -0400 +++ dmraid.new/1.0.0.rc16/configure.in 2009-09-17 07:25:57.000000000 -0400 @@ -133,8 +133,9 @@ echo $ac_n "checking whether to disable testing with mapped devices""... $ac_c" 1>&6 dnl Disable testing with mapped devices -AC_ARG_ENABLE(testing, [ --disable-testing Disable testing with mapped devices], \ -DMRAID_TEST=no, DMRAID_TEST=yes) +AC_ARG_ENABLE(testing, [ --disable-testing Enable testing with mapped devices], \ +DMRAID_TEST=$enableval, DMRAID_TEST=yes) + echo "$ac_t""$DEBUG" 1>&6 @@ -165,6 +166,10 @@ CFLAGS="$CFLAGS -DDMRAID_LED" fi +if test x$DMRAID_TEST = xyes; then + CFLAGS="$CFLAGS -DDMRAID_TEST" +fi + if test x$DMRAID_INTEL_LED = xyes; then CFLAGS="$CFLAGS -DDMRAID_LED -DDMRAID_INTEL_LED" fi @@ -229,7 +234,6 @@ AC_SUBST(CLDFLAGS) AC_SUBST(DEBUG) AC_SUBST(DEBUG_MALLOC) -AC_SUBST(DMRAID_TEST) AC_SUBST(DMRAID_VERSION) AC_SUBST(DMRAID_LIB_VERSION) AC_SUBST(DIETLIBC) --- dmraid/1.0.0.rc16/dmraid.spec 2009-09-16 05:20:21.000000000 -0400 +++ dmraid.new/1.0.0.rc16/dmraid.spec 2010-03-16 14:22:37.000000000 -0400 @@ -1,5 +1,5 @@ # -# Copyright (C) Heinz Mauelshagen, 2004-2009 Red Hat GmbH. All rights reserved. +# Copyright (C) Heinz Mauelshagen, 2004-2010 Red Hat GmbH. All rights reserved. # # See file LICENSE at the top of this source tree for license information. # @@ -7,15 +7,20 @@ Summary: dmraid (Device-mapper RAID tool and library) Name: dmraid Version: 1.0.0.rc16 -Release: 1%{?dist} +Release: 5%{?dist} License: GPLv2+ Group: System Environment/Base URL: http://people.redhat.com/heinzm/sw/dmraid -BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-buildroot -BuildRequires: device-mapper >= 1.02.02-2, libselinux-devel, libsepol-devel -Requires: dmraid-events kpartx -Requires(postun): ldconfig -Requires(post): ldconfig +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) +BuildRequires: device-mapper-devel >= 1.02.02-2 +BuildRequires: device-mapper-event-devel +BuildRequires: libselinux-devel +BuildRequires: libsepol-devel +Requires: device-mapper >= 1.02.02-2 +Requires: dmraid-events +Requires: kpartx +Obsoletes: dmraid-libs < %{version}-%{release} +Provides: dmraid-libs = %{version}-%{release} Source: ftp://people.redhat.com/heinzm/sw/dmraid/src/%{name}-%{version}.tar.bz2 %description @@ -26,9 +31,7 @@ %package -n dmraid-devel Summary: Development libraries and headers for dmraid. Group: Development/Libraries -License: GPLv2+ -Requires: %{name} = %{version}-%{release} -Requires: %{name}-libs = %{version}-%{release} +Requires: dmraid = %{version}-%{release}, sgpio %description -n dmraid-devel dmraid-devel provides a library interface for RAID device discovery, @@ -38,6 +41,7 @@ Summary: dmevent_tool (Device-mapper event tool) and DSO Group: System Environment/Base Requires: dmraid = %{version}-%{release}, sgpio +Requires: device-mapper-event %description -n dmraid-events Provides a dmeventd DSO and the dmevent_tool to register devices with it @@ -59,38 +63,28 @@ %setup -q -n dmraid/%{version} %build -%configure --prefix=${RPM_BUILD_ROOT}/usr --sbindir=${RPM_BUILD_ROOT}/sbin --libdir=${RPM_BUILD_ROOT}/%{_libdir} --mandir=${RPM_BUILD_ROOT}/%{_mandir} --includedir=${RPM_BUILD_ROOT}/%{_includedir} --enable-debug --enable-libselinux --enable-libsepol --enable-static_link --enable-led --enable-intel_led -make DESTDIR=$RPM_BUILD_ROOT -mv tools/dmraid tools/dmraid.static -make clean -%configure --prefix=${RPM_BUILD_ROOT}/usr --sbindir=${RPM_BUILD_ROOT}/sbin --libdir=${RPM_BUILD_ROOT}/%{_libdir} --mandir=${RPM_BUILD_ROOT}/%{_mandir} --includedir=${RPM_BUILD_ROOT}/%{_includedir} --enable-debug --enable-libselinux --enable-libsepol --disable-static_linko --enable-led --enable-intel_led -make DESTDIR=$RPM_BUILD_ROOT +%define _libdir /%{_lib} + +%configure --prefix=/usr --sbindir=/sbin --libdir=%{_libdir} --mandir=%{_mandir} --includedir=%{_includedir} --enable-debug --enable-libselinux --enable-libsepol --disable-static_link --enable-led --enable-intel_led +make %install rm -rf $RPM_BUILD_ROOT -install -m 755 -d $RPM_BUILD_ROOT{%{_libdir},/sbin,%{_sbindir},%{_bindir},%{_libdir},%{_includedir}/dmraid/,/var/lock/dmraid,/etc/cron.d/,/etc/logwatch/conf/services/,/etc/logwatch/scripts/services/} +install -m 755 -d $RPM_BUILD_ROOT{%{_libdir},/sbin,%{_sbindir},%{_bindir},%{_libdir},%{_includedir}/dmraid/,/var/lock/dmraid,/etc/cron.d/,/etc/logwatch/conf/services/,/etc/logwatch/scripts/services/,/var/cache/logwatch/dmeventd/} make DESTDIR=$RPM_BUILD_ROOT install - -# Install static dmraid binary -install -m 755 tools/dmraid.static $RPM_BUILD_ROOT/sbin/dmraid.static +ln -s dmraid $RPM_BUILD_ROOT/sbin/dmraid.static # Provide convenience link from dmevent_tool (cd $RPM_BUILD_ROOT/sbin ; ln -f dmevent_tool dm_dso_reg_tool) -install -m 644 include/dmraid/*.h $RPM_BUILD_ROOT%{_includedir}/dmraid/ +(cd $RPM_BUILD_ROOT/%{_mandir}/man8 ; ln -f dmevent_tool.8 dm_dso_reg_tool.8 ; ln -f dmraid.8 dmraid.static.8) -# If requested, install the libdmraid and libdmraid-events (for dmeventd) DSO -install -m 755 lib/libdmraid.so \ - $RPM_BUILD_ROOT%{_libdir}/libdmraid.so.%{version} -(cd $RPM_BUILD_ROOT/%{_libdir} ; ln -sf libdmraid.so.%{version} libdmraid.so) -install -m 755 lib/libdmraid-events-isw.so \ - $RPM_BUILD_ROOT%{_libdir}/libdmraid-events-isw.so.%{version} -(cd $RPM_BUILD_ROOT/%{_libdir} ; ln -sf libdmraid-events-isw.so.%{version} libdmraid-events-isw.so) +install -m 644 include/dmraid/*.h $RPM_BUILD_ROOT/%{_includedir}/dmraid/ # Install logwatch config file and script for dmeventd install -m 644 logwatch/dmeventd.conf $RPM_BUILD_ROOT/etc/logwatch/conf/services/dmeventd.conf install -m 755 logwatch/dmeventd $RPM_BUILD_ROOT/etc/logwatch/scripts/services/dmeventd install -m 644 logwatch/dmeventd_cronjob.txt $RPM_BUILD_ROOT/etc/cron.d/dmeventd-logwatch -install -m 0700 /dev/null $RPM_BUILD_ROOT/etc/logwatch/scripts/services/dmeventd_syslogpattern.txt +install -m 0700 /dev/null $RPM_BUILD_ROOT/var/cache/logwatch/dmeventd/syslogpattern.txt rm -f $RPM_BUILD_ROOT/%{_libdir}/libdmraid.a @@ -119,6 +113,7 @@ %files -n dmraid-events %defattr(-,root,root) /%{_mandir}/man8/dmevent_tool* +/%{_mandir}/man8/dm_dso_reg_tool* /sbin/dmevent_tool /sbin/dm_dso_reg_tool @@ -126,63 +121,84 @@ %defattr(-,root,root) %config(noreplace) /etc/logwatch/* %config(noreplace) /etc/cron.d/dmeventd-logwatch -%ghost /etc/logwatch/scripts/services/dmeventd_syslogpattern.txt +%dir /var/cache/logwatch/dmeventd +%ghost /var/cache/logwatch/dmeventd/syslogpattern.txt %changelog -* Thu Sep 16 2009 Heinz Mauelshagen - 1.0.0.rc16 -- Update to version 1.0.0.rc16 - -* Fri Apr 17 2009 Hans de Goede - 1.0.0.rc15-7 -- Fix activation of isw raid sets when the disks have serialnumber longer - then 16 characters (#490121) - -* Tue Feb 24 2009 Fedora Release Engineering - 1.0.0.rc15-6 -- Rebuilt for https://fedoraproject.org/wiki/Fedora_11_Mass_Rebuild - -* Fri Feb 13 2009 Hans de Goede - 1.0.0.rc15-5 -- Make --rm_partitions work with older kernels which return EINVAL when trying - to remove a partition with a number > 16 -- Document --rm_partitions in the man page - -* Thu Feb 12 2009 Hans de Goede - 1.0.0.rc15-4 -- Add patch adding --rm_partitions cmdline option and functionality (#484845) - -* Thu Feb 5 2009 Hans de Goede - 1.0.0.rc15-3 -- Fix mismatch between BIOS and dmraid's view of ISW raid 10 sets - -* Tue Nov 18 2008 Bill Nottingham - 1.0.0.rc15-2 -- Re-add upstream whitespace removal patch (#468649, #470634) - -* Thu Sep 25 2008 Heinz Mauelshagen - 1.0.0.rc15-1 -- Update to version 1.0.0.rc15 - -* Thu Jul 03 2008 Alasdair Kergon - 1.0.0.rc14-8 -- Move library into libs subpackage. -- Fix summary and licence tags. -- Replace static build with symlink. - -* Tue Feb 19 2008 Fedora Release Engineering - 1.0.0.rc14-7 -- Autorebuild for GCC 4.3 - -* Wed Nov 21 2007 Ian Kent - 1.0.0.rc14-6 -- Bug 379911: dmraid needs to generate UUIDs for lib device-mapper +* Tue Jan 12 2010 Heinz Mauelshagen - 1.0.0.rc16-5 +- Support DESTDIR in all Makefiles +- Fix handling spares in RAID names in vendor metadata + +* Tue Jan 12 2010 Heinz Mauelshagen - 1.0.0.rc16-4 +- Change dmraid DSO version to "1" and allow for display of + extended internal library version + +* Tue Jan 12 2010 Heinz Mauelshagen - 1.0.0.rc16-3 +- Add logwatch files and move pattern file to /var/cache +- Fix multiple options (eg. "-ccc") not recognized properly + +* Mon Nov 2 2009 Heinz Mauelshagen - 1.0.0.rc16-2 +- Fix manual path in specfile +- fix manual pages for dmraid.static and dm_dso_reg_tool +- ddf1 metadata format handler LSI persistent name fix +- fix pdc metadata format handler to report the correct number + of devices in a RAID10 subset +- move libraries to /lib* in order to avoid catch22 + with unmountable /usr + +* Wed Oct 09 2008 Heinz Mauelshagen - 1.0.0.rc16-1 +- Updated + +* Wed Sep 17 2008 Heinz Mauelshagen - 1.0.0.rc15 +- Added support for RAID set create/delete/rebuild and event handling + (Intel contributions) +- Resolves: rhbz#437169 rhbz#437173 rhbz#437177 rhbz#439088 + +* Fri Feb 08 2008 Ian Kent - 1.0.0.rc15 +- Bug 427550: dmraid segfaults on boot resulting in broken mirror + - patch to fix SEGV when requesting activation of invalid raid set. + the feature. + Related: rhbz#427550 + +* Wed Feb 06 2008 Peter Jones - 1.0.0.rc13-8 +- Revert fix for 381501, since the RHEL kernel doesn't currently support + the feature. + Related: rhbz#381501 + +* Fri Jan 18 2008 Ian Kent - 1.0.0.rc13-7 +- fix incorrectly applied patch in spec file. +- Related: rhbz#236891 + +* Wed Nov 21 2007 Ian Kent - 1.0.0.rc13-6 +- Bug 381511: dmraid needs to generate UUIDs for lib device-mapper + - add patch to set UUID. - add "DMRAID-" prefix to dmraid UUID string. +- Bug 381501: dmraid needs to activate device-mapper mirror resynchronization error handling +- Resolves: rhbz#381511 rhbz#381501 -* Wed Nov 14 2007 Ian Kent - 1.0.0.rc14-5 -- Bug 379911: dmraid needs to generate UUIDs for lib device-mapper -- Bug 379951: dmraid needs to activate device-mapper mirror resynchronization error handling - -* Mon Oct 22 2007 Ian Kent - 1.0.0.rc14-4 -- Fix SEGV on "dmraid -r -E" (bz 236891). - -* Wed Apr 18 2007 Peter Jones - 1.0.0.rc14-3 -- Fix jmicron name parsing (#219058) - -* Mon Feb 05 2007 Alasdair Kergon - 1.0.0.rc14-2 -- Add build dependency on new device-mapper-devel package. -- Add dependency on device-mapper. -- Add post and postun ldconfig. -- Update BuildRoot and Summary. +* Fri Nov 2 2007 Ian Kent - 1.0.0.rc13-5 +- Fix SEGV on "dmraid -r -E" (bz 236891) +- Resolves: rhbz#236891 + +* Mon Sep 10 2007 Heinz Mauelshagen - 1.0.0.rc13-4 +- Adjusted %dist to rebuild +- Resolves: #211012 + +* Mon Sep 10 2007 Heinz Mauelshagen - 1.0.0.rc13-4 +- Missed a bug with dm map names +- Resolves: #211012 + +* Tue Jun 26 2007 Heinz Mauelshagen - 1.0.0.rc13-3 +- Fix dmraid map names +- Resolves: #211012 +- Fix unaligned access messages + Resolves: #210361, #211150 +- Fix jmicron name parsing (bz#219058) + +* Wed Nov 8 2006 Peter Jones - 1.0.0.rc13-2 +- We didn't change the API or ABI, so don't change the version number + because it'll change the SONAME, which means we have to needlessly rebuild + other packages. * Wed Nov 08 2006 Heinz Mauelshagen - 1.0.0.rc14-1 - asr.c: fixed Adaptec HostRAID DDF1 metadata discovery (bz#211016) --- dmraid/1.0.0.rc16/include/dmraid/lib_context.h 2009-09-16 04:55:23.000000000 -0400 +++ dmraid.new/1.0.0.rc16/include/dmraid/lib_context.h 2010-03-18 09:10:42.000000000 -0400 @@ -46,7 +46,8 @@ LC_CREATE, LC_REBUILD_SET, LC_REBUILD_DISK, - LC_HOT_SPARE_SET, /* Add new options below this one ! */ + LC_HOT_SPARE_SET, + LC_IGNOREMONITORING, /* Add new options below this one ! */ LC_OPTIONS_SIZE, /* Must be the last enumerator. */ }; @@ -65,8 +66,9 @@ #define OPT_VERBOSE(lc) (lc_opt(lc, LC_VERBOSE)) #define OPT_PARTCHAR(lc) (lc_opt(lc, LC_PARTCHAR)) #define OPT_CREATE(lc) (lc_opt(lc, LC_CREATE)) -#define OPT_HOT_SPARE_SET(lc) (lc_opt(lc, LC_HOT_SPARE_SET)) #define OPT_REBUILD_DISK(lc) (lc_opt(lc, LC_REBUILD_DISK)) +#define OPT_HOT_SPARE_SET(lc) (lc_opt(lc, LC_HOT_SPARE_SET)) +#define OPT_IGNOREMONITORING(lc) (lc_opt(lc, LC_IGNOREMONITORING)) /* Return option value. */ #define OPT_STR(lc, o) (lc->options[o].arg.str) @@ -170,6 +172,9 @@ #endif RMPARTITIONS = 0x40000000, +#ifndef DMRAID_MINI + IGNOREMONITORING = 0x80000000, +#endif }; /* Arguments allowed ? */ --- dmraid/1.0.0.rc16/include/dmraid/misc.h 2009-09-16 04:55:23.000000000 -0400 +++ dmraid.new/1.0.0.rc16/include/dmraid/misc.h 2010-03-12 06:33:01.000000000 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2005 Heinz Mauelshagen, Red Hat GmbH. + * Copyright (C) 2004-2010 Heinz Mauelshagen, Red Hat GmbH. * All rights reserved. * * Copyright (C) 2007 Intel Corporation. All rights reserved. @@ -18,6 +18,7 @@ extern void sysfs_workaround(struct lib_context *lc); extern void mk_alpha(struct lib_context *lc, char *str, size_t len); +extern void mk_alphanum(struct lib_context *lc, char *str, size_t len); extern char *get_basename(struct lib_context *lc, char *str); extern char *get_dirname(struct lib_context *lc, char *str); extern char *remove_white_space(struct lib_context *lc, char *str, size_t len); --- dmraid/1.0.0.rc16/include/Makefile.in 2009-09-16 04:55:23.000000000 -0400 +++ dmraid.new/1.0.0.rc16/include/Makefile.in 2010-03-16 12:02:16.000000000 -0400 @@ -16,15 +16,15 @@ .PHONY: install_dmraid_headers remove_dmraid_headers install_dmraid_headers: $(HEADERS) - @echo "Installing $(HEADERS) in $(includedir)/dmraid" - mkdir -p $(includedir)/dmraid - $(INSTALL) $(STRIP) $(HEADERS) $(includedir)/dmraid + @echo "Installing $(HEADERS) in $(DESTDIR)$(includedir)/dmraid" + mkdir -p $(DESTDIR)$(includedir)/dmraid + $(INSTALL) $(STRIP) $(HEADERS) $(DESTDIR)$(includedir)/dmraid install: install_dmraid_headers remove_dmraid_headers: - @echo "Removing $(HEADERS) from $(includedir)/dmraid" - rm -f $(includedir)/dmraid + @echo "Removing $(HEADERS) from $(DESTDIR)$(includedir)/dmraid" + rm -f $(DESTDIR)$(includedir)/dmraid remove: remove_dmraid_headers --- dmraid/1.0.0.rc16/lib/activate/activate.c 2009-09-16 05:03:57.000000000 -0400 +++ dmraid.new/1.0.0.rc16/lib/activate/activate.c 2010-03-18 09:10:42.000000000 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2008 Heinz Mauelshagen, Red Hat GmbH. + * Copyright (C) 2004-2010 Heinz Mauelshagen, Red Hat GmbH. * All rights reserved. * * Copyright (C) 2007,2009 Intel Corporation. All rights reserved. @@ -845,23 +845,17 @@ enum dm_what { DM_ACTIVATE, DM_REGISTER }; /* Register devices of the RAID set with the dmeventd. */ -#define ALL_EVENTS 0xffffffff +#ifdef DMRAID_AUTOREGISTER static int dm_register_for_event(char *dev_name, char *lib_name) { -#ifdef DMRAID_AUTOREGISTER - dm_register_device(dev_name, lib_name); -#endif - return 1; + return !dm_register_device(dev_name, lib_name); } static int dm_unregister_for_event(char *dev_name, char *lib_name) { -#ifdef DMRAID_AUTOREGISTER - dm_unregister_device(dev_name, lib_name); -#endif - return 1; + return !dm_unregister_device(dev_name, lib_name); } #define LIB_NAME_LENGTH 255 @@ -870,35 +864,34 @@ { int ret = 0; char lib_name[LIB_NAME_LENGTH]; + struct dmraid_format *fmt; if (OPT_TEST(lc)) return 1; - struct dmraid_format *fmt = get_format(rs); - - if (fmt->name != NULL) { - strncpy(lib_name, "libdmraid-events-",LIB_NAME_LENGTH); - strncat(lib_name, fmt->name, LIB_NAME_LENGTH-strlen(fmt->name)-3); - strncat(lib_name, ".so", 3); - - ret = f(rs->name, lib_name); + fmt = get_format(rs); + if (fmt->name) { + snprintf(lib_name, sizeof(lib_name), "libdmraid-events-%s.so", + fmt->name); + ret = f(rs->name, lib_name); } - return ret ? 1 : 0; + return ret; } static int -register_devices(struct lib_context *lc, struct raid_set *rs) +register_device(struct lib_context *lc, struct raid_set *rs) { return do_device(lc, rs, dm_register_for_event); } /* Unregister devices of the RAID set with the dmeventd. */ static int -unregister_devices(struct lib_context *lc, struct raid_set *rs) +unregister_device(struct lib_context *lc, struct raid_set *rs) { return do_device(lc, rs, dm_unregister_for_event); } +#endif /* #ifdef DMRAID_AUTOREGISTER */ /* Reload a single set. */ static int @@ -940,14 +933,6 @@ { struct raid_set *r; - /* FIXME: Does it matter if the set is (in)active? */ -#if 0 - if (!OPT_TEST(lc) && what == DM_ACTIVATE && dm_status(lc, rs)) { - log_print(lc, "RAID set \"%s\" already active", rs->name); - return 1; - } -#endif - /* Recursively walk down the chain of stacked RAID sets */ list_for_each_entry(r, &rs->sets, list) { /* Activate set below this one */ @@ -964,15 +949,21 @@ { int ret = 0; char *table = NULL; + struct dmraid_format *fmt = get_format(rs); if (T_GROUP(rs)) return 1; if (what == DM_REGISTER) - return register_devices(lc, rs); +#ifdef DMRAID_AUTOREGISTER + return (!OPT_IGNOREMONITORING(lc) && fmt->metadata_handler) ? + register_device(lc, rs) : 1; +#else + return 1; +#endif /* Call type handler */ - if ((ret = (handler(rs))->f(lc, &table, rs))) { + if ((ret = handler(rs)->f(lc, &table, rs))) { if (OPT_TEST(lc)) display_table(lc, rs->name, table); else if ((ret = dm_create(lc, rs, table, rs->name))) @@ -1053,9 +1044,16 @@ enum dm_what what) { int ret = 1, status; + struct dmraid_format *fmt = get_format(rs); - if (what == DM_REGISTER) - return unregister_devices(lc, rs); + if (what == DM_REGISTER) { +#ifdef DMRAID_AUTOREGISTER + return (!OPT_IGNOREMONITORING(lc) && fmt->metadata_handler) ? + unregister_device(lc, rs) : 1; +#else + return 1; +#endif + } status = dm_status(lc, rs); if (OPT_TEST(lc)) Only in dmraid/1.0.0.rc16/lib/activate: activate.c.orig --- dmraid/1.0.0.rc16/lib/device/partition.c 2009-09-16 04:55:23.000000000 -0400 +++ dmraid.new/1.0.0.rc16/lib/device/partition.c 2009-12-17 09:29:24.000000000 -0500 @@ -23,20 +23,27 @@ list_for_each_entry(rd, &rs->devs, devs) { int fd = open(rd->di->path, O_RDWR); + if (fd < 0) LOG_ERR(lc, 0, "opening %s: %s\n", rd->di->path, strerror(errno)); /* There is no way to enumerate partitions */ for (part.pno = 1; part.pno <= 256; part.pno++) { - if (ioctl(fd, BLKPG, &io) < 0 && errno != ENXIO && - (part.pno < 16 || errno != EINVAL)) + if (ioctl(fd, BLKPG, &io) < 0 && + errno != ENXIO && + (part.pno < 16 || errno != EINVAL)) { + close(fd); LOG_ERR(lc, 0, "removing part %d from %s: %s\n", part.pno, rd->di->path, strerror(errno)); + } } + + close(fd); } + return 1; } --- dmraid/1.0.0.rc16/lib/device/scan.c 2009-09-16 04:55:23.000000000 -0400 +++ dmraid.new/1.0.0.rc16/lib/device/scan.c 2009-09-17 07:25:57.000000000 -0400 @@ -87,7 +87,7 @@ struct stat s; return !lstat(path, &s) && - S_ISLNK(s.st_mode) && +/* S_ISLNK(s.st_mode) && */ /* No symlinks any more. */ !strncmp(get_basename(lc, path), "dm-", 3); } --- dmraid/1.0.0.rc16/lib/events/libdmraid-events-isw.c 2009-09-16 04:55:23.000000000 -0400 +++ dmraid.new/1.0.0.rc16/lib/events/libdmraid-events-isw.c 2010-03-16 11:33:50.000000000 -0400 @@ -27,20 +27,8 @@ */ /* - * FIXME before releasing in RHEL5 (Heinz Mauelshagen): - * - * o symbols naming consistency - * - * Likely after 5.3: - * o integrate code with dmraid package - * o support metadata updates - * o use libsysfs rather than duplicated code to access sysfs - * o remove any limitations to SATA, because dmraid must be device agnostic; - * ie. the devices being registered with dmeventd have to be derived from - * libdmraid metadata discovery; this essentially means a rewrite! - * * FIXED: - * o stremaline event processing functions + * o streamline event processing functions * o register/event processing major:minor usage concept * o cover error paths * o locking race vs. registration in event processing @@ -101,13 +89,11 @@ static const char *default_dmraid_events_lib = "libdmraid-events.so"; static const char *sys_dm_dm = "dm-"; static const char *sys_block_path = "/sys/block/"; -static const char *sys_dm_path = "/sys/block/dm-"; static const char *sys_scsi_path = "/sys/class/scsi_device/"; static const char *sys_slaves_dir = "/slaves"; static const char *sys_scsi_dev_blk = "/device/block"; static const char sys_scsi_dev_blk_delims[] = { '/', ':' }; static const char *sys_dev_dir = "/dev"; -static const char *syslog_ident = "libdmraid-events"; /* Logging. */ enum log_type { LOG_NAMES, LOG_PORTS, LOG_OPEN_FAILURE, LOG_NONE }; @@ -729,7 +715,7 @@ _dso_perform(lc, lib_argv + lib_argc, action); if (!ret && - action == GET_MEMBERS) + action == GET_MEMBERS) ret = _repopulate(device, (char *)OPT_STR(lc, LC_REBUILD_SET)); } @@ -1034,14 +1020,16 @@ break; case REBUILD_END: - if (!_lib_main('F', dev_name) || - !_lib_main('r', dev_name)) + if (!_lib_main('F', dev_name)) { syslog(LOG_NOTICE, "Rebuild of RAID set %s complete", - dev_name); - + dev_name); + _lib_main('r', dev_name); + } + /* Turn all RAID set LEDs off anyway, since it's in-sync.*/ /* Used also for manual rebuild. */ _dev_led_all(DSO_LED_OFF, rs); + break; } return ret; @@ -1068,7 +1056,7 @@ char *params) { int argc, i, num_devs, ret = D_INSYNC; - char **args, *dev_status_str, *p; + char **args = NULL, *dev_status_str, *p; const char *rs_name = dm_task_get_name(dmt); struct dso_raid_set *rs = _find_raid_set(rs_name, NULL, 1); struct dso_raid_dev *dev; @@ -1133,7 +1121,7 @@ { int argc, i, log_argc, num_devs, ret = D_INSYNC; char **args = NULL, *dev_status_str, - *log_status_str, *p, *sync_str; + *log_status_str = NULL, *p, *sync_str; const char *rs_name = dm_task_get_name(dmt); struct dso_raid_set *rs = _find_raid_set(rs_name, NULL, 1); @@ -1515,16 +1503,17 @@ * * Return 1 for success and 0 for failure. */ -int register_device(const char *rs_name, const char *uuid, +int register_device(const char *rs_name_in, const char *uuid, int major, int minor, void **unused __attribute((unused))) { + char *rs_name; struct dso_raid_set *rs, *rs_new; /* FIXME: need to run first to get syslog() to work. */ _check_sgpio(); - rs_name = basename(rs_name); + rs_name = basename((char *) rs_name_in); /* Check for double registration attempt. */ pthread_mutex_lock(&_register_mutex); @@ -1579,13 +1568,14 @@ * * Return 1 for success and 0 for failure. */ -int unregister_device(const char *rs_name, const char *uuid, +int unregister_device(const char *rs_name_in, const char *uuid, int major, int minor, void **unused __attribute((unused))) { + char *rs_name; struct dso_raid_set *prev, *rs; - rs_name = basename(rs_name); + rs_name = basename((char *) rs_name_in); pthread_mutex_lock(&_register_mutex); --- dmraid/1.0.0.rc16/lib/format/ataraid/isw.c 2009-09-16 04:55:23.000000000 -0400 +++ dmraid.new/1.0.0.rc16/lib/format/ataraid/isw.c 2010-03-18 09:10:42.000000000 -0400 @@ -1,7 +1,7 @@ /* * Intel Software RAID metadata format handler. * - * Copyright (C) 2004-2009 Heinz Mauelshagen, Red Hat GmbH. + * Copyright (C) 2004-2010 Heinz Mauelshagen, Red Hat GmbH. * All rights reserved. * * Copyright (C) 2007,2009 Intel Corporation. All rights reserved. @@ -169,6 +169,7 @@ _name(struct lib_context *lc, struct isw *isw, char *str, size_t len, enum name_type nt, int num, struct isw_dev *dev, struct raid_dev *rd) { + int n; struct { const char *fmt, *what; } formats[] = { @@ -189,7 +190,13 @@ f += (is_raid10(dev) ? 1 : 0); } - return snprintf(str, len, f->fmt, isw->family_num, f->what, num); + n = snprintf(str, len, f->fmt, isw->family_num, f->what, num); + + /* As '->volume' could contain anything, we sanitise the name. */ + if (str && n > 0) + mk_alphanum(lc, str, n); + + return n; } static char * Only in dmraid/1.0.0.rc16/lib/format/ataraid: .isw.c.swp --- dmraid/1.0.0.rc16/lib/format/ataraid/jm.c 2009-09-16 18:14:02.000000000 -0400 +++ dmraid.new/1.0.0.rc16/lib/format/ataraid/jm.c 2010-03-18 09:10:42.000000000 -0400 @@ -32,6 +32,7 @@ /* Sanitize name, make sure it's null terminated */ strncpy(buf, name, JM_NAME_LEN); + i = strlen(buf); while (i && isspace(buf[i])) { name[i]='\0'; buf[i]='\0'; Only in dmraid/1.0.0.rc16/lib/format/ataraid: .jm.c.swp --- dmraid/1.0.0.rc16/lib/format/ataraid/pdc.c 2009-09-16 04:55:23.000000000 -0400 +++ dmraid.new/1.0.0.rc16/lib/format/ataraid/pdc.c 2009-12-14 09:33:13.000000000 -0500 @@ -202,8 +202,11 @@ break; /* Memorize main metadata sector. */ - } else if (!info->u32) + } else if (!info->u32) { info->u32 = *s; + *offset = sub ? di->sectors - *s : + *s; + } } } } @@ -490,7 +493,9 @@ if (context && pdc->raid.type != PDC_T_SPAN) *((uint64_t *) context) += rd->sectors; - return pdc->raid.total_disks; + return is_raid10(pdc) ? + pdc->raid.total_disks / 2 : + pdc->raid.total_disks; } static int --- dmraid/1.0.0.rc16/lib/format/ataraid/pdc.h 2009-09-16 04:55:23.000000000 -0400 +++ dmraid.new/1.0.0.rc16/lib/format/ataraid/pdc.h 2010-01-12 07:15:59.000000000 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004,2005 Heinz Mauelshagen, Red Hat GmbH. + * Copyright (C) 2004-2010 Heinz Mauelshagen, Red Hat GmbH. * All rights reserved. * * See file LICENSE at the top of this source tree for license information. @@ -13,7 +13,7 @@ #include -#define PDC_CONFIGOFFSETS 63,255,256,16,399,591,675,735,974,991 +#define PDC_CONFIGOFFSETS 63,255,256,16,399,591,675,735,911,974,991,3087 #define PDC_DATAOFFSET 0 /* --- dmraid/1.0.0.rc16/lib/format/ataraid/sil.c 2009-09-16 04:55:23.000000000 -0400 +++ dmraid.new/1.0.0.rc16/lib/format/ataraid/sil.c 2009-12-01 08:26:04.000000000 -0500 @@ -1,8 +1,8 @@ /* * Silicon Image Medley ATARAID metadata format handler. * - * Copyright (C) 2004,2005 Heinz Mauelshagen, Red Hat GmbH. - * All rights reserved. + * Copyright (C) 2004,2005,2009 Heinz Mauelshagen, Red Hat GmbH. + * All rights reserved. * * See file LICENSE at the top of this source tree for license information. */ @@ -166,6 +166,16 @@ return 1; } +/* Return number of array sectors. */ +static uint64_t +array_size(struct raid_dev *rd) +{ + struct sil *sil = META(rd, sil); + + return (((uint64_t) sil->array_sectors_high) << 32) + + sil->array_sectors_low; +} + static void free_sils(struct sil **sils, unsigned int i) { @@ -381,6 +391,10 @@ struct sil *sil = META(rd, sil); switch (sil->type) { + case SIL_T_JBOD: + ret = array_size(rd) < rd->sectors ? + 1 : sil->drives_per_striped_set; + break; case SIL_T_RAID0: case SIL_T_RAID10: ret = sil->drives_per_striped_set; @@ -519,12 +533,9 @@ static uint64_t sectors(struct raid_dev *rd) { - uint64_t array_sectors, ret = 0; + uint64_t array_sectors = array_size(rd), ret = 0; struct sil *sil = META(rd, sil); - array_sectors = (((uint64_t) sil->array_sectors_high) << 32) + - sil->array_sectors_low; - switch (sil->type) { case SIL_T_SPARE: /* Cook them up... */ --- dmraid/1.0.0.rc16/lib/format/ddf/ddf1.c 2009-09-16 04:55:23.000000000 -0400 +++ dmraid.new/1.0.0.rc16/lib/format/ddf/ddf1.c 2010-03-12 06:33:01.000000000 -0500 @@ -4,7 +4,7 @@ * Copyright (C) 2005-2006 IBM, All rights reserved. * Written by Darrick Wong * - * Copyright (C) 2006-2008 Heinz Mauelshagen, Red Hat GmbH + * Copyright (C) 2006-2010 Heinz Mauelshagen, Red Hat GmbH * All rights reserved. * * See file LICENSE at the top of this source tree for license information. @@ -689,6 +689,9 @@ i = prefix + 16; while (!isgraph(buf[--i])); buf[i + 1] = 0; + + /* As buf could contain anything, we sanitise the name. */ + mk_alphanum(lc, buf, i); } else { char *b; @@ -696,6 +699,16 @@ sprintf(b, "%02x%02x%02x%02x", vd->guid[i], vd->guid[i + 1], vd->guid[i + 2], vd->guid[i + 3]); + + /* + * Because the LSI bios changes the timestamp in the + * metadata on every boot, we have to neutralize it + * in order to allow for persistent names. + * + * Using a dummy string "47114711" for that. + */ + if (!strncmp((char *) vd->guid, "LSI", 3)) + strncpy(buf + prefix + 32, "47114711", 8); } out: Only in dmraid/1.0.0.rc16/lib/format/ddf: ddf1.c.name Only in dmraid.new/1.0.0.rc16/lib/format/ddf: ddf1.c.orig --- dmraid/1.0.0.rc16/lib/internal.h 2009-09-16 04:55:23.000000000 -0400 +++ dmraid.new/1.0.0.rc16/lib/internal.h 2009-12-17 09:23:35.000000000 -0500 @@ -50,8 +50,8 @@ #define u_int64_t uint64_t #endif -#define min(a, b) (a) < (b) ? (a) : (b) -#define max(a, b) (a) > (b) ? (a) : (b) +#define min(a, b) ((a) < (b) ? (a) : (b)) +#define max(a, b) ((a) > (b) ? (a) : (b)) #define ARRAY_SIZE(a) (sizeof(a) / sizeof(*a)) #define ARRAY_END(a) (a + ARRAY_SIZE(a)) --- dmraid/1.0.0.rc16/lib/Makefile.in 2009-09-16 18:32:35.000000000 -0400 +++ dmraid.new/1.0.0.rc16/lib/Makefile.in 2010-03-16 12:02:16.000000000 -0400 @@ -8,7 +8,7 @@ top_srcdir = @top_srcdir@ VPATH = @srcdir@ -SOURCES=\ +SOURCES = \ activate/activate.c \ activate/devmapper.c \ device/ata.c \ @@ -72,25 +72,26 @@ @echo $(TARGETS) $(INSTALL_TARGETS) $(LIB_EVENTS_SHARED): - $(CC) events/$(LIB_EVENTS_NAME).c $(INCLUDES) $(CFLAGS) $(LDFLAGS) -shared -Wl,-soname,$(notdir $@).$(DMRAID_LIB_VERSION) -o $@ -ldevmapper -ldevmapper-event $(LIB_SHARED) + $(CC) events/$(LIB_EVENTS_NAME).c $(INCLUDES) $(CFLAGS) $(LDFLAGS) -shared -Wl,-soname,$(notdir $@).$(DMRAID_LIB_VERSION) -o $@ -ldevmapper -ldevmapper-event $(LIB_SHARED) -lpthread .PHONY: install_dmraid_libs remove_dmraid_libs install_dmraid_libs: $(INSTALL_TARGETS) - @echo "Installing $(INSTALL_TARGETS) in $(libdir)"; \ - mkdir -p $(libdir); \ + @echo "Installing $(INSTALL_TARGETS) in $(DESTDIR)$(libdir)"; \ + mkdir -p $(DESTDIR)$(libdir); \ for f in $(INSTALL_TARGETS); \ do \ n=$$(basename $${f}) ; \ - if [[ "$$n" =~ '.so$$' ]]; then \ + if [[ "$$n" =~ .so$$ ]]; then \ $(INSTALL) -m 555 $(STRIP) \ - $$f $(libdir)/$${n}.@DMRAID_LIB_VERSION@; \ - $(LN_S) -f $${n}.@DMRAID_LIB_VERSION@ $(libdir)/$${n}; \ + $$f $(DESTDIR)$(libdir)/$${n}.@DMRAID_LIB_VERSION@; \ + $(LN_S) -f $${n}.@DMRAID_LIB_VERSION@ $(DESTDIR)$(libdir)/$${n}; \ else \ - $(INSTALL) -m 555 $(STRIP) $$f $(libdir)/$${n}; \ + $(INSTALL) -m 555 $(STRIP) $$f $(DESTDIR)$(libdir)/$${n}; \ fi \ done + install: install_dmraid_libs remove_dmraid_libs: @@ -98,8 +99,10 @@ for f in $(INSTALL_TARGETS); \ do \ n=$$(basename $${f}) ; \ - rm -f $(libdir)/$${n}.@DMRAID_LIB_VERSION@; \ - rm -f $(libdir)/$${n}; \ + rm -f $(DESTDIR)$(libdir)/$${n}.@DMRAID_LIB_VERSION@; \ + rm -f $(DESTDIR)$(libdir)/$${n}; \ done + + remove: remove_dmraid_libs --- dmraid/1.0.0.rc16/lib/metadata/metadata.c 2009-09-16 04:55:23.000000000 -0400 +++ dmraid.new/1.0.0.rc16/lib/metadata/metadata.c 2010-01-12 07:15:59.000000000 -0500 @@ -82,8 +82,8 @@ enum args args; /* Arguments allowed ? */ /* Function to call on hit or NULL */ - int (*f_set) (struct lib_context * lc, int arg); - int arg; /* Argument for above function call */ + int (*f_set) (struct lib_context * lc, struct actions *action); + int arg; /* Argument for above function call. */ }; /*************************************/ @@ -2096,7 +2096,7 @@ if (!count_devices(lc, DEVICE)) { log_print(lc, "no block devices found"); - return 1; + return 0; } if (!(M_RAID & p->metadata)) @@ -2118,7 +2118,7 @@ if (!OPT_HOT_SPARE_SET(lc) && !OPT_CREATE(lc) && !count_devices(lc, RAID)) { format_error(lc, "disks", argv); - return 1; + return 0; } if (M_SET & p->metadata) { --- dmraid/1.0.0.rc16/lib/misc/file.c 2009-09-16 04:55:23.000000000 -0400 +++ dmraid.new/1.0.0.rc16/lib/misc/file.c 2010-01-11 11:19:29.000000000 -0500 @@ -32,7 +32,6 @@ } while (s); dbg_free(orig); - return ret; } @@ -62,9 +61,9 @@ ssize_t(*func) (); const char *what; } rw_spec[] = { - { - read, "read"}, { - write, "writ"},}, *rw = rw_spec + ((flags & O_WRONLY) ? 1 : 0); + { read, "read"}, + { write, "writ"}, + }, *rw = rw_spec + ((flags & O_WRONLY) ? 1 : 0); if ((fd = open(path, flags, lc->mode)) == -1) LOG_ERR(lc, 0, "opening \"%s\"", path); @@ -84,7 +83,6 @@ ret = 1; close(fd); - return ret; } --- dmraid/1.0.0.rc16/lib/misc/lib_context.c 2009-09-16 04:55:23.000000000 -0400 +++ dmraid.new/1.0.0.rc16/lib/misc/lib_context.c 2010-02-17 06:51:54.000000000 -0500 @@ -138,25 +138,30 @@ static void init_version(struct lib_context *lc, void *arg) { - lc->version.text = DMRAID_LIB_VERSION; + static char version[80]; + + lc->version.text = version; lc->version.date = DMRAID_LIB_DATE; lc->version.v.major = DMRAID_LIB_MAJOR_VERSION; lc->version.v.minor = DMRAID_LIB_MINOR_VERSION; lc->version.v.sub_minor = DMRAID_LIB_SUBMINOR_VERSION; lc->version.v.suffix = DMRAID_LIB_VERSION_SUFFIX; + snprintf(version, sizeof(version), "%d.%d.%d.%s", + lc->version.v.major, lc->version.v.minor, + lc->version.v.sub_minor, lc->version.v.suffix); } /* Put init functions into an array because of the potentially growing list. */ struct init_fn { void (*func) (struct lib_context * lc, void *arg); } init_fn[] = { - { - init_options}, { - init_cmd}, { - init_lists}, { - init_mode}, { - init_paths}, { -init_version},}; + { init_options}, + { init_cmd}, + { init_lists}, + { init_mode}, + { init_paths}, + { init_version}, +}; struct lib_context * alloc_lib_context(char **argv) --- dmraid/1.0.0.rc16/lib/misc/misc.c 2009-09-16 04:55:23.000000000 -0400 +++ dmraid.new/1.0.0.rc16/lib/misc/misc.c 2010-03-12 06:33:02.000000000 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004,2005 Heinz Mauelshagen, Red Hat GmbH. + * Copyright (C) 2004-2010 Heinz Mauelshagen, Red Hat GmbH. * All rights reserved. * * Copyright (C) 2007 Intel Corporation. All rights reserved. @@ -66,6 +66,21 @@ } } +/* + * Convert a string to only have alphanum or '-' or '_'. [Neil Brown] + * All others become '_' + */ +void +mk_alphanum(struct lib_context *lc, char *str, size_t len) +{ + for (; len && *str; len--, str++) { + if (!isalnum(*str) && + *str != '-' && + *str != '_') + *str = '_'; + } +} + /* Remove any whitespace from a string. */ char * remove_white_space(struct lib_context *lc, char *str, size_t size) --- dmraid/1.0.0.rc16/lib/register/dmreg.c 2009-09-16 04:55:23.000000000 -0400 +++ dmraid.new/1.0.0.rc16/lib/register/dmreg.c 2010-03-18 09:10:43.000000000 -0400 @@ -441,7 +441,7 @@ errors = _dm_raid_state(dev_name); if (errors < 0) - return 1; + return 0; if (errors) { printf("ERROR: device \"%s\" \n" @@ -475,7 +475,7 @@ printf("ERROR: device \"%s\" %s\n", dev_name, pending ? "has a registration event pending and " - "cannot be unregistered until completed": + "cannot be unregistered until completed" : "is not currently being monitored"); return 1; } --- dmraid/1.0.0.rc16/lib/version.h 2009-09-16 05:22:03.000000000 -0400 +++ dmraid.new/1.0.0.rc16/lib/version.h 2010-02-17 06:51:53.000000000 -0500 @@ -1,12 +1,12 @@ #ifndef DMRAID_LIB_VERSION -#define DMRAID_LIB_VERSION "1.0.0.rc16" +#define DMRAID_LIB_VERSION "1" #define DMRAID_LIB_MAJOR_VERSION 1 #define DMRAID_LIB_MINOR_VERSION 0 #define DMRAID_LIB_SUBMINOR_VERSION 0 -#define DMRAID_LIB_VERSION_SUFFIX "rc16" +#define DMRAID_LIB_VERSION_SUFFIX "rc16-4" -#define DMRAID_LIB_DATE "(2009.09.16)" +#define DMRAID_LIB_DATE "(2010.02.17)" #endif --- dmraid/1.0.0.rc16/logwatch/dmeventd 2009-09-16 04:55:23.000000000 -0400 +++ dmraid.new/1.0.0.rc16/logwatch/dmeventd 2010-01-12 07:15:59.000000000 -0500 @@ -36,8 +36,7 @@ # Set the location of the folder to store last time stamp # (This is used to record the last log sent out so repeats # are not mailed in error.) -$syslogpattern_file = - "/etc/logwatch/scripts/services/dmeventd_syslogpattern.txt"; +$syslogpattern_file = "/var/cache/logwatch/dmeventd/syslogpattern.txt"; if (-e $syslogpattern_file) { open(FD, "+<", $syslogpattern_file) or die $!; --- dmraid/1.0.0.rc16/make.tmpl.in 2009-09-16 04:55:23.000000000 -0400 +++ dmraid.new/1.0.0.rc16/make.tmpl.in 2010-03-16 12:02:16.000000000 -0400 @@ -21,9 +21,10 @@ SOFLAG += @SOFLAG@ # Setup directory variables -prefix = $(DESTDIR)@prefix@ -exec_prefix = $(DESTDIR)@exec_prefix@ +prefix = @prefix@ +exec_prefix = @exec_prefix@ bindir = @bindir@ +datadir = @datarootdir@ ifeq ("@KLIBC@", "no") libdir = @libdir@ sbindir = @sbindir@ @@ -31,9 +32,9 @@ infodir = @infodir@ mandir = @mandir@ else - libdir = $(DESTDIR)@KLIBC_LIB_DIR@ - sbindir = $(DESTDIR)@KLIBC_SBIN_DIR@ - includedir = $(DESTDIR)@KLIBC_INCLUDE_DIR@ + libdir = @KLIBC_LIB_DIR@ + sbindir = @KLIBC_SBIN_DIR@ + includedir = @KLIBC_INCLUDE_DIR@ infodir = @infodir@ mandir = @mandir@ endif --- dmraid/1.0.0.rc16/man/dmraid.8 2009-09-16 04:55:23.000000000 -0400 +++ dmraid.new/1.0.0.rc16/man/dmraid.8 2010-03-18 09:24:39.000000000 -0400 @@ -1,538 +1,558 @@ -.TH DMRAID 8 "DMRAID TOOL" "Heinz Mauelshagen" \" -*- nroff -*- -.SH NAME -dmraid \- discover, configure and activate software (ATA)RAID -.SH SYNOPSIS -.B dmraid - {-a|--activate} {y|n|yes|no} - [-d|--debug]... [-v|--verbose]... [-i|--ignorelocking] - [-f|--format FORMAT[,FORMAT...]] - [{-P|--partchar} CHAR] - [-p|--no_partitions] - [-Z|--rm_partitions] - [--separator SEPARATOR] - [-t|--test] - [RAID-set...] - -.B dmraid - {-b|--block_devices} - [-c|--display_columns][FIELD[,FIELD...]]... - [-d|--debug]... [-v|--verbose]... - [--separator SEPARATOR] - [device-path...] - -.B dmraid - {-h|--help} - -.B dmraid - {-l|--list_formats} - [-d|--debug]... [-v|--verbose]... - -.B dmraid - {-n|--native_log} - [-d|--debug]... [-v|--verbose]... [-i|--ignorelocking] - [-f|--format FORMAT[,FORMAT...]] - [--separator SEPARATOR] - [device-path...] - -.B dmraid - {-R| --rebuild} - RAID-set - [device-path] - -.B dmraid - {-x| --remove} - [RAID-set] - -.B dmraid - -f FORMAT-handler -{-C| --create} set - --type raidlevel - [--size=setsize --strip stridesize] - --disk "device-path, device-path [, device-path ...]" - -.B dmraid -[ -f|--format FORMAT-handler] --S|--spare [RAID-set] --M|--media "device-path" - -.B dmraid - {-r|--raid_devices} - [-c|--display_columns][FIELD[,FIELD...]]... - [-d|--debug]... [-v|--verbose]... [-i|--ignorelocking] - [-D|--dump_metadata] - [-f|--format FORMAT[,FORMAT...]] - [--separator SEPARATOR] - [device-path...] - -.B dmraid - {-r|--raid_devices} - [-d|--debug]... [-v|--verbose]... [-i|--ignorelocking] - [-E|--erase_metadata] - [-f|--format FORMAT[,FORMAT...]] - [--separator SEPARATOR] - [device-path...] - -.B dmraid - {-s|--sets}...[a|i|active|inactive] - [-c|--display_columns][FIELD[,FIELD...]]... - [-d|--debug]... [-v|--verbose]... [-i|--ignorelocking] - [-f|--format FORMAT[,FORMAT...]] - [-g|--display_group] - [--separator SEPARATOR] - [RAID-set...] - -.B dmraid - {-V/--version} - -.SH DESCRIPTION -dmraid discovers block and software RAID devices (eg, ATARAID) -by using multiple different metadata format handlers which -support various formats (eg, Highpoint 37x series). -It offers activating RAID sets made up by 2 or more -discovered RAID devices, display properties of devices and sets (see option -.B -l -for supported metadata formats). -Block device access to activated RAID sets occurs via device-mapper nodes -/dev/mapper/RaidSetName. -RaidSetName starts with the format name (see -.B -l -option) which can be used to access all RAID sets of a specific format -easily with certain options (eg, -.B -a -below). - -.SS OPTIONS -.TP -.I \-a, \-\-activate {y|n} [RAID set...] -Activates or deactivates all or particular software RAID set. -In case metadata format handlers are chosen with -.B -f -, only RAID sets with such format(s) can be activated or deactivated. -Useful if devices have multiple metadata signatures. -When activating RAID sets, -.B -p -disables the activation of partitions on them, and -.B -Z -will make dmraid tell the kernel to remove the partitions from the disks -underlying the set, ie if sda is part of the set, remove sda1, sda2, etc. -This prevents applications from directly accessiong the disks bypassing dmraid. -RAID set names given on command line don't need to be fully specified -(eg, "dmraid -ay sil" would activate all discovered Silicon Image Medley -RAID sets). - -.TP -.I {-b|--block_devices} [device-path...] -List all or particular discovered block devices with their -properties (size, serial number). -Add -.B -c -to display block device names only and -.B -cc -for CSV column output of block device properties. -See description of -.B -c -below for FIELD identifiers. - -.TP -.I [-d|--debug]... -Enable debugging output. Opion can be given multiple times -increasing the debug output level. - -.TP -.I [-c|--display_columns][FIELD[,FIELD...]]... -Display properties of block devices, RAID sets and devices in column(s). -Optional list specifying which FIELDs to display. -.br -For -.B -b: -.br -d[evpath]|p[ath], sec[tors]|si[ze], ser[ialnumber]. -.br -For -.B -r: -.br -de[vpath]|p[ath], f[ormat], r[aidname], t[ype], st[atus], se[ctors]|si[ze], da[taoffset]|o[ffset]. -.br -For -.B -s: -.br -f[ormat], r[aidname], t[ype], sta[tus], str[ide], se[ctors]|si[ze], su[bsets], d[evices], sp[ares]. -.br -.TP -.I [-f|--format FORMAT[,FORMAT...]] -Use metadata format handler(s) to discover RAID devices. -See -.B -l -for a list of supported format handler names. This is useful to -select particular formats in case multiple metadata signatures are found -on a device. A comma seperated list of format names can be specified which -may not contain white space. - -.TP -.I {-h|--help} -Display help text. - -.TP -.I {-i|--ignorelocking} -Don't take out any locks. Useful in early boot where no read/write -access to /var is available. - -.TP -.I {-l|--list_formats} -List all available metadata format handlers with their names and -descriptions. Supported RAID levels are listed in parenthesis: -.br - -S: Span (concatination) -.br -0: RAID0 (stripe) -.br -1: RAID1 (mirror) -.br +.TH DMRAID 8 "DMRAID TOOL" "Heinz Mauelshagen" \" -*- nroff -*- +.SH NAME +dmraid \- discover, configure and activate software (ATA)RAID +.SH SYNOPSIS +.B dmraid + {-a|--activate} {y|n|yes|no} + [-d|--debug]... [-v|--verbose]... [-i|--ignorelocking] + [-f|--format FORMAT[,FORMAT...]] + [-I|--ignoremonitoring] + [{-P|--partchar} CHAR] + [-p|--no_partitions] + [-Z|--rm_partitions] + [--separator SEPARATOR] + [-t|--test] + [RAID-set...] + +.B dmraid + {-b|--block_devices} + [-c|--display_columns][FIELD[,FIELD...]]... + [-d|--debug]... [-v|--verbose]... + [--separator SEPARATOR] + [device-path...] + +.B dmraid + {-h|--help} + +.B dmraid + {-l|--list_formats} + [-d|--debug]... [-v|--verbose]... + +.B dmraid + {-n|--native_log} + [-d|--debug]... [-v|--verbose]... [-i|--ignorelocking] + [-f|--format FORMAT[,FORMAT...]] + [--separator SEPARATOR] + [device-path...] + +.B dmraid + {-R| --rebuild} + RAID-set + [device-path] + +.B dmraid + {-x| --remove} + [RAID-set] + +.B dmraid + -f FORMAT-handler +{-C| --create} set + --type raidlevel + [--size=setsize --strip stridesize] + --disk "device-path, device-path [, device-path ...]" + +.B dmraid +[ -f|--format FORMAT-handler] +-S|--spare [RAID-set] +-M|--media "device-path" + +.B dmraid + {-r|--raid_devices} + [-c|--display_columns][FIELD[,FIELD...]]... + [-d|--debug]... [-v|--verbose]... [-i|--ignorelocking] + [-D|--dump_metadata] + [-f|--format FORMAT[,FORMAT...]] + [--separator SEPARATOR] + [device-path...] + +.B dmraid + {-r|--raid_devices} + [-d|--debug]... [-v|--verbose]... [-i|--ignorelocking] + [-E|--erase_metadata] + [-f|--format FORMAT[,FORMAT...]] + [--separator SEPARATOR] + [device-path...] + +.B dmraid + {-s|--sets}...[a|i|active|inactive] + [-c|--display_columns][FIELD[,FIELD...]]... + [-d|--debug]... [-v|--verbose]... [-i|--ignorelocking] + [-f|--format FORMAT[,FORMAT...]] + [-g|--display_group] + [--separator SEPARATOR] + [RAID-set...] + +.B dmraid + {-V/--version} + +.SH DESCRIPTION +dmraid discovers block and software RAID devices (eg, ATARAID) +by using multiple different metadata format handlers which +support various formats (eg, Highpoint 37x series). +It offers activating RAID sets made up by 2 or more +discovered RAID devices, display properties of devices and sets (see option +.B -l +for supported metadata formats). +Block device access to activated RAID sets occurs via device-mapper nodes +/dev/mapper/RaidSetName. +RaidSetName starts with the format name (see +.B -l +option) which can be used to access all RAID sets of a specific format +easily with certain options (eg, +.B -a +below). + +.SS OPTIONS +.TP +.I \-a, \-\-activate {y|n} [RAID set...] +Activates or deactivates all or particular software RAID set. +Activates or deactivates device monitoring automatically unless the +.B [-I|--ignoremonitoring] +option is given at the same time, hence preventing any dmeventd device +monitoring daemon interaction. If +.B -I +is being used on initial RAID set activation, +.B -ay +can be used later to activate device monitoring on such active RAID sets +if the RAID format supports it. See dmevent_tool(8) for device monitoring +management via this tool. +In case metadata format handlers are chosen with +.B -f +, only RAID sets with such format(s) can be activated or deactivated. +Useful if devices have multiple metadata signatures. +When activating RAID sets, +.B -p +disables the activation of partitions on them, and +.B -Z +will make dmraid tell the kernel to remove the partitions from the disks +underlying the set, ie if sda is part of the set, remove sda1, sda2, etc. +This prevents applications from directly accessiong the disks bypassing dmraid. +RAID set names given on command line don't need to be fully specified +(eg, "dmraid -ay sil" would activate all discovered Silicon Image Medley +RAID sets). + +.TP +.I {-b|--block_devices} [device-path...] +List all or particular discovered block devices with their +properties (size, serial number). +Add +.B -c +to display block device names only and +.B -cc +for CSV column output of block device properties. +See description of +.B -c +below for FIELD identifiers. + +.TP +.I [-d|--debug]... +Enable debugging output. Opion can be given multiple times +increasing the debug output level. + +.TP +.I [-c|--display_columns][FIELD[,FIELD...]]... +Display properties of block devices, RAID sets and devices in column(s). +Optional list specifying which FIELDs to display. +.br +For +.B -b: +.br +d[evpath]|p[ath], sec[tors]|si[ze], ser[ialnumber]. +.br +For +.B -r: +.br +de[vpath]|p[ath], f[ormat], r[aidname], t[ype], st[atus], se[ctors]|si[ze], da[taoffset]|o[ffset]. +.br +For +.B -s: +.br +f[ormat], r[aidname], t[ype], sta[tus], str[ide], se[ctors]|si[ze], su[bsets], d[evices], sp[ares]. +.br +.TP +.I [-f|--format FORMAT[,FORMAT...]] +Use metadata format handler(s) to discover RAID devices. +See +.B -l +for a list of supported format handler names. This is useful to +select particular formats in case multiple metadata signatures are found +on a device. A comma seperated list of format names can be specified which +may not contain white space. + +.TP +.I {-h|--help} +Display help text. + +.TP +.I {-i|--ignorelocking} +Don't take out any locks. Useful in early boot where no read/write +access to /var is available. + +.TP +.I {-I|--ignoremonitoring} +Don't activate or deactivate device monitoring with +.B -ay +or +.B -an +respectively. This avoids interaction with the dmeventd device +monitoring daemon altogether. + +.TP +.I {-l|--list_formats} +List all available metadata format handlers with their names and +descriptions. Supported RAID levels are listed in parenthesis: +.br + +S: Span (concatination) +.br +0: RAID0 (stripe) +.br +1: RAID1 (mirror) +.br 10: RAID10 (mirror on top of stripes) -.br -01: RAID10 (stripe on top of mirrors) Note: Intel OROM displays this as RAID10 - -.TP -.I {-n|--native_log} [device-path...] -Display metadata in native, vendor-specific format. -In case a metadata format handler is chosen with -.B -f -only RAID devices with such format will be displayed in native format. -If device-path(s) is/are given on the command line, native metadata output -is restricted to those listed. -.TP -.I [{-P|--partchar} CHAR] -Use CHAR as the separator between the device name and the partition number. -.TP -.I {-R| --rebuild} RAID-set [device-path] -Rebuild raid array after a drive has failed and a new drive is added. -For Intel chipset based systems, there are two methods in which a new drive -is added to the system. - -1. Using OROM to identify a new drive - During system reboot, enter OROM and mark the new drive as the rebuild drive. - After booting to the OS, use the dmraid command to rebuild. - - Example: dmraid -R raid_set - -2. Using dmraid to identify a new drive - Boot to the OS and use the dmraid command with the new drive as -the second parameter. - - Example: dmraid -R raid_set /dev/sdc - -3. Using hot spare drive - Mark a drive as hot spare using the "dmraid -f isw -S" command. Then use the dmraid command to start the rebuild. - - Example: dmraid -R raid_set - -.TP -.I {-x|--remove} [RAID-set] -Delete one or all existing software RAID devices from the metadata. - -.TP -.I -f FORMAT-handler {-C|--create} --type raidlevel [--size=setsize --strip stripsize] --disk "device-path, device-path [,device-path]" +.br +01: RAID10 (stripe on top of mirrors) Note: Intel OROM displays this as RAID10 + +.TP +.I {-n|--native_log} [device-path...] +Display metadata in native, vendor-specific format. +In case a metadata format handler is chosen with +.B -f +only RAID devices with such format will be displayed in native format. +If device-path(s) is/are given on the command line, native metadata output +is restricted to those listed. +.TP +.I [{-P|--partchar} CHAR] +Use CHAR as the separator between the device name and the partition number. +.TP +.I {-R| --rebuild} RAID-set [device-path] +Rebuild raid array after a drive has failed and a new drive is added. +For Intel chipset based systems, there are two methods in which a new drive +is added to the system. + +1. Using OROM to identify a new drive + During system reboot, enter OROM and mark the new drive as the rebuild drive. + After booting to the OS, use the dmraid command to rebuild. + + Example: dmraid -R raid_set + +2. Using dmraid to identify a new drive + Boot to the OS and use the dmraid command with the new drive as +the second parameter. + + Example: dmraid -R raid_set /dev/sdc + +3. Using hot spare drive + Mark a drive as hot spare using the "dmraid -f isw -S" command. Then use the dmraid command to start the rebuild. + + Example: dmraid -R raid_set + +.TP +.I {-x|--remove} [RAID-set] +Delete one or all existing software RAID devices from the metadata. + +.TP +.I -f FORMAT-handler {-C|--create} --type raidlevel [--size=setsize --strip stripsize] --disk "device-path, device-path [,device-path]" Delete one or all existing Configure a software RAID device and store the configuration data in a group of hard drive devices consisting of this array. This command requires the following options: -f FORMAT-handler .br - metadata format (see "dmraid -l") -.br + metadata format (see "dmraid -l") +.br --type digit[digit...] -.br +.br specify the raid level of the software RAID set. -.br +.br 0: raid0 -.br +.br 1: raid1 -.br +.br 5: raid5 -.br - 01: raid01 (isw raid10) -.br +.br + 01: raid01 (isw raid10) +.br --size: [digits[k|K|m|M|g|G][b|B]] .br specify the size of the RAID set.The number is an integer followed by [kKmMgG] and/or [bB]. .br b: byte (default) -.br - B: block (512 bytes) +.br + B: block (512 bytes) .br K or K: on the base of 1024 .br m or M: on the base of 1024*1024 -.br +.br g or G: on the base of 1024*1024*1024 .br -If this option is missing, it's set to the default value pre-configured by the vendor. Note that different vendors may apply different constraints on the granularity of the size or the minimal value. -.br +If this option is missing, it's set to the default value pre-configured by the vendor. Note that different vendors may apply different constraints on the granularity of the size or the minimal value. +.br --strip: [digits[k|K|m|M|g|G][b|B]] -.br - specify the strip size of a RAID1, RAID5, and RAID10 RAID set (as above) -.br +.br + specify the strip size of a RAID1, RAID5, and RAID10 RAID set (as above) +.br --disk: device-path[{,| }device-path...] .br - specify the array of the hard drives, e.g. /dev/sda. - -.TP -.I -f FORMAT-handler -S -M device-path -.I -S -M device-path - -This command adds hot spare support for one or more RAID sets. - -1. When used with a format handler, which supports hot spare sets (e.g. isw), a hot spare is marked to be used when rebuilding any RAID set of that format. -2. When used when specifying a RAID set, the drive is added to that RAID set and will be used only to rebuild that set. Note: If the specified name does not match an existing RAID-set, a set with the new name will be created. - -.TP -.I {-r|--raid_devices} [device-path...] -List all discovered RAID devices with format, RAID level, sectors used -and data offset into the device. -In case a metadata format handler is chosen with -.B -f -, only RAID devices with such format can be discovered. Useful if devices -have multiple metadata signatures. -If -.B -D -is added to -.B -r -the RAID metadata gets dumped into a subdirectory named dmraid.format_name -(eg. format_name = isw) in files named devicename.dat. -The byte offset where the metadata is located on the device is written -into files named devicename.offset and the size of the device in sectors -into files named devicename.size. - -If -.B -E -is added to -.B -r -the RAID metadata on the devices gets conditionally erased. -Useful to erase old metadata after new one of different type has been -stored on a device in order to avoid discovering both. If you enter -.B -E -option -.B -D -will be enforced in order to have a fallback in case the wrong metadata -got erased. -Manual copying back onto the device is needed to recover from erasing -the wrong metadata using the dumped files devicename_formatname.dat -and devicename_formatname.offset. -Eg, to restore all *.dat files in the working directory to the respective devices: - -.br -for f in *.dat -.br -do -.br - dd if=$f of=/dev/${f%%.dat} \\ -.br - seek=`cat ${f%%dat}offset` bs=1 -.br -done -.br - -If device-path(s) is/are given on the command line, the above actions -are restricted to those listed. -Add -.B -c -to display RAID device names only and -.B -cc -for CSV column output of RAID device properties. -See description of -.B -c -above for FIELD identifiers. - -.TP -.I --separator SEPARATOR -Use SEPARATOR as a delimiter for all options taking or displaying lists. - -.TP -.I -s... [a|i] [RAID-set...] -Display properties of RAID sets. Multiple RAID set names can be given -on the command line which don't need to be fully specified (eg, "dmraid -s hpt" -would display all discovered Highpoint RAID sets). Enter -.B -s -twice to display RAID subsets too. -Add -.B -c -to display names of RAID sets only, -.B -cc -for CSV column output of RAID set properties and -.B -ccc -for inclusion of block devices in the listing. Doesn't imply -.B -s -s -to show RAID subsets (implied for group sets, e.g. isw). -Add -.B -g -to include information about group RAID sets (as with Intel Software -RAID) in the listing. -See description of -.B -c -above for FIELD identifiers. + specify the array of the hard drives, e.g. /dev/sda. + +.TP +.I -f FORMAT-handler -S -M device-path +.I -S -M device-path + +This command adds hot spare support for one or more RAID sets. + +1. When used with a format handler, which supports hot spare sets (e.g. isw), a hot spare is marked to be used when rebuilding any RAID set of that format. +2. When used when specifying a RAID set, the drive is added to that RAID set and will be used only to rebuild that set. Note: If the specified name does not match an existing RAID-set, a set with the new name will be created. + +.TP +.I {-r|--raid_devices} [device-path...] +List all discovered RAID devices with format, RAID level, sectors used +and data offset into the device. +In case a metadata format handler is chosen with +.B -f +, only RAID devices with such format can be discovered. Useful if devices +have multiple metadata signatures. +If +.B -D +is added to +.B -r +the RAID metadata gets dumped into a subdirectory named dmraid.format_name +(eg. format_name = isw) in files named devicename.dat. +The byte offset where the metadata is located on the device is written +into files named devicename.offset and the size of the device in sectors +into files named devicename.size. + +If +.B -E +is added to +.B -r +the RAID metadata on the devices gets conditionally erased. +Useful to erase old metadata after new one of different type has been +stored on a device in order to avoid discovering both. If you enter +.B -E +option +.B -D +will be enforced in order to have a fallback in case the wrong metadata +got erased. +Manual copying back onto the device is needed to recover from erasing +the wrong metadata using the dumped files devicename_formatname.dat +and devicename_formatname.offset. +Eg, to restore all *.dat files in the working directory to the respective devices: + +.br +for f in *.dat +.br +do +.br + dd if=$f of=/dev/${f%%.dat} \\ +.br + seek=`cat ${f%%dat}offset` bs=1 +.br +done +.br + +If device-path(s) is/are given on the command line, the above actions +are restricted to those listed. +Add +.B -c +to display RAID device names only and +.B -cc +for CSV column output of RAID device properties. +See description of +.B -c +above for FIELD identifiers. + +.TP +.I --separator SEPARATOR +Use SEPARATOR as a delimiter for all options taking or displaying lists. + +.TP +.I -s... [a|i] [RAID-set...] +Display properties of RAID sets. Multiple RAID set names can be given +on the command line which don't need to be fully specified (eg, "dmraid -s hpt" +would display all discovered Highpoint RAID sets). Enter +.B -s +twice to display RAID subsets too. +Add +.B -c +to display names of RAID sets only, +.B -cc +for CSV column output of RAID set properties and +.B -ccc +for inclusion of block devices in the listing. Doesn't imply +.B -s -s +to show RAID subsets (implied for group sets, e.g. isw). +Add +.B -g +to include information about group RAID sets (as with Intel Software +RAID) in the listing. +See description of +.B -c +above for FIELD identifiers. Note: Size is given in sectors (not bytes). - -.TP -.I [-v|--verbose]... -Enable verbose runtime information output. Opion can be given multiple times -increasing the verbosity level. - -.SH EXAMPLES -"dmraid -l" lists all supported metadata formats with their names along with -some descriptive information, eg: -.br -hpt37x : (+) Highpoint HPT37X -.br -hpt45x : (+) Highpoint HPT45X -.br -isw : (+) Intel Software RAID -.br -lsi : (0) LSI Logic MegaRAID -.br -nvidia : (+) NVidia RAID -.br -pdc : (+) Promise FastTrack -.br -sil : (+) Silicon Image(tm) Medley(tm) -.br -via : (+) VIA Software RAID -.br -dos : (+) DOS partitions on SW RAIDs -.br -(0): Discover, (+): Discover+Activate - -"dmraid -ay" activates all software RAID sets discovered. - -"dmraid -an" deactivates all active software RAID sets which are not open -(eg, mounted filesystem on them). - -"dmraid -ay -f pdc" (pdc looked up from "dmraid -l") activates all -software RAID sets with Promise format discovered and ignores all other -supported formats. - -"dmraid -r" discovers all software RAID devices supported on your system, eg: -.br -/dev/dm-46: hpt45x, "hpt45x_chidjhaiaa-0", striped, ok, 320172928 sectors, data@ 0 -.br -/dev/dm-50: hpt45x, "hpt45x_chidjhaiaa-0", striped, ok, 320172928 sectors, data@ 0 -.br -/dev/dm-54: hpt45x, "hpt45x_chidjhaiaa-1", striped, ok, 320172928 sectors, data@ 0 -.br -/dev/dm-58: hpt45x, "hpt45x_chidjhaiaa-1", striped, ok, 320172928 sectors, data@ 0 - - -"dmraid -s -s hpt45x_chidjhaiaa" displays properties of -set "hpt45x_chidjhaiaa", eg: -.br -*** Superset -.br -name : hpt45x_chidjhaiaa -.br -size : 640345856 -.br -stride : 128 -.br -type : raid10 -.br -status : ok -.br -subsets: 2 -.br -dev : 4 -.br -spare : 0 -.br ----> Subset -.br -name : hpt45x_chidjhaiaa-0 -.br -size : 640345856 -.br -stride : 128 -.br -type : stripe -.br -status : ok -.br -subsets: 0 -.br -dev : 2 -.br -spare : 0 -.br ----> Subset -.br -name : hpt45x_chidjhaiaa-1 -.br -size : 640345856 -.br -stride : 128 -.br -type : stripe -.br -status : ok -.br -subsets: 0 -.br -dev : 2 -.br -spare : 0 -.br - -"dmraid -s -ccs hpt45" displays properties in column format of all sets -and subsets with hpt45* format, eg: -.br -hpt45x_chidjhaiaa,640345856,128,raid10,ok,4,0 -.br -hpt45x_chidjhaiaa-a,640345856,128,stripe,ok,2,0 -.br -hpt45x_chidjhaiaa-b,640345856,128,stripe,ok,2,0 - -"dmraid -r --sep : -cpath:size" display paths and sizes in sectors for -RAID devices in column format using ':' as a delimiter, eg: -.br -/dev/dm-8:320173055 -.br -/dev/dm-12:320173055 -.br -/dev/dm-22:320173055 -.br -/dev/dm-26:320173055 -.br -/dev/dm-30:586114703 -.br -/dev/dm-34:586114703 -.br -/dev/dm-38:586114703 -.br -/dev/dm-42:586114703 -.br -/dev/dm-46:156301487 -.br -/dev/dm-50:156301487 -.br -/dev/dm-54:390624896 -.br -/dev/dm-58:390624896 -.br -/dev/dm-62:390624896 -.br -/dev/dm-66:390624896 - -"dmraid -f isw -C Raid0 --type 0 --strip 8k --size 20g --disk "/dev/sdb /dev/sdc"" creates an ISW volume with -a name of "Raid0", 20Gig bytes in total, and 8kilo bytes strip size on two disks. - -"dmraid -f isw -C Test0 --type 0 --disk "/dev/sdd /dev/sde"" creates an ISW volume with the default size and strip size. - -"dmraid -f isw -C Test10 --type 01 --strip 128B --disk "/dev/sda /dev/sdb /dev/sdc /dev/sdd" creates a stacked -RAID device, RAID10 (isw format), with a name of "Test10", 128 blocks (512bytes) strip size , and the default volume size on -4 disks. - -"dmraid -f isw -S -M /dev/sde" marks the device /dev/sde as a hot spare for rebuild - -"dmraid -R isw_djaggchdde_RAID1 /dev/sde" starts rebuild of the RAID volume on device /dev/sde - -.SH DIAGNOSTICS -dmraid returns an exit code of 0 for success or 1 for error. - -.SH AUTHOR -Heinz Mauelshagen + +.TP +.I [-v|--verbose]... +Enable verbose runtime information output. Opion can be given multiple times +increasing the verbosity level. + +.SH EXAMPLES +"dmraid -l" lists all supported metadata formats with their names along with +some descriptive information, eg: +.br +hpt37x : (+) Highpoint HPT37X +.br +hpt45x : (+) Highpoint HPT45X +.br +isw : (+) Intel Software RAID +.br +lsi : (0) LSI Logic MegaRAID +.br +nvidia : (+) NVidia RAID +.br +pdc : (+) Promise FastTrack +.br +sil : (+) Silicon Image(tm) Medley(tm) +.br +via : (+) VIA Software RAID +.br +dos : (+) DOS partitions on SW RAIDs +.br +(0): Discover, (+): Discover+Activate + +"dmraid -ay" activates all software RAID sets discovered. + +"dmraid -an" deactivates all active software RAID sets which are not open +(eg, mounted filesystem on them). + +"dmraid -ay -f pdc" (pdc looked up from "dmraid -l") activates all +software RAID sets with Promise format discovered and ignores all other +supported formats. + +"dmraid -r" discovers all software RAID devices supported on your system, eg: +.br +/dev/dm-46: hpt45x, "hpt45x_chidjhaiaa-0", striped, ok, 320172928 sectors, data@ 0 +.br +/dev/dm-50: hpt45x, "hpt45x_chidjhaiaa-0", striped, ok, 320172928 sectors, data@ 0 +.br +/dev/dm-54: hpt45x, "hpt45x_chidjhaiaa-1", striped, ok, 320172928 sectors, data@ 0 +.br +/dev/dm-58: hpt45x, "hpt45x_chidjhaiaa-1", striped, ok, 320172928 sectors, data@ 0 + + +"dmraid -s -s hpt45x_chidjhaiaa" displays properties of +set "hpt45x_chidjhaiaa", eg: +.br +*** Superset +.br +name : hpt45x_chidjhaiaa +.br +size : 640345856 +.br +stride : 128 +.br +type : raid10 +.br +status : ok +.br +subsets: 2 +.br +dev : 4 +.br +spare : 0 +.br +---> Subset +.br +name : hpt45x_chidjhaiaa-0 +.br +size : 640345856 +.br +stride : 128 +.br +type : stripe +.br +status : ok +.br +subsets: 0 +.br +dev : 2 +.br +spare : 0 +.br +---> Subset +.br +name : hpt45x_chidjhaiaa-1 +.br +size : 640345856 +.br +stride : 128 +.br +type : stripe +.br +status : ok +.br +subsets: 0 +.br +dev : 2 +.br +spare : 0 +.br + +"dmraid -s -ccs hpt45" displays properties in column format of all sets +and subsets with hpt45* format, eg: +.br +hpt45x_chidjhaiaa,640345856,128,raid10,ok,4,0 +.br +hpt45x_chidjhaiaa-a,640345856,128,stripe,ok,2,0 +.br +hpt45x_chidjhaiaa-b,640345856,128,stripe,ok,2,0 + +"dmraid -r --sep : -cpath:size" display paths and sizes in sectors for +RAID devices in column format using ':' as a delimiter, eg: +.br +/dev/dm-8:320173055 +.br +/dev/dm-12:320173055 +.br +/dev/dm-22:320173055 +.br +/dev/dm-26:320173055 +.br +/dev/dm-30:586114703 +.br +/dev/dm-34:586114703 +.br +/dev/dm-38:586114703 +.br +/dev/dm-42:586114703 +.br +/dev/dm-46:156301487 +.br +/dev/dm-50:156301487 +.br +/dev/dm-54:390624896 +.br +/dev/dm-58:390624896 +.br +/dev/dm-62:390624896 +.br +/dev/dm-66:390624896 + +"dmraid -f isw -C Raid0 --type 0 --strip 8k --size 20g --disk "/dev/sdb /dev/sdc"" creates an ISW volume with +a name of "Raid0", 20Gig bytes in total, and 8kilo bytes strip size on two disks. + +"dmraid -f isw -C Test0 --type 0 --disk "/dev/sdd /dev/sde"" creates an ISW volume with the default size and strip size. + +"dmraid -f isw -C Test10 --type 01 --strip 128B --disk "/dev/sda /dev/sdb /dev/sdc /dev/sdd" creates a stacked +RAID device, RAID10 (isw format), with a name of "Test10", 128 blocks (512bytes) strip size , and the default volume size on +4 disks. + +"dmraid -f isw -S -M /dev/sde" marks the device /dev/sde as a hot spare for rebuild + +"dmraid -R isw_djaggchdde_RAID1 /dev/sde" starts rebuild of the RAID volume on device /dev/sde + +.SH DIAGNOSTICS +dmraid returns an exit code of 0 for success or 1 for error. + +.SH AUTHOR +Heinz Mauelshagen --- dmraid/1.0.0.rc16/man/Makefile.in 2009-09-16 04:55:23.000000000 -0400 +++ dmraid.new/1.0.0.rc16/man/Makefile.in 2010-03-16 12:02:16.000000000 -0400 @@ -16,21 +16,21 @@ .PHONY: install_dmraid_man remove_dmraid_man install_dmraid_man: - @echo "Installing $(MAN8) in $(MAN8DIR)"; \ - mkdir -p $(MAN8DIR); \ + @echo "Installing $(MAN8) in $(DESTDIR)$(MAN8DIR)"; \ + mkdir -p $(DESTDIR)$(MAN8DIR); \ for f in $(MAN8); \ do \ - $(RM) $(MAN8DIR)/$$f; \ - @INSTALL@ -D -m 444 $$f $(MAN8DIR)/$$f; \ + $(RM) $(DESTDIR)$(MAN8DIR)/$$f; \ + @INSTALL@ -D -m 444 $$f $(DESTDIR)$(MAN8DIR)/$$f; \ done install: install_dmraid_man remove_dmraid_man: - @echo "Removing $(MAN8) in $(MAN8DIR)"; \ + @echo "Removing $(MAN8) in $(DESTDIR)$(MAN8DIR)"; \ for f in $(MAN8); \ do \ - $(RM) $(MAN8DIR)/$$f; \ + $(RM) $(DESTDIR)$(MAN8DIR)/$$f; \ done remove: remove_dmraid_man --- dmraid/1.0.0.rc16/tools/commands.c 2009-09-16 04:55:23.000000000 -0400 +++ dmraid.new/1.0.0.rc16/tools/commands.c 2010-03-18 09:10:43.000000000 -0400 @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004-2008 Heinz Mauelshagen, Red Hat GmbH. + * Copyright (C) 2004-2010 Heinz Mauelshagen, Red Hat GmbH. * All rights reserved. * * Copyright (C) 2007 Intel Corporation. All rights reserved. @@ -32,7 +32,7 @@ */ static char const *short_opts = "a:hipP:" #ifndef DMRAID_MINI - "bc::dDEf:glxM:" + "bc::dDEf:gIlxM:" #ifdef DMRAID_NATIVE_LOG "n" #endif @@ -74,6 +74,7 @@ {"create", required_argument, NULL, 'C'}, {"spare", optional_argument, NULL, 'S'}, {"rm_partitions", no_argument, NULL, 'Z'}, + {"ignoremonitoring", no_argument, NULL, 'I'}, {NULL, no_argument, NULL, 0} }; #endif /* #ifdef HAVE_GETOPTLONG */ @@ -108,7 +109,7 @@ /* Check activate/deactivate option arguments. */ static int -check_activate(struct lib_context *lc, int arg) +check_activate(struct lib_context *lc, struct actions *a) { struct optarg_def def[] = { { "yes", ACTIVATE}, @@ -122,7 +123,7 @@ #ifndef DMRAID_MINI /* Check active/inactive option arguments. */ static int -check_active(struct lib_context *lc, int arg) +check_active(struct lib_context *lc, struct actions *a) { struct optarg_def def[] = { { "active", ACTIVE}, @@ -134,9 +135,8 @@ return check_optarg(lc, 's', def); } -/* Check and store option arguments. */ -static int -check_identifiers(struct lib_context *lc, int o) +/* lc_inc_opt wrapper to allow for (struct actions) call interface. */ +static int _lc_inc_opt(struct lib_context *lc, struct actions *a) { if (optarg) { const char delim = *OPT_STR_SEPARATOR(lc); @@ -144,17 +144,40 @@ p = remove_white_space(lc, p, strlen(p)); p = collapse_delimiter(lc, p, strlen(p), delim); - if (!lc_strcat_opt(lc, o, p, delim)) + + /* Hack to handle eg. "-cc". */ + while (*p == a->option) { + lc_inc_opt(lc, a->arg); + p++; + } + } + + lc_inc_opt(lc, a->arg); + return 1; +} + +/* Check and store option arguments. */ +static int +check_identifiers(struct lib_context *lc, struct actions *a) +{ + if (optarg) { + char *p = optarg; + + _lc_inc_opt(lc, a); + p += lc_opt(lc, a->arg) - 1; + if (*p && !lc_strcat_opt(lc, a->arg, p, *OPT_STR_SEPARATOR(lc))) return 0; + + return 1; } - lc_inc_opt(lc, o); + lc_inc_opt(lc, a->arg); return 1; } /* Check and store option argument/output field separator. */ static int -check_separator(struct lib_context *lc, int arg) +check_separator(struct lib_context *lc, struct actions *a) { if (strlen(optarg) != 1) LOG_ERR(lc, 0, "invalid separator \"%s\"", optarg); @@ -164,7 +187,7 @@ /* Check create option arguments. */ static int -check_create_argument(struct lib_context *lc, int arg) +check_create_argument(struct lib_context *lc, struct actions *a) { size_t len; @@ -175,39 +198,40 @@ if (*optarg == '-') LOG_ERR(lc, 0, "the raid set name is missing"); - lc_inc_opt(lc, arg); + lc_inc_opt(lc, a->arg); return 1; } /* 'Check' spare option argument. */ static int -check_spare_argument(struct lib_context *lc, int arg) +check_spare_argument(struct lib_context *lc, struct actions *a) { - lc_inc_opt(lc, arg); + lc_inc_opt(lc, a->arg); return 1; } #endif /* Check and store option for partition separator. */ static int -check_part_separator(struct lib_context *lc, int arg) +check_part_separator(struct lib_context *lc, struct actions *a) { /* We're not actually checking that it's only one character... if somebody wants to use more, it shouldn't hurt anything. */ return lc_stralloc_opt(lc, LC_PARTCHAR, optarg) ? 1 : 0; } + /* Display help information */ static int -help(struct lib_context *lc, int arg) +help(struct lib_context *lc, struct actions *a) { char *c = lc->cmd; #ifdef DMRAID_MINI log_print(lc, "%s: Device-Mapper Software RAID tool " "[Early Boot Version]\n", c); - log_print(lc, "%s\t{-a|--activate} {y|n|yes|no} [-i|--ignorelocking]\n" - "\t[-f|--format FORMAT[,FORMAT...]]\n" + log_print(lc, "%s\t{-a|--activate} {y|n|yes|no} [-i|--ignorelocking]\n" + "\t[-f|--format fORMAT[,FORMAT...]]\n" "\t[-P|--partchar CHAR]\n" "\t[-p|--no_partitions]\n" "\t[-Z|--rm_partitions]\n" @@ -221,6 +245,7 @@ log_print(lc, "%s\t{-a|--activate} {y|n|yes|no} *\n" "\t[-f|--format FORMAT[,FORMAT...]]\n" + "\t[-I|--ignoremonitoring]\n" "\t[-P|--partchar CHAR]\n" "\t[-p|--no_partitions]\n" "\t[--separator SEPARATOR]\n" "\t[-t|--test]\n" "\t[-Z|--rm_partitions] [RAID-set...]\n", c); @@ -278,7 +303,7 @@ ACTIVATE | DEACTIVATE | FORMAT | HELP | IGNORELOCKING | NOPARTITIONS | SEPARATOR | RMPARTITIONS #ifndef DMRAID_MINI - | DBG | TEST | VERBOSE + | DBG | TEST | VERBOSE | IGNOREMONITORING #endif , ARGS, check_activate, @@ -288,15 +313,15 @@ /* Format option. */ {'f', FORMAT, - ACTIVATE | DEACTIVATE + ACTIVATE | DEACTIVATE | IGNORELOCKING #ifndef DMRAID_MINI # ifdef DMRAID_NATIVE_LOG | NATIVE_LOG # endif | RAID_DEVICES | RAID_SETS, ACTIVE | INACTIVE | COLUMN | DBG | DUMP | DMERASE | GROUP | HELP | - IGNORELOCKING | NOPARTITIONS | SEPARATOR | TEST | VERBOSE | - RMPARTITIONS + NOPARTITIONS | SEPARATOR | TEST | VERBOSE | RMPARTITIONS | + IGNOREMONITORING #else , UNDEF #endif @@ -315,7 +340,7 @@ ACTIVATE | DEACTIVATE, FORMAT | HELP | IGNORELOCKING | SEPARATOR | RMPARTITIONS #ifndef DMRAID_MINI - | DBG | TEST | VERBOSE + | DBG | TEST | VERBOSE | IGNOREMONITORING #endif , ARGS, check_part_separator, @@ -328,7 +353,7 @@ ACTIVATE | DEACTIVATE, FORMAT | HELP | IGNORELOCKING | SEPARATOR | RMPARTITIONS #ifndef DMRAID_MINI - | DBG | TEST | VERBOSE + | DBG | TEST | VERBOSE | IGNOREMONITORING #endif , ARGS, NULL, @@ -342,7 +367,7 @@ UNDEF, COLUMN | DBG | HELP | IGNORELOCKING | SEPARATOR | VERBOSE, ARGS, - lc_inc_opt, + _lc_inc_opt, LC_DEVICES, }, @@ -363,7 +388,7 @@ ALL_FLAGS, ALL_FLAGS, ARGS, - lc_inc_opt, + _lc_inc_opt, LC_DEBUG, }, @@ -373,7 +398,7 @@ RAID_DEVICES, COLUMN | DBG | FORMAT | HELP | IGNORELOCKING | SEPARATOR | VERBOSE, ARGS, - lc_inc_opt, + _lc_inc_opt, LC_DUMP, }, @@ -394,7 +419,7 @@ ACTIVE | INACTIVE | DBG | COLUMN | FORMAT | HELP | IGNORELOCKING | SEPARATOR | VERBOSE, ARGS, - lc_inc_opt, + _lc_inc_opt, LC_GROUP, }, @@ -415,7 +440,7 @@ UNDEF, ALL_FLAGS, ARGS, - lc_inc_opt, + _lc_inc_opt, LC_IGNORELOCKING, }, @@ -529,7 +554,7 @@ ACTIVATE | DEACTIVATE | DBG | FORMAT | HELP | IGNORELOCKING | NOPARTITIONS | VERBOSE, ARGS, - lc_inc_opt, + _lc_inc_opt, LC_TEST, }, @@ -539,7 +564,7 @@ ALL_FLAGS, ALL_FLAGS, ARGS, - lc_inc_opt, + _lc_inc_opt, LC_VERBOSE, }, #endif /* #ifndef DMRAID_MINI */ @@ -585,6 +610,18 @@ NULL, 0, }, +#ifndef DMRAID_MINI + /* ignoremonitoring option. */ + {'I', + IGNOREMONITORING, + ACTIVATE | DEACTIVATE, + DBG | FORMAT | HELP | IGNORELOCKING | NOPARTITIONS | VERBOSE | + SEPARATOR, + ARGS, + _lc_inc_opt, + LC_IGNOREMONITORING, + }, +#endif }; /* @@ -602,7 +639,7 @@ a->allowed |= a->needed; if (a->f_set) /* Optionally call function. */ - return a->f_set(lc, a->arg); + return a->f_set(lc, a); break; } --- dmraid/1.0.0.rc16/tools/commands.h 2009-09-16 04:55:23.000000000 -0400 +++ dmraid.new/1.0.0.rc16/tools/commands.h 2010-01-12 07:21:10.000000000 -0500 @@ -1,5 +1,5 @@ /* - * Copyright (C) 2004,2005 Heinz Mauelshagen, Red Hat GmbH. + * Copyright (C) 2004-2010 Heinz Mauelshagen, Red Hat GmbH. * All rights reserved. * * Copyright (C) 2007 Intel Corporation. All rights reserved. @@ -33,8 +33,8 @@ enum args args; /* Arguments allowed ? */ /* Function to call on hit or NULL */ - int (*f_set) (struct lib_context * lc, int arg); - int arg; /* Argument for above function call */ + int (*f_set) (struct lib_context * lc, struct actions *action); + int arg; /* Argument for above function call. */ }; int handle_args(struct lib_context *lc, int argc, char ***argv); --- dmraid/1.0.0.rc16/tools/dmraid.c 2009-09-16 04:55:23.000000000 -0400 +++ dmraid.new/1.0.0.rc16/tools/dmraid.c 2010-01-12 07:15:59.000000000 -0500 @@ -33,7 +33,8 @@ * If both are ok -> perform the required action. */ ret = handle_args(lc, argc, &argv) && - init_locking(lc) && perform(lc, argv); + init_locking(lc) && + perform(lc, argv); /* Cleanup the library context. */ libdmraid_exit(lc); Only in dmraid/1.0.0.rc16/tools: dmraid.static --- dmraid/1.0.0.rc16/tools/Makefile.in 2009-09-16 04:55:23.000000000 -0400 +++ dmraid.new/1.0.0.rc16/tools/Makefile.in 2010-03-16 12:02:16.000000000 -0400 @@ -79,17 +79,17 @@ -L$(DESTDIR)$(libdir) $(DMRAIDLIBS) $(DMEVENTTOOLLIBS) $(DMRAIDLIBS) $(LIBS) install_dmraid_tools: $(TARGETS) - @echo "Installing $(TARGETS) in $(sbindir)"; \ - mkdir -p $(sbindir); \ - $(INSTALL) $(STRIP) $(TARGETS) $(sbindir) + @echo "Installing $(TARGETS) in $(DESTDIR)$(sbindir)"; \ + mkdir -p $(DESTDIR)$(sbindir); \ + $(INSTALL) $(STRIP) $(TARGETS) $(DESTDIR)$(sbindir) install: install_dmraid_tools remove_dmraid_tools: - @echo "Removing $(TARGETS) from $(sbindir)"; \ + @echo "Removing $(TARGETS) from $(DESTDIR)$(sbindir)"; \ for f in $(TARGETS); \ do \ - rm -f $(sbindir)/$$f; \ + rm -f $(DESTDIR)$(sbindir)/$$f; \ done remove: remove_dmraid_tools --- dmraid/1.0.0.rc16/tools/VERSION 2009-09-16 05:21:43.000000000 -0400 +++ dmraid.new/1.0.0.rc16/tools/VERSION 2010-01-12 07:23:26.000000000 -0500 @@ -1 +1 @@ -1.0.0.rc16 (2009.09.16) +1.0.0.rc16-3 (2010.01.12)