LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 07-20-2016, 01:19 PM   #1
road hazard
Member
 
Registered: Nov 2015
Posts: 241

Rep: Reputation: Disabled
Question MDADM RAID 6 and UPS questions


OS: Mint 18 Mate

I have a few questions concerning mdadm and how to tell Mint what to do when there is a power loss and the batteries in the UPS kick in.

1) As I play around with Mint 18 and a software RAID 6 array, I installed mdadm and webmin and had no problems setting up the array. When I go into Caja and poke around, I can browse to /dev/md0 and see my RAID 6 array and access it perfectly fine. Then, I started to see posts about editing /etc/mdadm/mdadm.conf and something about adding "/dev/md0 ext4 defaults 0 0" to fstab. I don't remember doing any of this and the array seems to come up just fine after reboots. Can somebody explain why all this is needed? When I get home tonight, I'm going to check for these files and open them up. Maybe webmin took care of all this for me auto-magically?

(Or does this fstab step needed in order for the RAID to show up as 'mounted' on my desktop somewhere?)

2) My RAID array is not the boot drive. Is it critically important to stop the array before rebooting the system? Right now, I don't and again, it seems to be there when I browse out to it.

3) Compared to using hardware RAID cards and Windows.... if a drive fails it's just a matter of typically popping out the dead one and inserting the new one and the HW RAID card will start rebuilding the array automatically. With mdadm, there seems to be multiple steps to accomplishing this same goal. What is the easiest, quickest way to go about addressing a failing hard drive that needs replaced in a mdadm RAID 6 array?

4) Right now, if my house suffers a power outage, the Windows "server" box that the UPS is connected to takes over. This Widows box is hooked up via a USB cable to an APC UPS. Once battery levels gets to 20%, Windows power management is configured to shut down the PC at that threshold. How would you accomplish the same thing in Linux? Is there a simple GUI for setting this up or must you use the command line?
 
Old 07-20-2016, 02:25 PM   #2
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,573

Rep: Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142
1) /etc/fstab is used to define the system drives and mount points, so the raid will be automatically mounted on boot in the place you want it with the mount options you want.

2) There is no need to stop the array before rebooting/shutting down, it'll be safely synced and unmounted as part of the shutdown process.

4) You would do the same with Linux if the Linux machine could see the UPS, but since it can't, you'll have to find another way. Is it possible to define a custom program that gets run before shutting down the system on Windows? If so you could write a little Cygwin script to ssh into the Linux machine and command it to shut down, so when the battery gets to 20% Windows tells the Linux machine to shut down before shutting itself down.
 
Old 07-20-2016, 02:53 PM   #3
273
LQ Addict
 
Registered: Dec 2011
Location: UK
Distribution: Debian Sid AMD64, Raspbian Wheezy, various VMs
Posts: 7,680

Rep: Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373
For 3 with Linux software RAID you can just take the drives out of one machine and plug them into another with enough SATA ports and mdadm installed, then mount (OK, the steps are a little more involved than that but that really is the gist).
 
Old 07-20-2016, 03:05 PM   #4
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,568

Rep: Reputation: 5865Reputation: 5865Reputation: 5865Reputation: 5865Reputation: 5865Reputation: 5865Reputation: 5865Reputation: 5865Reputation: 5865Reputation: 5865Reputation: 5865
4) In addition, there is a daemon called apcuspd that can monitor the UPS status and shutdown at defined run time parameters. There isn't a GUI but setting up the configuration files is not difficult. There is also a windows version. apcupsd has a network protocol as well as compatible with APC's PCNET so other devices on a UPS can be automatically shutdown too.

http://www.apcupsd.org/

While apcupsd is specific to APC UPS devices there is a generic software program called NUT.

http://networkupstools.org/stable-hcl.html

Last edited by michaelk; 07-20-2016 at 03:26 PM.
 
Old 07-20-2016, 03:18 PM   #5
road hazard
Member
 
Registered: Nov 2015
Posts: 241

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by suicidaleggroll View Post
1) /etc/fstab is used to define the system drives and mount points, so the raid will be automatically mounted on boot in the place you want it with the mount options you want.

2) There is no need to stop the array before rebooting/shutting down, it'll be safely synced and unmounted as part of the shutdown process.

4) You would do the same with Linux if the Linux machine could see the UPS, but since it can't, you'll have to find another way. Is it possible to define a custom program that gets run before shutting down the system on Windows? If so you could write a little Cygwin script to ssh into the Linux machine and command it to shut down, so when the battery gets to 20% Windows tells the Linux machine to shut down before shutting itself down.
I looked at my fstab file and it appears webmin automatically put an entry for my RAID in there so I guess it's good to go.

2) Good to know, thanks!

4) I guess I should have worded that better. If I stick with Linux for my Plex server.... the Windows machine will be removed from the UPS and the Linux box will take its place and be hooked to it via the USB cable.
 
Old 07-20-2016, 03:31 PM   #6
road hazard
Member
 
Registered: Nov 2015
Posts: 241

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by 273 View Post
For 3 with Linux software RAID you can just take the drives out of one machine and plug them into another with enough SATA ports and mdadm installed, then mount (OK, the steps are a little more involved than that but that really is the gist).
But what if I'm only dealing with a SINGLE, dead drive that needs replaced?

The past few weeks/months (when time permits) I've been testing allllllllllllll sorts of configurations over here as I decide on a new Plex server build. Mint with MDADM RAID 5, 6, different file systems on top of that.... Windows Server Storage spaces.... Ubuntu, OpenMediaVault, UnRAID, FlexRAID. My mind is starting to melt.

I just ordered a PERC H700 card and will carry out similar tests with that.

The big thing I worry about, I've used Windows practically all my life. I've played with Linux from time to time and the thought of going 100% Linux for my Plex server and mdadm worries me. Lets say that everything is set up and working then months down the road, I decide to reboot the server and when it comes back up, the mdadm RAID is gone. Then, I have to pound away on forums and scramble for help. With Linux, I'm out of my comfort zone and like most humans, I fear the unknown. Sure, I was once like this with Windows but when I was a young teenager starting out with Windows, I didn't have to worry about managing a multi-terrabyte Plex server.

And since we've been a Plex family for nearly 2 years, my wife and kids have grown attached to watching movies/cartoons/TV shows off of it. No, they don't freak out if it's down for a few days/week but I will feel the pressure to get everything back up and running ASAP.

I know that I could have a catastrophic failure in Windows as well but with my experience with Windows, I'm 100% confident in my troubleshooting capabilities around that OS. With Linux..... I'm at about a 5-10%.

So to get back on track.... what is the EASIEST way to recover from a single failed drive with an mdadm RAID 6 setup? (Lots of steps or just a few?)

I found this on another forum when asking the same question: "No need to stop the array or fail the bad drive beforehand. Add new drive to array, mark old drive for replacement (--replace), remove old drive after replacement is complete. The old drive will then still be used for parity if necessary when there are other drive failures during the replacement process."

When I get some time, I'm going to try that out. Seems easy enough.

Something to note about mdadm..... it seems bullet proof. I've booted into Windows with these drives and formatted them then eventually booted back into Linux and when I went to set up a new array, mdadm warned me that these drives are part of a RAID array and cautioned me about proceeding.
 
Old 07-20-2016, 03:32 PM   #7
road hazard
Member
 
Registered: Nov 2015
Posts: 241

Original Poster
Rep: Reputation: Disabled
Quote:
Originally Posted by michaelk View Post
4) In addition, there is a daemon called apcuspd that can monitor the UPS status and shutdown at defined run time parameters. There isn't a GUI but setting up the configuration files is not difficult. There is also a windows version. apcupsd has a network protocol as well as compatible with APC's PCNET so other devices on a UPS can be automatically shutdown too.

http://www.apcupsd.org/

While apcupsd is specific to APC UPS devices there is a generic software program called NUT.

http://networkupstools.org/stable-hcl.html
Thanks for the info!
 
Old 07-20-2016, 03:41 PM   #8
273
LQ Addict
 
Registered: Dec 2011
Location: UK
Distribution: Debian Sid AMD64, Raspbian Wheezy, various VMs
Posts: 7,680

Rep: Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373
Quote:
Originally Posted by road hazard View Post
But what if I'm only dealing with a SINGLE, dead drive that needs replaced?
I don't know whether webmin has the option to rebuild a RAID but on the command line all you have to do is format another drive in the same manner that he others are formatted then make it a RAID member and tell mdadm to rebuild it. Again, the steps have some details which need attention paid to them but it's something that's been done enough times there are plenty of tutorials and other help out there likely to meet your situation.

To me, at least, using Linux means a little more work and attention to details (with command line being used a fair bit) in return for much greater flexibility. So I would expect you to have some issues or frustrations at first but if you like to mess around with things you'll enjoy it and, even if you don't, you'll likely find you can end up with a very flexible setup indeed.
 
Old 07-20-2016, 03:50 PM   #9
suicidaleggroll
LQ Guru
 
Registered: Nov 2010
Location: Colorado
Distribution: OpenSUSE, CentOS
Posts: 5,573

Rep: Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142Reputation: 2142
Quote:
Originally Posted by road hazard View Post
So to get back on track.... what is the EASIEST way to recover from a single failed drive with an mdadm RAID 6 setup? (Lots of steps or just a few?)
I've never rebuilt a RAID 5/6 array with mdadm (all of my 5/6/60 arrays are hardware), but a while back I had to rebuild a RAID 10 with a failed drive and jotted down the steps I used for future reference. As with most of my notes, these are the specific steps that I used to rebuild my system, these are not general steps that everyone should use, they'd need to be adapted to your specific situation, but it should give you an idea of what's required:
Code:
use a combination of mdadm --detail /dev/md0, fdisk -l, and smartctl -a /dev/sdX to get serial numbers of good/bad drives
power off machine
replace bad drive with a good one
power up
use fdisk -l to confirm new drive
use fdisk to set up a single primary partition the full size with type set to "linux raid autodetect"
  fdisk /dev/sdX
  n
  p
  1
  enter
  enter
  t
  fd
  w
mdadm --manage /dev/md0 --add /dev/sdX1
use mdadm --detail /dev/md0 to watch rebuild status
Replacing /dev/sdX in the above steps with the correct name of the drive, and /dev/md0 with the name of the array.
 
Old 07-23-2016, 07:18 AM   #10
273
LQ Addict
 
Registered: Dec 2011
Location: UK
Distribution: Debian Sid AMD64, Raspbian Wheezy, various VMs
Posts: 7,680

Rep: Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373Reputation: 2373
Quote:
Originally Posted by 273 View Post
I don't know whether webmin has the option to rebuild a RAID but on the command line all you have to do is format another drive in the same manner that he others are formatted then make it a RAID member and tell mdadm to rebuild it..
I just realised I used the word "format" when I meant partition as long as the partition is of the same type (RAID member I seem to recall) and size then the mdadm should rebuild the RAID with no fuss.
 
  


Reply

Tags
mdadm, raid, ups


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] RAID + MDADM + LILO Questions: Slackware 14.1 telemeister Slackware 5 05-13-2014 09:13 AM
Recover mdadm RAID after failure during RAID level change Caetel Linux - General 1 11-07-2013 10:38 PM
Questions on Linux Raid (mdadm) and how well it works? unseengundam Linux - Software 4 02-01-2013 03:47 PM
Broken raid 5 (11 drives in mdadm) -- data recovery/raid reconstruction needed -- ple jml48197 Linux - Server 4 07-27-2010 12:57 PM
Dell/Intel ICH7 soft-RAID and mdadm raid-level mistake PhilipTheMouse Linux - General 0 03-14-2009 05:59 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:10 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration