LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 01-17-2020, 11:02 AM   #1
edvdrmark
LQ Newbie
 
Registered: Jan 2006
Location: Oegstgeest, Netherlands
Distribution: opensuse 13.1
Posts: 29

Rep: Reputation: 0
recover two usb drives raid1 after system failure


with a raspberrypi (hostname: homer) I had set up a raid1 with two usb drives of 5Tb using mdadm. All worked perfect until the system failed.
After connecting the two drives on my laptop lsblk -f gives the following output (part):

sdc
└─sdc1 linux_r homer:0 a3e7388f-b23e-585f-c61c-9573d129fca1
└─md127 ext4 5c40fa6a-ee42-40a9-a45b-d04da893b67d /media/ed/
sdd
└─sdd1 linux_r homer:0 a3e7388f-b23e-585f-c61c-9573d129fca1

Until now I have not written anything to the drives. When I inspect the md127 (/dev/sdc1), it seems that all the files are present. But I don't see anything on /dev/sdd1.
My simple (?) question is: can I recover the two drives as raid1 again without dataloss?

I hope someone can help me. It's about 1 Tb data.
Thanks in advance, kind regards Ed
 
Old 01-17-2020, 11:18 AM   #2
edvdrmark
LQ Newbie
 
Registered: Jan 2006
Location: Oegstgeest, Netherlands
Distribution: opensuse 13.1
Posts: 29

Original Poster
Rep: Reputation: 0
an additional question:
does the command: "mdadm --create /dev/md0 --level=1 /dev/sdx1 /dev/sdy1" with the right arguments, destroy the data on the intact usb drive?
 
Old 01-17-2020, 11:30 AM   #3
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,702

Rep: Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896
Yes.

Post the output of the command:
sudo mdadm -D /dev/md127

It will just output status and details of the RAID. It will not change anything.

Quote:
sdc
└─sdc1 linux_r homer:0 a3e7388f-b23e-585f-c61c-9573d129fca1
└─md127 ext4 5c40fa6a-ee42-40a9-a45b-d04da893b67d /media/ed/
sdd
└─sdd1 linux_r homer:0 a3e7388f-b23e-585f-c61c-9573d129fca1
It looks like the raid is running on one disk and mounted to /media/ed.

Last edited by michaelk; 01-17-2020 at 01:42 PM.
 
Old 01-17-2020, 01:30 PM   #4
edvdrmark
LQ Newbie
 
Registered: Jan 2006
Location: Oegstgeest, Netherlands
Distribution: opensuse 13.1
Posts: 29

Original Poster
Rep: Reputation: 0
Yes, one disk is mounted to /media/ed.

This is the output:

ed@laptop ~ $ sudo mdadm -D /dev/md127
mdadm: ARRAY line RD_NA9W41BP-0:0 has no identity information.
/dev/md127:
Version : 1.2
Creation Time : Sat Aug 3 00:16:38 2019
Raid Level : raid1
Array Size : 4883637248 (4657.40 GiB 5000.84 GB)
Used Dev Size : 4883637248 (4657.40 GiB 5000.84 GB)
Raid Devices : 2
Total Devices : 1
Persistence : Superblock is persistent

Intent Bitmap : Internal

Update Time : Fri Jan 17 17:41:11 2020
State : clean, degraded
Active Devices : 1
Working Devices : 1
Failed Devices : 0
Spare Devices : 0

Consistency Policy : bitmap

Name : homer:0
UUID : a3e7388f:b23e585f:c61c9573:d129fca1
Events : 318513

Number Major Minor RaidDevice State
0 8 33 0 active sync /dev/sdc1
- 0 0 1 removed
ed@laptop ~ $
 
Old 01-17-2020, 01:35 PM   #5
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
Re-create the RAID and copyyour backup onto it.
 
Old 01-17-2020, 02:09 PM   #6
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,702

Rep: Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896
As stated the RAID is running but just with 1 disk in degraded mode. All the data should be ok with RAID 1 because the disks are an exact copy of each other.

Do you know if the second disk is still ok? Maybe run SMART diagnostics to check its status. You do not need to recreate the RAID but having a backup is a good idea.

Status shows the second drive as removed. The second disk should be partitioned exactly like the first. To replace the second disk run the command.

sudo mdadm --manage /dev/md127 --add /dev/sdx1 (make sure you use the correct device ID)

To check the RAID status run the commands
sudo mdadm -D /dev/md127

cat /proc/mdstat
 
Old 01-17-2020, 02:38 PM   #7
edvdrmark
LQ Newbie
 
Registered: Jan 2006
Location: Oegstgeest, Netherlands
Distribution: opensuse 13.1
Posts: 29

Original Poster
Rep: Reputation: 0
Quote:
Re-create the RAID and copyyour backup onto it.
The backup is one of the RAID drives!
So my question is: can I build the RAID1 without data loss of that drive. For instance with the similar command like:

does the command: "mdadm --create /dev/md0 --level=1 /dev/sdx1 /dev/sdy1" with the right arguments, destroy the data on the intact usb drive? Let's say that /dev/sdx1 is the drive with all the data. What happens with that?
 
Old 01-17-2020, 03:27 PM   #8
michaelk
Moderator
 
Registered: Aug 2002
Posts: 25,702

Rep: Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896Reputation: 5896
Yes, see my post above.
Search the internet on how to replace a drive in a mdadm RAID 1

Yes, running create on an existing array drive will essentially destroy the data. It actually erases the metadata making data recovery very difficult.

RAID is not a backup. It purpose is to protect against a hard drive failure which appeared to work in this case but we do not know if the drive just became corrupted or has failed.
 
Old 01-17-2020, 07:51 PM   #9
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,128

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
Let's hope the drives have external power. Personally I wouldn't re-use the failed drive, but get a new one and test the failed one at your leisure.

Get some diagnostic data - the smart data asked for already and your logs for the initial failure; I'd guess the drive now simply gets ignored at assemble, so likely no useful messages then.
Without a proper backup your data are at risk whilst you are fooling with the disk(s). Simple as that.
 
  


Reply



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
Trying to recover RAID1 drives Dick_Kennedy Linux - Server 6 04-17-2019 09:26 AM
[SOLVED] Failure after failure after failure.....etc 69Rixter Linux - Laptop and Netbook 5 04-14-2015 09:58 AM
Recover Raid+LVM on non system drives after system failure spindley Linux - General 4 01-19-2011 04:18 PM
How to recover a raid1 over nbd after failure of local disk? adrian_stephens Linux - Server 1 05-22-2009 12:16 PM
RAID1 failure - Need advice on ow to recover Ezplan Linux - Hardware 3 01-24-2006 09:10 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 04:00 AM.

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