Linux - ServerThis forum is for the discussion of Linux Software used in a server related context.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I've had a failure of one of my HDDs (/dev/sdc) which makes up a few RAID partitions. The hot spare has now cut in, so all is currently safe, but how do I now remove the faulty spare?
mdadm --detail /dev/md1 gives the following:
Version : 00.90.03
Creation Time : Fri May 23 15:37:20 2008
Raid Level : raid5
Array Size : 945312256 (901.52 GiB 968.00 GB)
Device Size : 472656128 (450.76 GiB 484.00 GB)
Raid Devices : 3
Total Devices : 4
Preferred Minor : 1
Persistence : Superblock is persistent
Update Time : Mon Feb 2 11:52:32 2009
State : clean
Active Devices : 3
Working Devices : 3
Failed Devices : 1
Spare Devices : 0
Probably, but I thought your original question was marking as failed.
Quote:
For Manage mode:
-a, --add
hot-add listed devices.
--re-add
re-add a device that was recently removed from an array.
-r, --remove
remove listed devices. They must not be active. i.e. they should be failed or spare devices.
-f, --fail
mark listed devices as faulty.
--set-faulty
same as --fail.
Each of these options require that the first device list is the array to be acted upon and the remainder are component devices to be added, removed, or marked as fault. Several different operations can be specified for different devices, e.g.
mdadm /dev/md0 --add /dev/sda1 --fail /dev/sdb1 --remove /dev/sdb1
Each operation applies to all devices listed until the next operations.
If an array is using a write-intent bitmap, then devices which have been removed can be re-added in a way that avoids a full reconstruction but instead just updated the blocks that have changed since the device was removed. For arrays with persistent metadata (superblocks) this is done automatically. For arrays created with --build mdadm needs to be told that this device we removed recently with --re-add.
Devices can only be removed from an array if they are not in active use. i.e. that must be spares or failed devices. To remove an active device, it must be marked as faulty first.
Though since it is the failed disk, I doubt that it would make a difference; after all it's not being used anymore.
Number Major Minor RaidDevice State
0 8 3 0 active sync /dev/sda3
1 8 19 1 active sync /dev/sdb3
2 8 35 2 active sync
3 8 51 - spare /dev/sdd3
How do I deal with the 3rd disk (Number 2) which used to be /dev/sdc3? I can't mark it as failed nor remove it since I can't specify which element has failed.
I've had a failure of one of my HDDs (/dev/sdc) which makes up a few RAID partitions. The hot spare has now cut in, so all is currently safe, but how do I now remove the faulty spare?
This lets mdadm know to deallocate the device space. When you hot-add a new spare drive it should replace the /dev/sd<failed> node. After the hot-add you can:
Hello from the distant future! Thank you, --remove faulty was exactly what I needed to know.
I knew how to do --remove /dev/sdX, but not what to do when the device was already missing so there was no device id to refer to.
My situation was, I had replaced a failing drive by adding a hot spare and then physically yanking the bad one, without first doing --fail and --remove. The rebuild went fine, but I wanted to get the old entry off the list so the array would show as "clean", preferably without needing to restart it.
Last edited by voidstar; 03-09-2023 at 02:39 PM.
Reason: formatting
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.