summaryrefslogtreecommitdiff
path: root/mdadm.c
Commit message (Collapse)AuthorAge
* imsm: Add --export option for --detail-platformMaciej Naruszewicz2012-10-02
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This option will provide most of information we can get via mdadm --detail-platform [-e format] in the key=value format. Example output: $ mdadm --detail-platform Platform : Intel(R) Matrix Storage Manager Version : 9.5.0.1037 RAID Levels : raid0 raid1 raid10 raid5 Chunk Sizes : 4k 8k 16k 32k 64k 128k 2TB volumes : supported 2TB disks : not supported Max Disks : 7 Max Volumes : 2 per array, 4 per controller I/O Controller : /sys/devices/pci0000:00/0000:00:1f.2 (SATA) $ mdadm --detail-platform --export MD_FIRMWARE_TYPE=imsm IMSM_VERSION=9.5.0.1037 IMSM_SUPPORTED_RAID_LEVELS=raid0 raid1 raid10 raid5 IMSM_SUPPORTED_CHUNK_SIZES=4k 8k 16k 32k 64k 128k IMSM_2TB_VOLUMES=yes IMSM_2TB_DISKS=no IMSM_MAX_DISKS=7 IMSM_MAX_VOLUMES_PER_ARRAY=2 IMSM_MAX_VOLUMES_PER_CONTROLLER=4 Signed-off-by: Maciej Naruszewicz <maciej.naruszewicz@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Use new struct context and struct shape for Grow_addbitmapNeilBrown2012-07-09
| | | | Signed-off-by: NeilBrown <neilb@suse.de>
* Use new struct context and struct shape in Grow_reshapeNeilBrown2012-07-09
| | | | Signed-off-by: NeilBrown <neilb@suse.de>
* Use new 'struct shape' to pass args to CreateNeilBrown2012-07-09
| | | | Signed-off-by: NeilBrown <neilb@suse.de>
* Use new 'struct shape' to pass args to BuildNeilBrown2012-07-09
| | | | Signed-off-by: NeilBrown <neilb@suse.de>
* Create new 'struct shape' to pass around array details.NeilBrown2012-07-09
| | | | | | | This collects to together many of the args given to create/build/grow Signed-off-by: NeilBrown <neilb@suse.de>
* change array_size to be unsigned and use the new MAX_SIZENeilBrown2012-07-09
| | | | Signed-off-by: NeilBrown <neilb@suse.de>
* Change the values for "max size" from -1 to 1.NeilBrown2012-07-09
| | | | | | | | Both are impossible, and '1' allows size to be unsigned, which is neater. Also #define MAX_SIZE to be '1' to make it all more explicit. Signed-off-by: NeilBrown <neilb@suse.de>
* Change Incremental and related functions to take struct contextNeilBrown2012-07-09
| | | | Signed-off-by: NeilBrown <neilb@suse.de>
* Change Monitor to take a struct contextNeilBrown2012-07-09
| | | | Signed-off-by: NeilBrown <neilb@suse.de>
* Change Detail and misc_scan to take a struct contextNeilBrown2012-07-09
| | | | Signed-off-by: NeilBrown <neilb@suse.de>
* change Examine to take a struct contextNeilBrown2012-07-09
| | | | Signed-off-by: NeilBrown <neilb@suse.de>
* Examine: split 'verbose' out from 'brief'.NeilBrown2012-07-09
| | | | | | | | | | The value of 'verbose' is sometimes mixed into 'brief', particularly for Examine. This is messy and confusing. So keep them separate. 'brief' still gets assumed when 'scan' is set, unless we are very verbose. Signed-off-by: NeilBrown <neilb@suse.de>
* Change Create to take a struct contextNeilBrown2012-07-09
| | | | Signed-off-by: NeilBrown <neilb@suse.de>
* Change Build to take a struct contextNeilBrown2012-07-09
| | | | Signed-off-by: NeilBrown <neilb@suse.de>
* Change misc_list to take struct contextNeilBrown2012-07-09
| | | | Signed-off-by: NeilBrown <neilb@suse.de>
* Convert Assemble() to take a context rather than a list of options.NeilBrown2012-07-09
| | | | Signed-off-by: NeilBrown <neilb@suse.de>
* Discard 'quiet' context variable.NeilBrown2012-07-09
| | | | | | Just use negative verbose, now that we are ready for that. Signed-off-by: NeilBrown <neilb@suse.de>
* Convert 'quiet' to 'not verbose' in various places.NeilBrown2012-07-09
| | | | | | | | If we change some functions to accept 'verbose', where <0 means to be quiet, in place of 'quiet', then we will be able to merge 'quiet' and 'verbose' together for simplicity. Signed-off-by: NeilBrown <neilb@suse.de>
* Create 'struct context' for ad hoc context option.NeilBrown2012-07-09
| | | | | | | | | | Rather than passing a long list of little flags etc to various functions we will soon pass a small collection of structures. This first step combines a collection of variables local to 'main' into a single structure. Signed-off-by: NeilBrown <neilb@suse.de>
* Create parse_num() function.NeilBrown2012-07-09
| | | | | | | | Instead of open-coding this several times, just do it once. The frees up the name 'c' which I'm about to use. Signed-off-by: NeilBrown <neilb@suse.de>
* Create: support --readonly flag.NeilBrown2012-07-09
| | | | | | Allow array to be created read-only Signed-off-by: NeilBrown <neilb@suse.de>
* Assemble: allow arrays to be assembled read-only.NeilBrown2012-07-09
| | | | | | The option was there, but never used. Signed-off-by: NeilBrown <neilb@suse.de>
* Remove scattered checks for malloc success.NeilBrown2012-07-09
| | | | | | | | | | | | | | malloc should never fail, and if it does it is unlikely that anything else useful can be done. Best approach is to abort and let some super-daemon restart. So define xmalloc, xcalloc, xrealloc, xstrdup which don't fail but just print a message and exit. Then use those removing all the tests for failure. Also replace all "malloc;memset" sequences with 'xcalloc'. Signed-off-by: NeilBrown <neilb@suse.de>
* Remove re_add flag in favour of new disposition.NeilBrown2012-07-09
| | | | | | | | | | | Instead of disposition == 'a' re_add == 1 use disposition == 'A' to record that a re-add was requested. Signed-off-by: NeilBrown <neilb@suse.de>
* Introduce pr_err for printing error messages.NeilBrown2012-07-09
| | | | | | | 'pr_err("' is a lot shorter than 'fprintf(stderr, Name ": ' cont_err() is also available. Signed-off-by: NeilBrown <neilb@suse.de>
* Help: use an array to choose which help matches which mode.NeilBrown2012-07-09
| | | | | | Looks cleaner than a big switch statement. Signed-off-by: NeilBrown <neilb@suse.de>
* main: extract more functions.NeilBrown2012-07-09
| | | | | | | extract misc_scan stop_scan misc_list from main to try to make main() a little more manageable. Signed-off-by: NeilBrown <neilb@suse.de>
* main: split scan_assemble into a separate functionNeilBrown2012-07-09
| | | | | | main is too big. This makes it a little more manageable. Signed-off-by: NeilBrown <neilb@suse.de>
* mdadm.c: various minor clean-upsNeilBrown2012-07-09
| | | | Signed-off-by: NeilBrown <neilb@suse.de>
* Use explicit non-char opt for --zero-superNeilBrown2012-07-09
| | | | | | | | As we don't allow '-K' for '--zero-super' there is no point using it internally. Just define a 'KillOpt' like with other options. Signed-off-by: NeilBrown <neilb@suse.de>
* Add --prefer option for --detail and --monitorNeilBrown2012-04-18
| | | | | | | | | | | | | | | | | Both --detail and --monitor can report the names of member devices on an array, and do so by searching /dev and finding the shortest name that matches. If --prefer=foo is given, they will instead prefer a name that contain /foo/. So mdadm --detail /dev/md0 --prefer=by-path will list the component devices via their /dev/disk/by-path/xxx names. Signed-off-by: NeilBrown <neilb@suse.de>
* parse_size: distinguish between 0 and error.NeilBrown2012-04-04
| | | | | | | | | | | | It isn't sufficient to use '0' for 'error' as well will later have fields that can validly be '0'. So return "-1" on error. Also fix parsing of --bitmap_check so that '0' is treated as an error: we don't support 512B anyway. Signed-off-by: NeilBrown <neilb@suse.de>
* Spawn mdmon with --offroot if mdadm was launched with --offrootJes Sorensen2012-01-30
| | | | | | Acked-by: Doug Ledford <dledford@redhat.com> Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Add --offroot argument to mdadmJes Sorensen2012-01-30
| | | | | | | | | | | When --offroot is specified, mdadm will change the first character of argv[0] to '@'. This is used to signal to systemd that mdadm was launched from initramfs and should not be shut down before returning to the initramfs. Acked-by: Doug Ledford <dledford@redhat.com> Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: NeilBrown <neilb@suse.de>
* allow --monitor to be run by non-privileged use.NeilBrown2011-12-23
| | | | | | | | | | | | Providing --no-sharing is given, monitoring should be permitted. Unfortunately the kernel current rejects GET_DISK_INFO and GET_ARRAY_INFO for non-privileged users which is unjustified. The info is available in sysfs and we could get it from there, but for now, require the kernel to be fixed. Reported-by: Raphael Hertzog <hertzog@debian.org> Signed-off-by: NeilBrown <neilb@suse.de>
* fix: Allowed to assemble 2 volumes with the same names from config file.Lukasz Orlowski2011-11-07
| | | | | | | | | | | | | mdadm allowes to assemble 2 volumes with the same names based on the config file. The issue is fixed by iterating over the list of md device identifiers and comparing the names of md devices against each other, detecting identical names and blocking the assembly should the same names be found. Now having detected duplicate names, mdadm terminates without assembling the container, displaying appropriate prompt. Signed-off-by: Lukasz Orlowski <lukasz.orlowski@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* mdadm: Rearrange option parsing for KillSubarray and UpdateSubarrayJes Sorensen2011-11-03
| | | | | | | | | | | | Extracting the 'subarray' arg for these options was being done at the wrong place which lead to the code being a bit confusing and looking wrong. So reformat that code a bit better and move the extraction of 'subarray' down to the main parsing of these options rather than the mode setting. Signed-off-by: NeilBrown <neilb@suse.de>
* Hold the map lock while performing Assemble to avoid races with udevJes Sorensen2011-10-22
| | | | | Signed-off-by: Jes Sorensen <Jes.Sorensen@redhat.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Add continue option to grow commandAdam Kwolek2011-10-03
| | | | | | | | | | | | | To allow for reshape continuation '--continue' option is added to grow command. Function that will be executed in grow-continue case doesn't require information about reshape geometry. All required information are read from metadata. For external metadata reshape can be run for monitored array/container only. In case when array/container is not monitored run mdmon for it. Signed-off-by: Adam Kwolek <adam.kwolek@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Do not continue reshape during initrd phaseAdam Kwolek2011-10-03
| | | | | | | | | | | | | | During initrd phase continuing reshape will cause file system context lost. This blocks ability to control reshape using checkpoints. To avoid this, during initrd phase assemble has to be executed with '--freeze-reshape' option. This causes that mdadm restores reshape critical section only. Reshape can be continued later after system full boot. Signed-off-by: Adam Kwolek <adam.kwolek@intel.com> Signed-off-by: NeilBrown <neilb@suse.de>
* Monitor: --oneshot must imply --no-sharingNeilBrown2011-09-19
| | | | | | | | | | | | | Moving spares is not the purpose of '--oneshot' and without currently --oneshot doesn't work as the check against multiple spare-sharers prevents it. So make --oneshot imply --no-sharing. This is sensible and allows --oneshot to work again. Reported-by: Jamie Heilman <jamie@audible.transient.net> Resolves-Debian-Bug: 641886 Signed-off-by: NeilBrown <neilb@suse.de>
* Discourage large devices from being added to 0.90 arrays.NeilBrown2011-09-08
| | | | | | | | 0.90 arrays can only use up to 4TB per device. So when a larger device is added, complain a bit. Still allow it if --force is given as there could be a valid use. Signed-off-by: NeilBrown <neilb@suse.de>
* Grow: accept --assume-clean with --grow --sizeNeilBrown2011-05-16
| | | | | | | When an array is resized to have larger members, --assume-clean will disable any resync if the kernel supports it (2.6.40 and later). Signed-off-by: NeilBrown <neilb@suse.de>
* Create: allow chunksize to be non-power-of-2.NeilBrown2011-05-10
| | | | | | | RAID0 has accepted chunksizes that are not a power of 2 since 2.6.30. So it time mdadm allowed that to be used. Signed-off-by: NeilBrown <neilb@suse.de>
* Give suitable error for mdadm /dev/md0 --stopNeilBrown2011-05-10
| | | | | | | | | Options like --stop must come before the device that is being stopped. If (in --misc mode) a device does not have an option, nothing will be done to it, which can be confusing. So report an error in this case. Signed-off-by: NeilBrown <neilb@suse.de>
* config: restore the possibility of a NULL homehostNeilBrown2011-05-10
| | | | | | | | | | | | | As homehost defaults to the system name it is not possible to specify a NULL homehost. This patch restored this ability with either --homehost="" or --homehost="<none>". This allows the creation of v1.x arrays without a "hostname:" prefix in the name. Signed-off-by: NeilBrown <neilb@suse.de>
* Finally remove auto-home-hostNeilBrown2011-04-27
| | | | | | | | This was #if-ed out for 3.0, but it really should go. Gcc 4.6.0 complains that auto_update_home is set but not used (which is true). Reported-by: Tobias Powalowski <t.powa@gmx.de>
* Fix regression when using 'grow' to add a bitmap.NeilBrown2011-03-15
| | | | | | | | | | When we allowed a devlist to accompany some --grow modes - but not --bitmap - we made --bitmap always fail, in stead of fail of a device was given to add. As 'devs_found' includes the md device, we need to compare against '1'. Signed-off-by: NeilBrown <neilb@suse.de>
* Grow: support reshape of RAID0 arrays.NeilBrown2011-03-10
| | | | | | | | | | This is done via conversion to RAID4 and back. To grow the array, extra devices will be needed which cannot already be present as spares - so allow a list of new devices to be included in grow request which changed the number of devices. Signed-off-by: NeilBrown <neilb@suse.de>